Re: [PATCH v5 2/4] man/man5/tunables.conf: Document system-wide tunables config

Alejandro Colomar <[email protected]>
Newsgroups org.kernel.vger.linux-man
Message-ID <anUjle4uSQ-RTF_Q@devuan>
> Date: 2026-08-07 02:11:04+0200
> From: Alejandro Colomar <[email protected]>
>
> > Date: 2026-08-07 02:07:00+0200
> > From: Alejandro Colomar <[email protected]>
> >
> > Hi DJ,
> > 
> > > Date: 2026-08-06 18:15:15-0400
> > > From: DJ Delorie <[email protected]>
> > >
> > > Alejandro Colomar <[email protected]> writes:
> > > > You forgot to sign.
> > > 
> > > I will never remember that... :-P
> > > 
> > > >> +The resulting data is read when a new process is created by
> > > >> +.IR ld.so .
> > > >
> > > > Sorry for noticing this in v4; I forgot about it.  I see this unresolved
> > > > issue from earlier versions remains.
> > > 
> > > A program is a file on disk.  A process is a running memory image.
> > 
> > Yup.  fork(3) creates a process (produces a new PID).  execve(2)
> > replaces the image of the current process with a program read from disk
> > (or in short, executes a program in the current process).
> > 
> > > 
> > > Neither fork() nor exec() cause the tunables to be loaded, the process
> > > itself has to do that.  For dynamic ELF programs/processes built with
> > > glibc, ld.so does it before it passes control to the ELF image.  There
> > > are other types of programs/processes that do not use ld.so and thus do
> > > not read the tunables cache (which is called "ld.so.cache" for a reason ;-)
> > 
> > Hmmmmm, let's say you call execve(2) several times without any fork(2)s.
> > Assuming a that the program paths that you pass to execve(2) are all
> > dynamic ELF programs built with glibc, I guess for every time you call
> > execve(2), ld.so(8) will be run, and the tunables stored in ld.so.cache
> > will be used.  Is this correct?
> > 
> > 	#include <unistd.h>
> > 	int
> > 	main(int, char *argv[])
> > 	{
> > 		sleep(1);
> > 		execve("proc/self/exe", argv, NULL);

Dumb of me; missing leading '/'.  :)


Cheers,
Alex

> > 	}
> 
> Oh, I thought this would work as a recursive infinite-loop program.  It
> doesn't seem to work.  I guess there's some race condition?  :D
> 
> 	alx@devuan:~$ cd tmp/
> 	alx@devuan:~/tmp$ cat ex.c 
> 	#include <unistd.h>
> 	int
> 	main(int, char *argv[])
> 	{
> 		sleep(1);
> 		execve("proc/self/exe", argv, NULL);
> 	}
> 
> 	alx@devuan:~/tmp$ gcc -Wall -Wextra ex.c 
> 	alx@devuan:~/tmp$ time ./a.out 
> 
> 	real	0m1.003s
> 	user	0m0.003s
> 	sys	0m0.000s
> 
> 
> Cheers,
> Alex
> 
> > 
> > Let's also say you fork(2) several times, without any execve(2) calls.
> > I suppose that won't trigger any of this, right?
> > 
> > 	#include <unistd.h>
> > 	int
> > 	main(void)
> > 	{
> > 		for (int i = 0; i < 10; i++) {
> > 			sleep(1);
> > 			fork();
> > 		}
> > 	}
> > 
> > From my understanding, only the first program will trigger this more
> > than once, right?
> > 
> > If so, I'd use the same wording that execve(2) uses:
> > 
> > 	execve() executes the program referred to by path.
> > 
> > That is, execve(2) executes programs, and ld.so.cache is read when
> > a program is executed (in the current process).
> > 
> > > 
> > > I don't know how to say this clearly with fewer words...
> > > 
> > > >> +The syntax allows lines to start with the keyword
> > > >> +.I include
> > > >
> > > > s/I/B/  (since it's a literal, not a variable)
> > > 
> > > Fixed.
> > > 
> > 
> > 
> > Cheers,
> > Alex
> > 
> > -- 
> > <https://www.alejandro-colomar.es>
> 
> 
> 
> -- 
> <https://www.alejandro-colomar.es>



-- 
<https://www.alejandro-colomar.es>
signature.asc (application/pgp-signature, 833 B)
-----BEGIN PGP SIGNATURE-----

iQIzBAABCgAdFiEES7Jt9u9GbmlWADAi64mZXMKQwqkFAmp1I6sACgkQ64mZXMKQ
wqm1/w//VTIRovdCdt8eB56Vq5Ir8QA3kSHYYEKsqzQaKD991octJhMCL4RGqtS9
9fqJ/h/PScgNiSgftsm2XNLDJKy4GfArs2VS1+HSMbcy99UWEIjpWur8EAR5A8vI
tZ++aP/opjwQuZd/REr7uTXxgJBU/Q5nHLutb9lu4ysPSQhq9IS7q/sdihlXv8iI
haCgRmH/k58lE6OdFctgHZFUj1qNGhDQ9+75l8WbRBXk7XLwPYKg/0ZqemijgdG9
gP50wRyjxX8hxp6kKhRuruNFjeRRR8OYDmHI01p6T+qLf6o9+L9vQ1L8VWUgBgso
BsZZXtiKQ6dwvGAC1611afz7TVXCRYxgSzZ4Nviu+bGvFMO3QtFrn7opm8Tti8vt
p13eF3V60kTt4I3Gc6OYk6ublgzntJHILtdCw1MK7efUbF4HrhU+MMPDk/cJ4mAi
PP9nRVQIrZb1Rbfm+jBxe3NRpDAHIK9Icx+PeO7fBk63f/vF0/HK/4C3uF8JCjOt
ROLjSFVCi6JXizC2TzDJ3PPO3RxPSEvRB4xlS9hct3m3Wa3DvuLFULPztVoeJgz8
DS7zqG/8QxkBZZ1raVg9m15e2n6BTgx/XeXTBbDFJhlVIdqAB1rl6L5F9Mb3miGg
Bgbi3qXVKOMV0P2eWG2/adVTQ5RjXNPmdKslz6ogNzQibF8g6Q0=
=rDmK
-----END PGP SIGNATURE-----
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.