Follow @Openwall on Twitter for new release announcements and other news
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date: Thu, 15 Oct 2020 16:03:01 -0400
From: Rich Felker <>
To: Alexey Izbyshev <>
Subject: Re: Why is setrlimit() considered to have per-thread effect?

On Thu, Oct 15, 2020 at 09:26:33PM +0300, Alexey Izbyshev wrote:
> On 2020-10-15 20:13, Rich Felker wrote:
> >On Thu, Oct 15, 2020 at 07:13:30PM +0300, Alexey Izbyshev wrote:
> >If correct, I agree -- we can avoid the need for __synccall when
> >prlimit works. I'd like to find commits or source lines supporting
> >that in their actual (code) content though rather than just as a
> >mention in commit messages, since it's contrary to what my (probably
> >outdated) understanding of how rlimits worked was.
> >
> Here they are (the first two were referenced in my reply to Szabolcs).
> * Change of setrlimit() to operate on signal_struct in 2.6.10:
> (compare with
> * Definition of signal_struct in 2.6.10, which is per-thread-group
> (apart from "rlim", it contains many other thread-group-related
> fields):
> * Usage if signal_struct in 2.6.36 (the first kernel with prlimit())
> in do_prlimit(), which is a common function implementing
> setrlimit(), getrlimit() and prlimit():
> Finally, I performed a simple experiment: on 2.6.30 kernel (with
> glibc 2.5), created a thread and changed RLIMIT_FSIZE via
> setrlimit(). After that, "/proc/pid/limits" reported the new limit,
> so it was applied to the whole process. Strace confirmed that only a
> single setrlimit() system call was performed.

Excellent, thanks for doing this research! I'll adjust setrlimit to
use __synccall only in the fallback where SYS_prlimit fails.


Powered by blists - more mailing lists

Confused about mailing lists and their use? Read about mailing lists on Wikipedia and check out these guidelines on proper formatting of your messages.