sudo, advising kernel to anticipate execution
Henry Baldursson
henry.baldursson at gmail.com
Tue Feb 15 23:36:54 CST 2005
Hi,
this is ugly and maybe even a bit asinine. But I did it and decided to share it.
This patch should make sudo create a new thread just before verifying
the user and in that thread call readahead() and madvise() to
streamline the file loading at actual execution time.
Upside is that while you are fumbling about your keyboard with your
ambidextrous index fingers typing your password, the kernel should be
taking the executable you want to run and putting it in pagecache.
This will make the system seem quicker than the other kids'.
Downside is that since readahead() blocks us while the action is
performed, the patch requires we create a thread to do it, and then
synchronizing with the main thread. And that is ugly. Also the system
calls used are Linux specific.
Anyone that may sudo can cause this action, I only added restrictions
on that the file being executed must be owned by root and have atleast
110 set as mode. This I did only because I had that fancy stat struct
there and was only using it for size. Seemed a shame to let it go to
waste.
Since Ubuntu uses sudo heavily for most root actions, I figured people
might be interrested.
Henry.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: sudo-readahead.patch
Type: text/x-patch
Size: 4775 bytes
Desc: not available
Url : http://lists.ubuntu.com/archives/ubuntu-devel/attachments/20050216/4da2e5dd/sudo-readahead.bin
More information about the ubuntu-devel
mailing list