This is the mail archive of the libc-alpha@sourceware.org mailing list for the glibc project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: setrlimit change to prlimit change in behavior?


On 10/18/2017 08:04 AM, Andreas Schwab wrote:
> On Okt 18 2017, Mark Wielaard <mark@klomp.org> wrote:
> 
>> On Wed, 2017-10-18 at 16:13 +0200, Andreas Schwab wrote:
>>> On Okt 18 2017, Mark Wielaard <mark@klomp.org> wrote:
>>>
>>>> The valgrind testsuite has a testcase that checks that
>>>>  setrlimit (RLIMIT_NOFILE, NULL)
>>>> returns failure and sets errno to EFAULT.
>>>
>>> In general, you cannot count on EFAULT.  The call has undefined
>>> behaviour, thus unbounded effect (a crash would be ok too).
>>
>> Interesting. I didn't know undefined behavior extended to the Posix
>> functions. So does this hold for all functions defined by Posix that
>> have pointer arguments that are outside the accessible address space?
> 
> 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

-- 
Cheers,
Carlos.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]