[PATCH 1/3] elf: load the main program from AT_EXECFD when run as a binfmt interpreter
Christian Brauner
brauner@kernel.org
Wed Jul 15 20:31:25 GMT 2026
On 2026-07-15 13:10 +0200, Florian Weimer wrote:
> * Christian Brauner:
>
> > +struct link_map *
> > +_dl_map_object_execfd (int fd, const char *name)
> > +{
> > + struct filebuf fb;
> > + bool found_other_class = false;
> > +
> > + /* The kernel hands over the descriptor with the file position at
> > + zero, but an explicit loader invocation need not; the header check
> > + in open_verify reads sequentially. */
> > + __lseek (fd, 0, SEEK_SET);
>
> This does not seem quite right. If we need to deal with weird file
> pointers in shared files, we can't use read(v) for reading data, and
> would have to use pread(v) instead.
Yes, I'll switch to pread().
More information about the Libc-alpha
mailing list