setrlimit change to prlimit change in behavior?
Carlos O'Donell
carlos@redhat.com
Wed Oct 18 17:44:00 GMT 2017
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.
More information about the Libc-alpha
mailing list