[prev in list] [next in list] [prev in thread] [next in thread] 

List:       busybox
Subject:    Re: ftpd authentication [PATCH] ftpd: NOMMU/chroot fix
From:       Denys Vlasenko <vda.linux () googlemail ! com>
Date:       2014-06-30 13:20:13
Message-ID: CAK1hOcOxevcDP39DB5PzxseHvqny50SPg7Vu2Aej-5SL0_W98g () mail ! gmail ! com
[Download RAW message or body]

On Fri, Jun 27, 2014 at 3:37 PM, Rich Felker <dalias@libc.org> wrote:
> On Fri, Jun 27, 2014 at 01:55:26PM +0200, Denys Vlasenko wrote:
>> On Fri, Jun 27, 2014 at 1:46 PM, Morten Kvistgaard
>> <MK@pch-engineering.dk> wrote:
>> > A small detail, why do you check if the root_fd is valid? Eg.
>> >
>> > ...
>> > if (G.root_fd >= 0) {
>> > ...
>> >
>> > It shouldn't be possible for it to be invalid and the old code didn't validate it either.
>>
>> I added this in the next patch:
>>
>>  #if !BB_MMU
>> -       G.root_fd = xopen("/", O_RDONLY | O_DIRECTORY);
>> -       close_on_exec_on(G.root_fd);
>> +       G.root_fd = -1;
>>  #endif
>>         argv += optind;
>>         if (argv[0]) {
>> +#if !BB_MMU
>> +               G.root_fd = xopen("/", O_RDONLY | O_DIRECTORY);
>> +               close_on_exec_on(G.root_fd);
>> +#endif
>
> It would be nice to have an "assume O_CLOEXEC" build option and use
> O_CLOEXEC wherever close_on_exec_on is currently used. Might save a
> little bit of bloat if nothing else. This could probably be achieved
> just by adding O_CLOEXEC at the call sites, defining it to 0 if the
> system doesn't define it, and defining close_on_exec_on(x) away to
> nothing if the build option is selected.

O_CLOEXEC is from 2007:


commit f23513e8d96cf5e6cf8d2ff0cb5dd6bbc33995e4
Author: Ulrich Drepper <drepper@redhat.com>
Date:   Sun Jul 15 23:40:32 2007 -0700

    Introduce O_CLOEXEC


I propose waiting till ~2017 and then deprecate support
for "ancient kernels which doesn't support O_CLOEXEC".
_______________________________________________
busybox mailing list
busybox@busybox.net
http://lists.busybox.net/mailman/listinfo/busybox
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic