public inbox for glibc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug libc/27824] New: preadv2 and pwritev2 offset argument passing on 64bit targets
@ 2021-05-04 14:56 nsz at gcc dot gnu.org
2021-05-04 15:21 ` [Bug libc/27824] " schwab@linux-m68k.org
2021-05-04 17:29 ` adhemerval.zanella at linaro dot org
0 siblings, 2 replies; 3+ messages in thread
From: nsz at gcc dot gnu.org @ 2021-05-04 14:56 UTC (permalink / raw)
To: glibc-bugs
https://sourceware.org/bugzilla/show_bug.cgi?id=27824
Bug ID: 27824
Summary: preadv2 and pwritev2 offset argument passing on 64bit
targets
Product: glibc
Version: 2.33
Status: NEW
Severity: normal
Priority: P2
Component: libc
Assignee: unassigned at sourceware dot org
Reporter: nsz at gcc dot gnu.org
CC: drepper.fsp at gmail dot com
Target Milestone: ---
the linux preadv2 offset arg passing code is
/* Provide a macro to pass the off{64}_t argument on p{readv,writev}{64}. */
#define LO_HI_LONG(val) \
(long) (val), \
(long) (((uint64_t) (val)) >> 32)
on a 64bit target the first arg contains the entire 64bit offset
but i'd expect the second arg to be fixed 0.
linux does not seem to look at the second arg now on 64bit targets,
but it seems cleaner to pass 0 instead of top 32bit of val.
x86_64 seems to fixed this but other targets still have the >> 32
logic.
--
You are receiving this mail because:
You are on the CC list for the bug.
^ permalink raw reply [flat|nested] 3+ messages in thread
* [Bug libc/27824] preadv2 and pwritev2 offset argument passing on 64bit targets
2021-05-04 14:56 [Bug libc/27824] New: preadv2 and pwritev2 offset argument passing on 64bit targets nsz at gcc dot gnu.org
@ 2021-05-04 15:21 ` schwab@linux-m68k.org
2021-05-04 17:29 ` adhemerval.zanella at linaro dot org
1 sibling, 0 replies; 3+ messages in thread
From: schwab@linux-m68k.org @ 2021-05-04 15:21 UTC (permalink / raw)
To: glibc-bugs
https://sourceware.org/bugzilla/show_bug.cgi?id=27824
--- Comment #1 from Andreas Schwab <schwab@linux-m68k.org> ---
commit 468700675f claims to use __OFF_T_MATCHES_OFF64_T, but doesn't.
--
You are receiving this mail because:
You are on the CC list for the bug.
^ permalink raw reply [flat|nested] 3+ messages in thread
* [Bug libc/27824] preadv2 and pwritev2 offset argument passing on 64bit targets
2021-05-04 14:56 [Bug libc/27824] New: preadv2 and pwritev2 offset argument passing on 64bit targets nsz at gcc dot gnu.org
2021-05-04 15:21 ` [Bug libc/27824] " schwab@linux-m68k.org
@ 2021-05-04 17:29 ` adhemerval.zanella at linaro dot org
1 sibling, 0 replies; 3+ messages in thread
From: adhemerval.zanella at linaro dot org @ 2021-05-04 17:29 UTC (permalink / raw)
To: glibc-bugs
https://sourceware.org/bugzilla/show_bug.cgi?id=27824
Adhemerval Zanella <adhemerval.zanella at linaro dot org> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |adhemerval.zanella at linaro dot o
| |rg
--- Comment #2 from Adhemerval Zanella <adhemerval.zanella at linaro dot org> ---
The preadv2/pwritev2 for x32 is slight different than the other architectures:
i686 and x86_64 uses sys_pwritev2 entrypoint while x32 uses
*compat_sys_pwritev64v2*:
| asmlinkage long compat_sys_pwritev64v2(unsigned long fd,
| const struct iovec __user *vec,
| unsigned long vlen, loff_t pos, rwf_t flags);
So x32 does require a specific LO_HI_LONG macro.
However for other architecture I do think this is really and issue, the kernel
entrypoints are defined.
| SYSCALL_DEFINE6(preadv2, unsigned long, fd, const struct iovec __user *, vec,
| unsigned long, vlen, unsigned long, pos_l, unsigned long,
pos_h,
| rwf_t, flags)
| COMPAT_SYSCALL_DEFINE6(preadv2, compat_ulong_t, fd,
| const struct iovec __user *, vec,
| compat_ulong_t, vlen, u32, pos_low, u32, pos_high,
| rwf_t, flags)
So both do accept a pos_low, but it does make sense only for architectures
where sizeof (unsigned long) < sizeof (off_t).
Maybe by using:
| #ifdef __WORDSIZE == 32
| # define LO_HI_LONG(val) \
| (unsigned long int) (val), (unsinged long int) (((uint64_t) (val) >> 32))
| #else
| # define LO_HI_LONG(val) \
| (unsigned long int) (val), 0
| #endif
It should cover all cases of compat and default usage, including mips64n32.
x32 will need to continue use its own definition (since it defines
__ASSUME_WORDSIZE64_ILP32).
--
You are receiving this mail because:
You are on the CC list for the bug.
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2021-05-04 17:29 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-05-04 14:56 [Bug libc/27824] New: preadv2 and pwritev2 offset argument passing on 64bit targets nsz at gcc dot gnu.org
2021-05-04 15:21 ` [Bug libc/27824] " schwab@linux-m68k.org
2021-05-04 17:29 ` adhemerval.zanella at linaro dot org
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).