From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 19634 invoked by alias); 30 Dec 2014 22:48:30 -0000 Mailing-List: contact gcc-patches-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-patches-owner@gcc.gnu.org Received: (qmail 19616 invoked by uid 89); 30 Dec 2014 22:48:26 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-2.4 required=5.0 tests=AWL,BAYES_00,FREEMAIL_FROM,RCVD_IN_DNSWL_LOW,SPF_PASS autolearn=ham version=3.3.2 X-HELO: mail-lb0-f175.google.com Received: from mail-lb0-f175.google.com (HELO mail-lb0-f175.google.com) (209.85.217.175) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES128-SHA encrypted) ESMTPS; Tue, 30 Dec 2014 22:48:24 +0000 Received: by mail-lb0-f175.google.com with SMTP id z11so4834984lbi.6 for ; Tue, 30 Dec 2014 14:48:21 -0800 (PST) MIME-Version: 1.0 X-Received: by 10.152.4.233 with SMTP id n9mr64574465lan.61.1419979701486; Tue, 30 Dec 2014 14:48:21 -0800 (PST) Received: by 10.25.21.9 with HTTP; Tue, 30 Dec 2014 14:48:21 -0800 (PST) In-Reply-To: <293A3D50-94B4-4F51-BF6F-B28DF0E31BDF@gmail.com> References: <20141113091614.GB5026@tucnak.redhat.com> <71E9E6B2-2D35-4F25-997A-086EC1005423@gmail.com> <20141229184641.GP1667@tucnak.redhat.com> <293A3D50-94B4-4F51-BF6F-B28DF0E31BDF@gmail.com> Date: Tue, 30 Dec 2014 22:49:00 -0000 Message-ID: Subject: Re: libsanitizer merge from upstream r221802 From: Andrew Pinski To: David Abdurachmanov Cc: Jakub Jelinek , Dmitry Vyukov , Konstantin Serebryany , GCC Patches , Dodji Seketeli , Marek Polacek , "H.J. Lu" , Yuri Gribov , Alexey Samsonov Content-Type: text/plain; charset=UTF-8 X-IsSubscribed: yes X-SW-Source: 2014-12/txt/msg01974.txt.bz2 On Tue, Dec 30, 2014 at 2:39 PM, David Abdurachmanov wrote: > > On Dec 29, 2014, at 7:46 PM, Jakub Jelinek wrote: > >> On Mon, Dec 29, 2014 at 07:36:42PM +0100, David Abdurachmanov wrote: >>> I believe this is breaking bootstrap on aarch64-linux-gnu with kernels <=3.15, >>> 3.16 and above are fine. >>> >>> __kernel_old_{gid,uid}_t were changed in 3.16 from unsigned int to unsigned >>> short. <=3.15 kernel will trigger static asserts in libsanitizer while >>> compiling GCC. >>> >>> I created PR: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=64435 (includes all >>> the details). >>> >>> Attaching a patch with resolved issues on F19 + 3.12 kernel (also bootstrapped >>> in QEMU with F21 rootfs + 3.17 kernel) on aarch64-linux-gnu. >> >> That looks very much wrong, ABI can't depend on what kernel headers you are >> compiling against. >> So, better would be just to ifdef out the check and always use 16-bit >> __kernel_old_*_t on aarch64. Are the >> getresuid16/getresgid16/getgroups16/setgroups16 syscalls wired at all on >> aarch64? If not, then supposedly the sanitizer_common_syscalls.inc stuff >> for these syscalls should be ifdefed out on aarch64 (or any other arch that >> doesn't have those syscalls). > > I am not an expert here. > > # uname -r -m > 3.17.0-301.fc21.aarch64 aarch64 > > # cat /proc/kallsyms | sed -n 's/.* sys_//p' | grep 16 > chown16 > fchown16 > getegid16 > geteuid16 > getgid16 > getgroups16 > getresgid16 > getresuid16 > getuid16 > lchown16 > setfsgid16 > setfsuid16 > setgid16 > setgroups16 > setregid16 > setresgid16 > setresuid16 > setreuid16 > setuid16 > > The following are syscall implementations available in my current kernel with > "16" suffix. > > From include/uapi/asm-generic/unistd.h > > 435 #define __NR_getresuid 148 > 436 __SYSCALL(__NR_getresuid, sys_getresuid) > > From arch/arm64/include/asm/unistd32.h > > 354 #define __NR_getresuid 165 > 355 __SYSCALL(__NR_getresuid, sys_getresuid16) > > Isn't this needed for 32-bit (compat) application support on 64-bit system? > > https://lkml.org/lkml/2012/7/6/570 > https://lkml.org/lkml/2012/7/6/545 > > If we have 64-bit kernel and 64-bit application is executed sys_getresuid is > used for getresuid syscall, otherwise if 32-bit application is executed -- > sys_getresuid16 is used. Thus 64-bit application will never call > sys_getresuid16 implemenation. Then > getresuid16/getresgid16/getgroups16/setgroups16/etc only needs to in 32-bit > binary of libsanitizer. Same should apply for x86_64/i*86. > > Is that correct? Kinda. It only applies for aarch32 and not for AARCH64:ILP32. AARCH64:ILP32 uses the standard system calls here too. Thanks, Andrew Pinski > > david