On 24 Jan 2021, at 01:52, Jessica Clarke <jrt...@jrtc27.com> wrote: > On 24 Jan 2021, at 01:27, Samuel Thibault <samuel.thiba...@gnu.org> wrote: >> Jessica Clarke, le dim. 24 janv. 2021 01:16:13 +0000, a ecrit: >>> maybe Hurd should also be nice. >> >> Right, we could hack ioctl into doing if (request == TIOCFLUSH && !arg) >> arg = &zero. >> >> That still leaves us with applications that don't even pass an argument, >> but I guess we can convince their maintainers to just fix their code. > > Yeah that has never correct. It used to take a single pointer argument, > no varargs (presumably because varargs was even weirder in K&R C and > awkward for syscalls), and that was still the case in 4.2BSD when > TIOCFLUSH started accepting a non-NULL argument for flags. Only NULL > and a pointer to an int have ever been valid.
I imagine those broken uses are getting EFAULT from the syscall on the BSDs, but nobody bothers checking the return code. Only once you dereference the pointer in userspace do you start getting a SIGSEGV/SIGBUS instead. Jess