From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 11553 invoked by alias); 19 Apr 2017 21:01:49 -0000 Mailing-List: contact libc-alpha-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: libc-alpha-owner@sourceware.org Received: (qmail 11122 invoked by uid 89); 19 Apr 2017 21:01:48 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-2.1 required=5.0 tests=AWL,BAYES_00,RCVD_IN_DNSWL_NONE,RCVD_IN_SORBS_SPAM,SPF_PASS autolearn=no version=3.3.2 spammy=progbits, note.GNU-stack, noteGNUstack, note.gnu-stack X-HELO: mail-qk0-f169.google.com X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:to:references:cc:from:message-id:date :user-agent:mime-version:in-reply-to:content-transfer-encoding; bh=IsMHdIpEcPaZkb62Lz2HEulOjPIAsCSCWCdpflwgK3Q=; b=h4RDNqqylrVzlTrXC2K01z/Ap33NzDNK2SQFlP+Y9yQnuNKWzkocYUxfE2AIEAOcU1 mK44ZVXMP/Y3e9rn+TjqJoO7tBY6VlDmkep5WBclX5EtZv1VW8PnpLdLrKgEVyA8BzrI 1hYqMK3hwnC1bqer+4YZwhmBGOwccYpSyD314ESHC40ShCk+9KazUZNVm1wF+mSDT7tY O/zZwRERDoEK2dsZ6dES7cK/Ww8nWWaa7aWgHsbh+jqLyOLAcHIw6WhjX43ntx1i2FCM L0nO7/QX3hARgtMB/Bnff+mmO2RVkPlEvAz13iRh7CDMbqlM3P/4IMLTYcg/cMP6qoDb OB6w== X-Gm-Message-State: AN3rC/4ksPSJE8zrjFJa/ucRfd5NG8EtpfGIvdROMiAAQYm+3tDrU9vv 6We2ESAOH+axtvnw X-Received: by 10.55.157.3 with SMTP id g3mr4424617qke.30.1492635706266; Wed, 19 Apr 2017 14:01:46 -0700 (PDT) Subject: Re: [PATCH 1/2] Build divdi3 only for architecture that required it To: Joseph Myers References: <1489671790-7611-1-git-send-email-adhemerval.zanella@linaro.org> <5067790e-50b6-d2c1-4466-26d79fc23166@linaro.org> Cc: GNU C Library From: Adhemerval Zanella Message-ID: <0ef59b2d-8f19-8646-a773-565dd14704f4@linaro.org> Date: Wed, 19 Apr 2017 21:01:00 -0000 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.8.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=windows-1252 Content-Transfer-Encoding: 8bit X-SW-Source: 2017-04/txt/msg00397.txt.bz2 On 18/04/2017 18:21, Joseph Myers wrote: > I think these changes caused elf/check-execstack to fail for > sparcv9-linux-gnu. > > https://sourceware.org/ml/libc-testresults/2017-q2/msg00015.html (before > the change, passes) > > https://sourceware.org/ml/libc-testresults/2017-q2/msg00018.html (after > the change, shows the regression, no other changes in glibc). > > /scratch/jmyers/glibc-bot/build/glibcs/sparcv9-linux-gnu/glibc/elf/ld.so.phdr: *** executable stack signaled > I think the problem is with generated sparc toolchain from build-many-glibcs.py the minimum supported sparc32 version is pre-v9 and it requires a software implementation of '.udiv'. Since now we are using libgcc.a one instead, it must have the '.note.GNU-stack' so linker can properly set the stack non executable. >From a build using a toolchain from build-many-glibcs.py: elf/librtld.os.map [...] /opt/cross/sparc64-linux-gnu/bin/../lib/gcc/sparc64-glibc-linux-gnu/6.2.1/32/libgcc.a(_divsi3.o) /opt/cross/sparc64-linux-gnu/bin/../lib/gcc/sparc64-glibc-linux-gnu/6.2.1/32/libgcc.a(_udivdi3.o) (.udiv) /opt/cross/sparc64-linux-gnu/bin/../lib/gcc/sparc64-glibc-linux-gnu/6.2.1/32/libgcc.a(_clz.o) /opt/cross/sparc64-linux-gnu/bin/../lib/gcc/sparc64-glibc-linux-gnu/6.2.1/32/libgcc.a(_udivdi3.o) (__clz_tab) [...] And dumping _udivdi3.o section headers: [Nr] Name Type Addr Off Size ES Flg Lk Inf Al [ 0] NULL 00000000 000000 000000 00 0 0 0 [ 1] .text PROGBITS 00000000 000034 0002b0 00 AX 0 0 4 [ 2] .data PROGBITS 00000000 0002e4 000000 00 WA 0 0 1 [ 3] .bss NOBITS 00000000 0002e4 000000 00 WA 0 0 1 [ 4] .debug_line PROGBITS 00000000 0002e4 00010d 00 0 0 1 [ 5] .rela.debug_line RELA 00000000 0007c0 00000c 0c I 12 4 4 [ 6] .debug_info PROGBITS 00000000 0003f1 0000ab 00 0 0 1 [ 7] .rela.debug_info RELA 00000000 0007cc 000030 0c I 12 6 4 [ 8] .debug_abbrev PROGBITS 00000000 00049c 000014 00 0 0 1 [ 9] .debug_aranges PROGBITS 00000000 0004b0 000020 00 0 0 8 [10] .rela.debug_arang RELA 00000000 0007fc 000018 0c I 12 9 4 [11] .shstrtab STRTAB 00000000 000814 000070 00 0 0 1 [12] .symtab SYMTAB 00000000 0004d0 000220 10 13 32 4 [13] .strtab STRTAB 00000000 0006f0 0000cf 00 0 0 1 I am not seeing this on a native gcc build which I configured with: ' --with-arch-directory=sparc64 --enable-multiarch --enable-targets=all --with-cpu-32=ultrasparc --with-long-double-128 --enable-multilib' Both libgcc's __udivdi3 and __umoddi3 do not pull .udiv since for this libgcc build both are using hardware instructions: elf/librtld.os.map /home/azanella/gcc/install/lib/gcc/sparc64-linux-gnu/6.3.1/32/libgcc.a(_udivdi3.o) /home/azanella/glibc/glibc-git-build-sparcv9/elf/dl-allobjs.os (__udivdi3) /home/azanella/gcc/install/lib/gcc/sparc64-linux-gnu/6.3.1/32/libgcc.a(_umoddi3.o) /home/azanella/glibc/glibc-git-build-sparcv9/elf/dl-allobjs.os (__umoddi3) Now to actually fix it I can think of two possible solutions: 1. Add divdi3 build on sparc32 as before the patch. 2. Enforce -Wl,-noexecstack on ld.so build. I would prefer 2. since we already expect loader to have a non-executable stack and gentoo wiki [1] all current architectures with supported gcc/binutils version should support the linker option. [1] https://wiki.gentoo.org/wiki/Hardened/GNU_stack_quickstart