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 10:50:24 +0200
From: Szabolcs Nagy <nsz@...t70.net>
To: Alexey Izbyshev <izbyshev@...ras.ru>
Cc: musl@...ts.openwall.com
Subject: Re: Why is setrlimit() considered to have per-thread effect?

* Alexey Izbyshev <izbyshev@...ras.ru> [2020-10-15 08:01:00 +0300]:
> Commit 544ee752cd[1] claims that setrlimit() is per-thread on Linux,
> similarly to setxid() calls, so it should be called via __synccall(). But
> this appears to be wrong: the kernel code operates on tsk->signal[2], which
> is a per-thread-group structure. Glibc doesn't call setrlimit() for each
> thread either. Am I missing something?

note that prlimit does not have synccall in
musl: the kernel implemented the per process
rlimit setting when prlimit was added.
(i think this is linux commit
 1c1e618ddd15f69fd87ccea596769f78c8065504 )

but older kernels don't have that.

> 
> Tangentially, setgroups() is not called via __synccall(), though it does
> have per-thread effect. Is this intentional?

that may be a bug, but it's not a posix api
so not a conformance issue, but a linux issue:
if other linux libcs don't do synccall then
that's the defacto interface contract.

> 
> Alexey
> 
> [1] https://git.musl-libc.org/cgit/musl/commit/?id=544ee752cd38febfa3aa3798b4dfb6fabd13846b
> [2] https://elixir.bootlin.com/linux/v5.9/source/kernel/sys.c#L1566

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.