This is the mail archive of the
glibc-bugs@sourceware.org
mailing list for the glibc project.
[Bug libc/23951] New: pread64(fd, buf, (size_t)-1, offset) do not works as expected, using 32bit glibc-2.27 under 64bit-linux-4.4
- From: "wangfangpeng1 at huawei dot com" <sourceware-bugzilla at sourceware dot org>
- To: glibc-bugs at sourceware dot org
- Date: Tue, 04 Dec 2018 09:42:55 +0000
- Subject: [Bug libc/23951] New: pread64(fd, buf, (size_t)-1, offset) do not works as expected, using 32bit glibc-2.27 under 64bit-linux-4.4
- Auto-submitted: auto-generated
https://sourceware.org/bugzilla/show_bug.cgi?id=23951
Bug ID: 23951
Summary: pread64(fd, buf, (size_t)-1, offset) do not works as
expected, using 32bit glibc-2.27 under 64bit-linux-4.4
Product: glibc
Version: 2.27
Status: UNCONFIRMED
Severity: normal
Priority: P2
Component: libc
Assignee: unassigned at sourceware dot org
Reporter: wangfangpeng1 at huawei dot com
CC: drepper.fsp at gmail dot com
Target Milestone: ---
Hi
I got the wrong ret value and errno, when call pread64(fd, buf, (size_t)-1,
offset) using 32bit glibc-2.27, under 64bit-linux-4.4; but it works well for
64bit glibc-2.27 and 64bit linux-4.4(this bug can be found in arm64,x86_64… ).
root:/tmp # ./p-x86-32
pread64.ret = 0, errno = 0
root:/tmp # ./p-x86-64
pead64.ret = -1, errno = 14
Furthermore, I find that in 32bit glibc-2.27, sizeof(size_t)==4, but in the
64bit linux kernel sizeof(size_t)==8, and 0xffffffff is a reasonable count for
64bit linux kernel.
So, do you think it’s a bug for glibc to be fixed up?
By the way glibc-2.20 have no such a problem.
Looking forward to your early reply…
Glibc-2.27: sysdeps/unix/sysv/linux/pread64.c
ssize_t
__libc_pread64 (int fd, void *buf, size_t count, off64_t offset)
{
return SYSCALL_CANCEL (pread64, fd, buf, count, SYSCALL_LL64_PRW (offset));
}
Kernel-4.4: fs/read_write.c
SYSCALL_DEFINE4(pread64, unsigned int, fd, char __user *, buf,
size_t, count, loff_t, pos)
{
struct fd f;
ssize_t ret = -EBADF;
if (pos < 0)
return -EINVAL;
f = fdget(fd);
if (f.file) {
ret = -ESPIPE;
if (f.file->f_mode & FMODE_PREAD)
ret = vfs_read(f.file, buf, count, &pos);
fdput(f);
}
return ret;
}
--
You are receiving this mail because:
You are on the CC list for the bug.
- Follow-Ups:
- [Bug libc/23951] pread64(fd, buf, (size_t)-1, offset) do not works as expected, using 32bit glibc-2.27 under 64bit-linux-4.4
- From: wangfangpeng1 at huawei dot com
- [Bug libc/23951] pread64(fd, buf, (size_t)-1, offset) do not works as expected, using 32bit glibc-2.27 under 64bit-linux-4.4
- From: fweimer at redhat dot com
- [Bug libc/23951] pread64(fd, buf, (size_t)-1, offset) do not works as expected, using 32bit glibc-2.27 under 64bit-linux-4.4
- From: schwab at linux-m68k dot org
- [Bug libc/23951] pread64(fd, buf, (size_t)-1, offset) do not works as expected, using 32bit glibc-2.27 under 64bit-linux-4.4
- From: wangfangpeng1 at huawei dot com
- [Bug libc/23951] pread64(fd, buf, (size_t)-1, offset) do not works as expected, using 32bit glibc-2.27 under 64bit-linux-4.4
- From: wangfangpeng1 at huawei dot com
- [Bug libc/23951] pread64(fd, buf, (size_t)-1, offset) do not works as expected, using 32bit glibc-2.27 under 64bit-linux-4.4
- From: adhemerval.zanella at linaro dot org