setrlimit change to prlimit change in behavior?

Mark Wielaard mark@klomp.org
Wed Oct 18 19:06:00 GMT 2017


On Wed, 2017-10-18 at 10:44 -0700, Carlos O'Donell wrote:
> On 10/18/2017 08:04 AM, Andreas Schwab wrote:
> > If there is no special case for NULL then it is not allowed.
> 
> Agreed.
> 
> And testing for NULL and returning EFAULT is not something we actually
> want to do, please see:
> https://sourceware.org/glibc/wiki/Style_and_Conventions#Error_Handling

Thanks for that reference. Of course for my use case (syscall argument
sanity checking) I shouldn't rely on the glibc behavior. So we can
certainly change our testcase to not go through glibc and use direct
syscalls.

But if I were to rely on the glibc behavior what exactly defines the
contract? Naively I used the man page for setrlimit.
http://man7.org/linux/man-pages/man2/setrlimit.2.html
Which at first glance seems to define the contract for glibc (and the
kernel combined). And it does explicitly say:

ERRORS          
       EFAULT A pointer argument points to a location outside the
	      accessible address space.

I cannot immediately deduce from this document which errors define the
contract of the linux kernel interface and which of glibc.

Thanks,

Mark



More information about the Libc-alpha mailing list