EFAULT vs SIGSEGV on write()
Posted Jun 22, 2012 17:59 UTC (Fri) by
giraffedata (subscriber, #1954)
In reply to:
msync() and subtle behavioral tweaks by nix
Parent article:
msync() and subtle behavioral tweaks
Anyone intercepting relatively-bare syscalls and converting them into library functions like that had better trap SIGSEGV during the call and convert it into an -EFAULT return.
But do the standards or conventional architecture really call for that? I don't think the POSIX definition of write() uses the word "kernel" and I believe the general understanding for any library is that if you pass an invalid address to a subroutine, it might generate a SIGSEGV.
Or are you just making a practicality argument, since people might be depending on EFAULT. I think it would be a pretty unusual program that passes invalid addresses to write() when the program isn't broken.
(
Log in to post comments)