Re: [PATCH 1/3] elf: load the main program from AT_EXECFD when run as a binfmt interpreter

Andreas Schwab <[email protected]>
Newsgroups gmane.comp.lib.glibc.alpha
Message-ID <[email protected]>
On Jul 15 2026, Christian Brauner wrote:

> +      /* Move the descriptor out of the standard range: it is closed
> +	 once the program is mapped, and a secure process must not
> +	 start with a silently closed standard descriptor.  The
> +	 standard descriptor check at startup ran while the descriptor
> +	 still occupied the slot, so run it again once the slot is
> +	 free.  */
> +      if (execfd >= 0 && execfd <= STDERR_FILENO)
> +	{
> +	  int movedfd = __fcntl64_nocancel (execfd, F_DUPFD,
> +					    STDERR_FILENO + 1);
> +	  if (movedfd >= 0)

If F_DUPFD failed here in a __libc_enable_secure program, it will be run
with a closed std desc, defeating __libc_check_standard_fds.

-- 
Andreas Schwab, SUSE Labs, [email protected]
GPG Key fingerprint = 0196 BAD8 1CE9 1970 F4BE  1748 E4D4 88E3 0EEA B9D7
"And now for something completely different."
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.