This is the mail archive of the
libc-alpha@sourceware.org
mailing list for the glibc project.
Re: setrlimit change to prlimit change in behavior?
- From: Andreas Schwab <schwab at suse dot de>
- To: Mark Wielaard <mark at klomp dot org>
- Cc: libc-alpha at sourceware dot org, "Michael Kerrisk \(man-pages\)" <mtk dot manpages at gmail dot com>
- Date: Wed, 18 Oct 2017 17:04:32 +0200
- Subject: Re: setrlimit change to prlimit change in behavior?
- Authentication-results: sourceware.org; auth=none
- References: <1508334375.3073.9.camel@klomp.org> <mvmwp3s35nw.fsf@suse.de> <1508337966.3073.11.camel@klomp.org>
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.
Andreas.
--
Andreas Schwab, SUSE Labs, schwab@suse.de
GPG Key fingerprint = 0196 BAD8 1CE9 1970 F4BE 1748 E4D4 88E3 0EEA B9D7
"And now for something completely different."