sudo, advising kernel to anticipate execution

Henry Baldursson henry.baldursson at gmail.com
Wed Feb 16 01:42:33 CST 2005


Ok,
I fixed a logic bug in the patch, removed those macros, and decided to
use semaphores instead of conds+mutexes for synchronisation. Reduces
the patch a bit.

Would be great if someone would try it out.

Henry.

On Tue Feb 15 23:36:54 CST 2005 I wrote:
> 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: 4306 bytes
Desc: not available
Url : http://lists.ubuntu.com/archives/ubuntu-devel/attachments/20050216/f19a7b0f/sudo-readahead.bin


More information about the ubuntu-devel mailing list