Force 64-bit time based syscalls for TIMESIZE==64 on 32-bit arches
PATCH 1/1 Force 64-bit time based syscalls for TIMESIZE==64 on 32-bit arches
This provides better out-of-box support for 32-bit arches with 64-bit time_t
--- sysdeps/unix/sysv/linux/generic/sysdep.h | 48 ++++++++++++++++++++++++ 1 file changed, 48 insertions(+)
sysdeps/unix/sysv/linux/generic/sysdep.h +48 -0
@@ -17,6 +17,7 @@ <https://www.gnu.org/licenses/>. */#include <bits/wordsize.h> +#include <bits/timesize.h> #include <kernel-features.h> #include <sysdeps/unix/sysdep.h> #include <sysdeps/unix/sysv/linux/sysdep.h>
@@ -33,3 +34,50 @@#define __NR_pread __NR_pread64#define __NR_pwrite __NR_pwrite64#endif + +/* Override syscalls for asm-generic ABIs with 64-bit time. */ +#if __WORDSIZE ==32 && __TIMESIZE ==64 + +# undef __NR_futex +# define __NR_futex __NR_futex_time64 + +# undef __NR_rt_sigtimedwait +# define __NR_rt_sigtimedwait __NR_rt_sigtimedwait_time64 + +# undef __NR_ppoll +# define __NR_ppoll __NR_ppoll_time64 + +# undef __NR_utimensat +# define __NR_utimensat __NR_utimensat_time64 + +# undef __NR_pselect6 +# define __NR_pselect6 __NR_pselect6_time64 + +# undef __NR_recvmmsg +# define __NR_recvmmsg __NR_recvmmsg_time64 + +# undef __NR_semtimedop +# define __NR_semtimedop __NR_semtimedop_time64 + +# undef __NR_mq_timedreceive +# define __NR_mq_timedreceive __NR_mq_timedreceive_time64 + +# undef __NR_mq_timedsend +# define __NR_mq_timedsend __NR_mq_timedsend_time64 + +# undef __NR_clock_getres +# define __NR_clock_getres __NR_clock_getres_time64 + +# undef __NR_timerfd_settime +# define __NR_timerfd_settime __NR_timerfd_settime64 + +# undef __NR_timerfd_gettime +# define __NR_timerfd_gettime __NR_timerfd_gettime64 + +# undef __NR_sched_rr_get_interval +# define __NR_sched_rr_get_interval __NR_sched_rr_get_interval_time64 + +# undef __NR_clock_adjtime +# define __NR_clock_adjtime __NR_clock_adjtime64 + +#endif
Signature · 7 lines
2.20.1 _______________________________________________ linux-snps-arc mailing list [email protected] http://lists.infradead.org/mailman/listinfo/linux-snps-arc
Quoted 22 lines · Vineet Gupta
This provides better out-of-box support for 32-bit arches with 64-bit
time_tSigned-off-by Vineet Gupta <[email protected]>--- sysdeps/unix/sysv/linux/generic/sysdep.h | 48 ++++++++++++++++++++++++ 1 file changed, 48 insertions(+)sysdeps/unix/sysv/linux/generic/sysdep.h +1
-0@@ -17,6 +17,7 @@ <https://www.gnu.org/licenses/>. */#include <bits/wordsize.h> +#include <bits/timesize.h> #include <kernel-features.h> #include <sysdeps/unix/sysdep.h> #include <sysdeps/unix/sysv/linux/sysdep.h>
sysdeps/unix/sysv/linux/generic/sysdep.h line 42
Quoted 9 lines
sysdeps/unix/sysv/linux/generic/sysdep.h +6
-0@@ -33,3 +34,50 @@#define __NR_pread __NR_pread64#define __NR_pwrite __NR_pwrite64#endif + +/* Override syscalls for asm-generic ABIs with 64-bit time. */ +#if __WORDSIZE ==32 && __TIMESIZE ==64 + +# undef __NR_futex +# define __NR_futex __NR_futex_time64
I think you should do what RV32 does and wrap these in ifndef's
Alistair
Quoted 42 lines
sysdeps/unix/sysv/linux/generic/sysdep.h +41
-1+ +# undef __NR_rt_sigtimedwait +# define __NR_rt_sigtimedwait __NR_rt_sigtimedwait_time64 + +# undef __NR_ppoll +# define __NR_ppoll __NR_ppoll_time64 + +# undef __NR_utimensat +# define __NR_utimensat __NR_utimensat_time64 + +# undef __NR_pselect6 +# define __NR_pselect6 __NR_pselect6_time64 + +# undef __NR_recvmmsg +# define __NR_recvmmsg __NR_recvmmsg_time64 + +# undef __NR_semtimedop +# define __NR_semtimedop __NR_semtimedop_time64 + +# undef __NR_mq_timedreceive +# define __NR_mq_timedreceive __NR_mq_timedreceive_time64 + +# undef __NR_mq_timedsend +# define __NR_mq_timedsend __NR_mq_timedsend_time64 + +# undef __NR_clock_getres +# define __NR_clock_getres __NR_clock_getres_time64 + +# undef __NR_timerfd_settime +# define __NR_timerfd_settime __NR_timerfd_settime64 + +# undef __NR_timerfd_gettime +# define __NR_timerfd_gettime __NR_timerfd_gettime64 + +# undef __NR_sched_rr_get_interval +# define __NR_sched_rr_get_interval __NR_sched_rr_get_interval_time64 + +# undef __NR_clock_adjtime +# define __NR_clock_adjtime __NR_clock_adjtime64 + +#endif --
Quoted 2 lines
2.20.1
_______________________________________________
linux-snps-arc mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-snps-arc
Quoted 6 lines · Alistair Francis
sysdeps/unix/sysv/linux/generic/sysdep.h line 42
Quoted 5 lines
sysdeps/unix/sysv/linux/generic/sysdep.h +5
-0+/* Override syscalls for asm-generic ABIs with 64-bit time. */ +#if __WORDSIZE ==32 && __TIMESIZE ==64 + +# undef __NR_futex +# define __NR_futex __NR_futex_time64I think you should do what RV32 does and wrap these in ifndef's
ARC asm-generic ABI is different from the ones newer arches have. For us the these syscalls already exist and the idea is to replace them with the 64-bit variants which requires #undef.
-Vineet
_______________________________________________
linux-snps-arc mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-snps-arc
* Vineet Gupta:
sysdeps/unix/sysv/linux/generic/sysdep.h line 45
Quoted 8 lines
sysdeps/unix/sysv/linux/generic/sysdep.h +8
-0+/* Override syscalls for asm-generic ABIs with 64-bit time. */ +#if __WORDSIZE ==32 && __TIMESIZE ==64 + +# undef __NR_futex +# define __NR_futex __NR_futex_time64 + +# undef __NR_rt_sigtimedwait +# define __NR_rt_sigtimedwait __NR_rt_sigtimedwait_time64
I'm not totally unsympathetic to this in principle, but I think if we start messing more with the system call numbers in this way, we should move away from the __NR_ prefixes and use our own constant names.
Otherwise, the results could be very confusing, especially if there are exceptions to this exception and we need the original system call number after all.
Thanks,
Florian
_______________________________________________
linux-snps-arc mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-snps-arc
Hi Florian,
Quoted 15 lines · Florian Weimer
* Vineet Gupta:
sysdeps/unix/sysv/linux/generic/sysdep.h line 45
Quoted 8 lines
sysdeps/unix/sysv/linux/generic/sysdep.h +8
-0+/* Override syscalls for asm-generic ABIs with 64-bit time. */ +#if __WORDSIZE ==32 && __TIMESIZE ==64 + +# undef __NR_futex +# define __NR_futex __NR_futex_time64 + +# undef __NR_rt_sigtimedwait +# define __NR_rt_sigtimedwait __NR_rt_sigtimedwait_time64I'm not totally unsympathetic to this in principle, but I think if we start messing more with the system call numbers in this way, we should move away from the
__NR_prefixes and use our own constant names.
Quoted 3 lines
Otherwise, the results could be very confusing, especially if there are exceptions to this exception and we need the original system call number after all.
OK I understand that redef could get messy. How about simple #undef of the 32-bit syscalls so they are not available in general and rely on generic code to fallback and DRT.
Do note that this is mostly a "preventive" fix (for single exception see below) and new arches will hopefully not trip here as they won't have the 32-bit syscalls to begin with. It is applicable to arches with slightly older version of the asm-generic ABI. And for same reasons I can even move those into ARC sysdep.h - what would you recommend.
FWIW the only relevant piece here is futex which generic lll code expects __NR_futex and we need to undef/redef to 64-bit variant (either here or in ARCH specific sysdep.h for RV32 and ARC) so having that part atleast in generic code will help future ports avoid the copy/paste.
Thx,
-Vineet
_______________________________________________
linux-snps-arc mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-snps-arc
PATCH v2 1/1 Force 64-bit time based syscalls for TIMESIZE==64
In reply to Florian Weimer---
Changes since v1
- don't redirect these to 64-bit variants
--- sysdeps/unix/sysv/linux/generic/sysdep.h | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+)
sysdeps/unix/sysv/linux/generic/sysdep.h +23 -0
@@ -17,6 +17,7 @@ <https://www.gnu.org/licenses/>. */#include <bits/wordsize.h> +#include <bits/timesize.h> #include <kernel-features.h> #include <sysdeps/unix/sysdep.h> #include <sysdeps/unix/sysv/linux/sysdep.h>
@@ -25,3 +26,25 @@#ifdef __NR_llseek# define __NR__llseek __NR_llseek#endif + +#if __WORDSIZE ==32 && __TIMESIZE ==64 + +/* Don't provide 32-bit time syscalls. +Older variants of asm-generic ABIs can provide those (e.g. ARC). */ + +# undef __NR_futex +# undef __NR_rt_sigtimedwait +# undef __NR_ppoll +# undef __NR_utimensat +# undef __NR_pselect6 +# undef __NR_recvmmsg +# undef __NR_semtimedop +# undef __NR_mq_timedreceive +# undef __NR_mq_timedsend +# undef __NR_clock_getres +# undef __NR_timerfd_settime +# undef __NR_timerfd_gettime +# undef __NR_sched_rr_get_interval +# undef __NR_clock_adjtime + +#endif
Signature · 7 lines
2.20.1 _______________________________________________ linux-snps-arc mailing list [email protected] http://lists.infradead.org/mailman/listinfo/linux-snps-arc
PATCH v3 1/1 Make any 32-bit time based syscalls unavailable for TIMESIZE==64
From: Vineet Gupta via Libc-alpha <[email protected]>
An older asm-generic syscall ABI may have kernel provide 32-bit time syscalls, so undef them to not mix 32/64 in 64-bit time regime.
---
Changes since v2
- Made x32 safe
Changes since v1
- don't redirect these to 64-bit variants
--- sysdeps/unix/sysv/linux/generic/sysdep.h | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+)
sysdeps/unix/sysv/linux/generic/sysdep.h +24 -0
@@ -17,6 +17,7 @@ <https://www.gnu.org/licenses/>. */#include <bits/wordsize.h> +#include <bits/timesize.h> #include <kernel-features.h> #include <sysdeps/unix/sysdep.h> #include <sysdeps/unix/sysv/linux/sysdep.h>
@@ -25,3 +26,26 @@#ifdef __NR_llseek# define __NR__llseek __NR_llseek#endif + +#if (__TIMESIZE ==64 && __WORDSIZE ==32 \ + && (!defined __SYSCALL_WORDSIZE || __SYSCALL_WORDSIZE ==32 )) + +/* Don't provide 32-bit time syscalls even if the kernel ABI provides +them (Older variants of asm-generic ABIs e.g. ARC). */ + +# undef __NR_futex +# undef __NR_rt_sigtimedwait +# undef __NR_ppoll +# undef __NR_utimensat +# undef __NR_pselect6 +# undef __NR_recvmmsg +# undef __NR_semtimedop +# undef __NR_mq_timedreceive +# undef __NR_mq_timedsend +# undef __NR_clock_getres +# undef __NR_timerfd_settime +# undef __NR_timerfd_gettime +# undef __NR_sched_rr_get_interval +# undef __NR_clock_adjtime + +#endif
Signature · 7 lines
2.20.1 _______________________________________________ linux-snps-arc mailing list [email protected] http://lists.infradead.org/mailman/listinfo/linux-snps-arc
Re: [PATCH v3] Make any 32-bit time based syscalls unavailable for TIMESIZE==64
Quoted 6 lines · Vineet Gupta via Libc-alpha
From: Vineet Gupta via Libc-alpha <[email protected]>
An older asm-generic syscall ABI may have kernel provide 32-bit time syscalls, so undef them to not mix 32/64 in 64-bit time regime.
Signed-off-by Vineet Gupta <[email protected]>
ping !
Quoted 40 lines
---
Changes since v2
- Made x32 safeChanges since v1
- don't redirect these to 64-bit variants--- sysdeps/unix/sysv/linux/generic/sysdep.h | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+)sysdeps/unix/sysv/linux/generic/sysdep.h +14
-0@@ -17,6 +17,7 @@ <https://www.gnu.org/licenses/>. */#include <bits/wordsize.h> +#include <bits/timesize.h> #include <kernel-features.h> #include <sysdeps/unix/sysdep.h> #include <sysdeps/unix/sysv/linux/sysdep.h> @@ -25,3 +26,26 @@#ifdef __NR_llseek# define __NR__llseek __NR_llseek#endif + +#if (__TIMESIZE ==64 && __WORDSIZE ==32 \ + && (!defined __SYSCALL_WORDSIZE || __SYSCALL_WORDSIZE ==32 )) + +/* Don't provide 32-bit time syscalls even if the kernel ABI provides +them (Older variants of asm-generic ABIs e.g. ARC). */ + +# undef __NR_futex +# undef __NR_rt_sigtimedwait +# undef __NR_ppoll +# undef __NR_utimensat +# undef __NR_pselect6 +# undef __NR_recvmmsg
sysdeps/unix/sysv/linux/generic/sysdep.h line 51
Quoted 10 lines
sysdeps/unix/sysv/linux/generic/sysdep.h +10
-0+# undef __NR_semtimedop +# undef __NR_mq_timedreceive +# undef __NR_mq_timedsend +# undef __NR_clock_getres +# undef __NR_timerfd_settime +# undef __NR_timerfd_gettime +# undef __NR_sched_rr_get_interval +# undef __NR_clock_adjtime + +#endif
_______________________________________________
linux-snps-arc mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-snps-arc
Re: [PATCH v3] Make any 32-bit time based syscalls unavailable for TIMESIZE==64
Quoted 9 lines · Vineet Gupta
Quoted 6 lines · Vineet Gupta via Libc-alpha
From: Vineet Gupta via Libc-alpha <[email protected]>
An older asm-generic syscall ABI may have kernel provide 32-bit time syscalls, so undef them to not mix 32/64 in 64-bit time regime.
Signed-off-by Vineet Gupta <[email protected]>ping !
ping ^2 !
Quoted 43 lines
Quoted 43 lines
---
Changes since v2
- Made x32 safeChanges since v1
- don't redirect these to 64-bit variants--- sysdeps/unix/sysv/linux/generic/sysdep.h | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+)sysdeps/unix/sysv/linux/generic/sysdep.h +17
-0@@ -17,6 +17,7 @@ <https://www.gnu.org/licenses/>. */#include <bits/wordsize.h> +#include <bits/timesize.h> #include <kernel-features.h> #include <sysdeps/unix/sysdep.h> #include <sysdeps/unix/sysv/linux/sysdep.h> @@ -25,3 +26,26 @@#ifdef __NR_llseek# define __NR__llseek __NR_llseek#endif + +#if (__TIMESIZE ==64 && __WORDSIZE ==32 \ + && (!defined __SYSCALL_WORDSIZE || __SYSCALL_WORDSIZE ==32 )) + +/* Don't provide 32-bit time syscalls even if the kernel ABI provides +them (Older variants of asm-generic ABIs e.g. ARC). */ + +# undef __NR_futex +# undef __NR_rt_sigtimedwait +# undef __NR_ppoll +# undef __NR_utimensat +# undef __NR_pselect6 +# undef __NR_recvmmsg +# undef __NR_semtimedop +# undef __NR_mq_timedreceive +# undef __NR_mq_timedsend
Quoted 8 lines
sysdeps/unix/sysv/linux/generic/sysdep.h line 51
Quoted 8 lines
sysdeps/unix/sysv/linux/generic/sysdep.h +7
-0+# undef __NR_clock_getres +# undef __NR_timerfd_settime +# undef __NR_timerfd_gettime +# undef __NR_sched_rr_get_interval +# undef __NR_clock_adjtime + +#endif
_______________________________________________
linux-snps-arc mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-snps-arc
Re: [PATCH v3] Make any 32-bit time based syscalls unavailable for TIMESIZE==64
Quoted 4 lines · Vineet Gupta via Libc-alpha
Quoted 3 lines · Vineet Gupta
Quoted 2 lines · Vineet Gupta via Libc-alpha
From: Vineet Gupta via Libc-alpha <[email protected]>
Quoted 8 lines
Quoted 6 lines
Quoted 4 lines
An older asm-generic syscall ABI may have kernel provide 32-bit time syscalls, so undef them to not mix 32/64 in 64-bit time regime.
Signed-off-by Vineet Gupta <[email protected]>ping !
ping ^2 !
If this is not suitable for common code, I'd still like to add this as part of ARC port to safe guard against future snafus.
Quoted 42 lines
Quoted 42 lines
Quoted 42 lines
---
Changes since v2
- Made x32 safeChanges since v1
- don't redirect these to 64-bit variants--- sysdeps/unix/sysv/linux/generic/sysdep.h | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+)sysdeps/unix/sysv/linux/generic/sysdep.h +17
-0@@ -17,6 +17,7 @@ <https://www.gnu.org/licenses/>. */#include <bits/wordsize.h> +#include <bits/timesize.h> #include <kernel-features.h> #include <sysdeps/unix/sysdep.h> #include <sysdeps/unix/sysv/linux/sysdep.h> @@ -25,3 +26,26 @@#ifdef __NR_llseek# define __NR__llseek __NR_llseek#endif + +#if (__TIMESIZE ==64 && __WORDSIZE ==32 \ + && (!defined __SYSCALL_WORDSIZE || __SYSCALL_WORDSIZE ==32 )) + +/* Don't provide 32-bit time syscalls even if the kernel ABI provides +them (Older variants of asm-generic ABIs e.g. ARC). */ + +# undef __NR_futex +# undef __NR_rt_sigtimedwait +# undef __NR_ppoll +# undef __NR_utimensat +# undef __NR_pselect6 +# undef __NR_recvmmsg +# undef __NR_semtimedop +# undef __NR_mq_timedreceive +# undef __NR_mq_timedsend
Quoted 9 lines
Quoted 8 lines
sysdeps/unix/sysv/linux/generic/sysdep.h line 51
Quoted 8 lines
sysdeps/unix/sysv/linux/generic/sysdep.h +7
-0+# undef __NR_clock_getres +# undef __NR_timerfd_settime +# undef __NR_timerfd_gettime +# undef __NR_sched_rr_get_interval +# undef __NR_clock_adjtime + +#endif
_______________________________________________
linux-snps-arc mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-snps-arc
Re: [PATCH v3] Make any 32-bit time based syscalls unavailable for TIMESIZE==64
* Vineet Gupta via Libc-alpha:
Quoted 8 lines · Vineet Gupta via Libc-alpha
Quoted 7 lines · Vineet Gupta
Quoted 6 lines · Vineet Gupta via Libc-alpha
Quoted 5 lines
From: Vineet Gupta via Libc-alpha <[email protected]>
An older asm-generic syscall ABI may have kernel provide 32-bit time syscalls, so undef them to not mix 32/64 in 64-bit time regime.
Quoted 8 lines
Quoted 5 lines
Quoted 3 lines
Quoted 1 line
Signed-off-by Vineet Gupta <[email protected]>ping !
ping ^2 !
If this is not suitable for common code, I'd still like to add this as part of ARC port to safe guard against future snafus.
Have you tried to add the #undefs to fixup-asm-unistd.h? See sysdeps/unix/sysv/linux/arm/fixup-asm-unistd.h for an example.
I have not tried if #undefs work there, but they should. If not, we can fix that.
_______________________________________________
linux-snps-arc mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-snps-arc
Re: [PATCH v3] Make any 32-bit time based syscalls unavailable for TIMESIZE==64
Quoted 11 lines · Florian Weimer
* Vineet Gupta via Libc-alpha:
Quoted 3 lines
If this is not suitable for common code, I'd still like to add this as part of ARC port to safe guard against future snafus.
Have you tried to add the #undefs to
fixup-asm-unistd.h? Seesysdeps/unix/sysv/linux/arm/fixup-asm-unistd.hfor an example.I have not tried if #undefs work there, but they should. If not, we can fix that.
undef works great in arc/fixup-asm-unistd.h
Thx for the hint !
-Vineet
_______________________________________________
linux-snps-arc mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-snps-arc