NetBSD-Bugs archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
PR/57504 CVS commit: src/sys/kern
The following reply was made to PR kern/57504; it has been noted by GNATS.
From: "Robert Elz" <kre%netbsd.org@localhost>
To: gnats-bugs%gnats.NetBSD.org@localhost
Cc:
Subject: PR/57504 CVS commit: src/sys/kern
Date: Fri, 18 Oct 2024 13:12:34 +0000
Module Name: src
Committed By: kre
Date: Fri Oct 18 13:12:34 UTC 2024
Modified Files:
src/sys/kern: sys_select.c
Log Message:
PR kern/57504 : Check all fds passed in to select
If an application passes in a huge fd_set (select(BIG, ...))
then check every bit in the fd_sets provided, to make sure
they are valid.
If BIG is too big (cannot possibly represent an open fd for
this process, under any circumstances: ie: not just because
that many are not currently open) return EINVAL.
Otherwise, check every set bit to make sure it is valid. Any
fd bits set above the applications current highest open fd
automatically generate EBADF and quick(ish) exit.
fd's that are within the plausible range are then checked as
they always were (it is possible for there to be a few there
above the max open fd - as everything in select is done in
multiples of __FDBITS (fd_mask) but the max open fd is not so
constrained. Those always were checked, continue using the
same mechanism.
This should have zero impact on any sane application which
uses the highest fd for which it set a bit, +1, as the first
arg to select. However, if there are any broken applications
that were relying upon the previous behaviour of simply ignoring
any fd_masks that started beyond the max number of open files,
then they might (if they happen to have any bits set) now fail.
XXX pullup -10 -- but not for a long time. Someone remind me
sometime next year. Leave a long settling time in HEAD just to
be sure no issues arise, as in practice, almost nothing should
cause any of the new code to be executed.
pullup -9 -- probably not, what this fixes isn't significant
enough to bother going that far back for (IMO).
To generate a diff of this commit:
cvs rdiff -u -r1.66 -r1.67 src/sys/kern/sys_select.c
Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.
Home |
Main Index |
Thread Index |
Old Index