[PATCH] elf: fix pldd on targets that map objects above 2^63 [BZ #34641]
Stian Halseth
stian@itx.no
Thu Sep 17 08:44:42 GMT 2026
Hi,
On Thu, 2026-09-17 at 10:33 +0200, Florian Weimer wrote:
> * Stian Halseth:
>
> > > The process_vm_readv was not added at same time on all ABIs.
> > > Although
> > > for mostly kABI it was done on 3.2, for arm32 compat (aarch64
> > > kernel)
> > > it was done on 3.7, on hppa at 3.9.
> > >
> > > Maybe we can just lseek/read:
> > >
> > > static ssize_t
> > > pread_mem (int fd, void *buf, size_t nbytes, uint64_t addr)
> > > {
> > > if (lseek (fd, (off_t) addr, SEEK_SET) == (off_t) -1)
> > > return -1;
> > >
> > > return read (fd, buf, nbytes);
> > > }
> > >
> >
> > Right, I missed that, and you're right. I have tested your
> > suggestion.
> > It works and is much cleaner. Sending patch v2 now.
>
> Isn't it a kernel bug that lseek works, but not pread?
>
Looks that way. /proc/PID/mem is marked FOP_UNSIGNED_OFFSET.
mem_lseek honors it, but ksys_pread64 rejects a negative position
unconditionally (fs/read_write.c: "if (pos < 0) return -EINVAL;"),
without consulting that flag.
So pread and lseek disagree on the same descriptor.
For this patch, I think we just have to work around it, but I will look
into the kernel issue as well.
> Thanks,
> Florian
>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 228 bytes
Desc: This is a digitally signed message part
URL: <https://sourceware.org/pipermail/libc-alpha/attachments/20260917/ea1e7c8a/attachment.sig>
More information about the Libc-alpha
mailing list