Message ID | 20200331214717.23902-1-vgupta@synopsys.com |
---|---|
State | Dropped |
Headers |
Return-Path: <Vineet.Gupta1@synopsys.com> X-Original-To: libc-alpha@sourceware.org Delivered-To: libc-alpha@sourceware.org Received: from smtprelay-out1.synopsys.com (smtprelay-out1.synopsys.com [149.117.87.133]) by sourceware.org (Postfix) with ESMTPS id 5C83A385BF83 for <libc-alpha@sourceware.org>; Tue, 31 Mar 2020 21:47:29 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org 5C83A385BF83 Received: from mailhost.synopsys.com (sv2-mailhost2.synopsys.com [10.205.2.134]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) (No client certificate requested) by smtprelay-out1.synopsys.com (Postfix) with ESMTPS id 6E2F2C0F3B; Tue, 31 Mar 2020 21:47:28 +0000 (UTC) Received: from vineetg-Latitude-7400.internal.synopsys.com (unknown [10.13.183.89]) by mailhost.synopsys.com (Postfix) with ESMTP id ECCF0A007B; Tue, 31 Mar 2020 21:47:20 +0000 (UTC) From: Vineet Gupta <Vineet.Gupta1@synopsys.com> To: libc-alpha@sourceware.org Cc: linux-snps-arc@lists.infradead.org, Stepan Golosunov <stepan@golosunov.pp.ru>, Alistair Francis <alistair.francis@wdc.com>, Vineet Gupta <Vineet.Gupta1@synopsys.com> Subject: [PATCH v3] Make any 32-bit time based syscalls unavailable for TIMESIZE==64 Date: Tue, 31 Mar 2020 14:47:17 -0700 Message-Id: <20200331214717.23902-1-vgupta@synopsys.com> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20200312183325.594-1-vgupta@synopsys.com> References: <20200312183325.594-1-vgupta@synopsys.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-20.8 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, GIT_PATCH_1, GIT_PATCH_2, GIT_PATCH_3, KAM_NUMSUBJECT, KAM_SHORT, SPF_HELO_NONE, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.2 X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on server2.sourceware.org X-BeenThere: libc-alpha@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Libc-alpha mailing list <libc-alpha.sourceware.org> List-Unsubscribe: <http://sourceware.org/mailman/options/libc-alpha>, <mailto:libc-alpha-request@sourceware.org?subject=unsubscribe> List-Archive: <http://sourceware.org/pipermail/libc-alpha/> List-Post: <mailto:libc-alpha@sourceware.org> List-Help: <mailto:libc-alpha-request@sourceware.org?subject=help> List-Subscribe: <http://sourceware.org/mailman/listinfo/libc-alpha>, <mailto:libc-alpha-request@sourceware.org?subject=subscribe> X-List-Received-Date: Tue, 31 Mar 2020 21:47:31 -0000 |
Series |
[v3] Make any 32-bit time based syscalls unavailable for TIMESIZE==64
|
|
Commit Message
Vineet Gupta
March 31, 2020, 9:47 p.m. UTC
From: Vineet Gupta via Libc-alpha <libc-alpha@sourceware.org> 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 <vgupta@synopsys.com> --- 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(+)
Comments
On 3/31/20 2:47 PM, Vineet Gupta via Libc-alpha wrote: > From: Vineet Gupta via Libc-alpha <libc-alpha@sourceware.org> > > 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 <vgupta@synopsys.com> ping ! > --- > 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(+) > > diff --git a/sysdeps/unix/sysv/linux/generic/sysdep.h b/sysdeps/unix/sysv/linux/generic/sysdep.h > index 40b4b955ca1b..b83e17e1c9d1 100644 > --- a/sysdeps/unix/sysv/linux/generic/sysdep.h > +++ b/sysdeps/unix/sysv/linux/generic/sysdep.h > @@ -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 >
On 4/6/20 11:54 AM, Vineet Gupta wrote: > On 3/31/20 2:47 PM, Vineet Gupta via Libc-alpha wrote: >> From: Vineet Gupta via Libc-alpha <libc-alpha@sourceware.org> >> >> 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 <vgupta@synopsys.com> > > ping ! ping ^2 ! > >> --- >> 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(+) >> >> diff --git a/sysdeps/unix/sysv/linux/generic/sysdep.h b/sysdeps/unix/sysv/linux/generic/sysdep.h >> index 40b4b955ca1b..b83e17e1c9d1 100644 >> --- a/sysdeps/unix/sysv/linux/generic/sysdep.h >> +++ b/sysdeps/unix/sysv/linux/generic/sysdep.h >> @@ -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 >>
On 4/13/20 2:12 PM, Vineet Gupta via Libc-alpha wrote: > On 4/6/20 11:54 AM, Vineet Gupta wrote: >> On 3/31/20 2:47 PM, Vineet Gupta via Libc-alpha wrote: >>> From: Vineet Gupta via Libc-alpha <libc-alpha@sourceware.org> >>> >>> 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 <vgupta@synopsys.com> >> >> 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. >>> --- >>> 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(+) >>> >>> diff --git a/sysdeps/unix/sysv/linux/generic/sysdep.h b/sysdeps/unix/sysv/linux/generic/sysdep.h >>> index 40b4b955ca1b..b83e17e1c9d1 100644 >>> --- a/sysdeps/unix/sysv/linux/generic/sysdep.h >>> +++ b/sysdeps/unix/sysv/linux/generic/sysdep.h >>> @@ -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 >>> >
* Vineet Gupta via Libc-alpha: > On 4/13/20 2:12 PM, Vineet Gupta via Libc-alpha wrote: >> On 4/6/20 11:54 AM, Vineet Gupta wrote: >>> On 3/31/20 2:47 PM, Vineet Gupta via Libc-alpha wrote: >>>> From: Vineet Gupta via Libc-alpha <libc-alpha@sourceware.org> >>>> >>>> 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 <vgupta@synopsys.com> >>> >>> 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.
diff --git a/sysdeps/unix/sysv/linux/generic/sysdep.h b/sysdeps/unix/sysv/linux/generic/sysdep.h index 40b4b955ca1b..b83e17e1c9d1 100644 --- a/sysdeps/unix/sysv/linux/generic/sysdep.h +++ b/sysdeps/unix/sysv/linux/generic/sysdep.h @@ -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