Re: [PATCH] Time-based RFC 4122 UUID generator

Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]
From: Helge Deller
Date: Tuesday, November 20, 2007 - 2:59 pm

On Tuesday 20 November 2007, Matt Mackall wrote:

Yes, you'll need a futex or similiar.
The problem is then more, where will you put that futex to be able to protect against other processes ? 
Best solution is probably shared memory, but then the question will be, who is allowed to access this memory/futex ?
Will any process (shared library) be allowed to read/write/delete it ?
At this stage you then suddenly run from a locking-problem into a security problem, which is probably equally hard to solve.
Btw, this is how Novell tried to solve the time-based UUID generator problem in SLES and it's still not 100% fixed.


Sounds simple and is probably fast enough.
But do you really want to add then another daemon to the Linux system, just in case "some" application needs somewhen a UUID ?
And I think such an implementation is more complex, would need more memory, file handles, and so on than this simple kernel patch.


Yes.


I think mkfs was a very bad example from my side. I should not have mentioned this one.
Nevertheless, time-based UUIDs are used in quite many other and more critical applications than e2fsprogs tools.


True, but let's look at the facts.

Current libuuid.so (from e2fsprogs) library on Fedora 7 (i386):
   text    data     bss     dec     hex filename
   8101     368      40    8509    213d /lib/libuuid.so.1

And the kernel implementation:
   text    data     bss     dec     hex filename
   4877     604    2080    7561    1d89 drivers/char/random.o.without_uuid
   5976     752    2080    8808    2268 drivers/char/random.o.withuuid

So my patch increases the kernel by 1099 bytes text and 148 bytes data while guaranteeing 100% unique UUIDs.
libuuid.so takes 8k test and 368 bytes data, and does not guarantees the uniqueness. 
Of course libuuid.so has some helper functions as well in here, which - to be fair - shouldn't be counted.
Nevertheless, I think you can't get any smaller, faster and more secure implementation than only in the kernel.

Maybe it would make sense to add a CONFIG_TIME_UUID kernel option, so that distributors can decide themselves if they want the kernel UUID generator compiled in?
At least for Enterprise-ready Linux distributions it's a must.


Sure.

Helge
-
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]

Messages in current thread:
[PATCH] Time-based RFC 4122 UUID generator, Helge Deller, (Sun Nov 18, 12:38 pm)
Re: [PATCH] Time-based RFC 4122 UUID generator, Andrew Morton, (Sun Nov 18, 2:05 pm)
Re: [PATCH] Time-based RFC 4122 UUID generator, Sam Ravnborg, (Sun Nov 18, 2:34 pm)
Re: [PATCH] Time-based RFC 4122 UUID generator, Helge Deller, (Sun Nov 18, 2:40 pm)
Re: [PATCH] Time-based RFC 4122 UUID generator, Andrew Morton, (Mon Nov 19, 11:15 pm)
Re: [PATCH] Time-based RFC 4122 UUID generator, Matt Mackall, (Mon Nov 19, 11:31 pm)
Re: [PATCH] Time-based RFC 4122 UUID generator, Helge Deller, (Tue Nov 20, 2:59 pm)
Re: [PATCH] Time-based RFC 4122 UUID generator, Helge Deller, (Tue Nov 20, 3:40 pm)
Re: [PATCH] Time-based RFC 4122 UUID generator, Matt Mackall, (Tue Nov 20, 3:55 pm)
Re: [PATCH] Time-based RFC 4122 UUID generator, Theodore Tso, (Tue Nov 20, 4:00 pm)
Re: [PATCH] Time-based RFC 4122 UUID generator, Helge Deller, (Tue Nov 20, 4:11 pm)
Re: [PATCH] Time-based RFC 4122 UUID generator, Helge Deller, (Tue Nov 20, 4:30 pm)
Re: [PATCH] Time-based RFC 4122 UUID generator, Matt Mackall, (Tue Nov 20, 4:34 pm)