From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1756065AbcHBDM5 (ORCPT ); Mon, 1 Aug 2016 23:12:57 -0400 Received: from ozlabs.org ([103.22.144.67]:55649 "EHLO ozlabs.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1756005AbcHBDMU (ORCPT ); Mon, 1 Aug 2016 23:12:20 -0400 From: Michael Ellerman To: Kees Cook Cc: "kernel-hardening\@lists.openwall.com" , Arnd Bergmann , Greg Kroah-Hartman , Andrew Morton , "David S. Miller" , Mauro Carvalho Chehab , Jiri Slaby , Guenter Roeck , LKML , "linuxppc-dev\@lists.ozlabs.org" , Anton Blanchard , Alan Modra Subject: Re: [kernel-hardening] Re: Linker segfault on powerpc when CONFIG_LKDTM=y (was Re: [kernel-hardening] [PATCH 3/5] lkdtm: add function for testing .rodata section) In-Reply-To: References: <1465336628-18219-1-git-send-email-keescook@chromium.org> <1465336628-18219-4-git-send-email-keescook@chromium.org> <87h9b4oebf.fsf@concordia.ellerman.id.au> User-Agent: Notmuch/0.21 (https://notmuchmail.org) Date: Tue, 02 Aug 2016 13:12:02 +1000 Message-ID: <87eg67ooe5.fsf@concordia.ellerman.id.au> MIME-Version: 1.0 Content-Type: text/plain Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Kees Cook writes: > On Mon, Aug 1, 2016 at 5:37 AM, Michael Ellerman wrote: >> Kees Cook writes: >> >>> This adds a function that lives in the .rodata section. The section >>> flags are corrected using objcopy since there is no way with gcc to >>> declare section flags in an architecture-agnostic way. >>> >>> Signed-off-by: Kees Cook >>> --- >>> drivers/misc/Makefile | 7 +++++++ >>> drivers/misc/lkdtm.h | 6 ++++++ >>> drivers/misc/lkdtm_core.c | 24 +++++++++++++++++------- >>> drivers/misc/lkdtm_rodata.c | 10 ++++++++++ >>> 4 files changed, 40 insertions(+), 7 deletions(-) >>> create mode 100644 drivers/misc/lkdtm.h >>> create mode 100644 drivers/misc/lkdtm_rodata.c >> >> This is blowing up my linker :( >> >> scripts/link-vmlinux.sh: line 52: 36260 Segmentation fault (core dumped) ${LD} ${LDFLAGS} ${LDFLAGS_vmlinux} -o ${2} -T ${lds} ${KBUILD_VMLINUX_INIT} --start-group ${KBUILD_VMLINUX_MAIN} --end-group ${1} >> >> Haven't had a chance to debug it further. > > Argh. Do you want a quick fix for this now? I can add a PPC CONFIG > blacklist for the rodata check, maybe? Nah that's OK, none of our defconfigs have it enabled so it's not a real blocker. It also builds OK as a module - though I haven't tested the result yet. > Also, what version of gcc? I'll see if I can reproduce this with a > cross compiler... The original hit was with gcc-5.3 (which is actually a x86->ppc cross): http://kisskb.ellerman.id.au/kisskb/buildresult/12762730/ But I can also reproduce with 5.4, and 6.1.0. Interestingly I *can't* reproduce with the Ubuntu x86->ppc cross (5.4.0-6ubuntu1~16.04.1). Those toolchains are all using binutils 2.26 AFAIK. Going back to a really old toolchain (gcc 4.6.3/binutils 2.22) it does build but I get these warnings: powerpc64-linux-ld: drivers/misc/built-in.o: .opd is not a regular array of opd entries powerpc64-linux-ld: drivers/built-in.o: .opd is not a regular array of opd entries powerpc64-linux-ld: drivers/built-in.o: .opd is not a regular array of opd entries powerpc64-linux-ld: drivers/built-in.o: .opd is not a regular array of opd entries powerpc64-linux-ld: drivers/built-in.o: .opd is not a regular array of opd entries So probably don't worry about it and we'll try and work it out on our end. cheers From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from ozlabs.org (ozlabs.org [103.22.144.67]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by lists.ozlabs.org (Postfix) with ESMTPS id 3s3Lpc04YnzDqdt for ; Tue, 2 Aug 2016 13:12:08 +1000 (AEST) From: Michael Ellerman To: Kees Cook Cc: "kernel-hardening\@lists.openwall.com" , Arnd Bergmann , Greg Kroah-Hartman , Andrew Morton , "David S. Miller" , Mauro Carvalho Chehab , Jiri Slaby , Guenter Roeck , LKML , "linuxppc-dev\@lists.ozlabs.org" , Anton Blanchard , Alan Modra Subject: Re: [kernel-hardening] Re: Linker segfault on powerpc when CONFIG_LKDTM=y (was Re: [kernel-hardening] [PATCH 3/5] lkdtm: add function for testing .rodata section) In-Reply-To: References: <1465336628-18219-1-git-send-email-keescook@chromium.org> <1465336628-18219-4-git-send-email-keescook@chromium.org> <87h9b4oebf.fsf@concordia.ellerman.id.au> Date: Tue, 02 Aug 2016 13:12:02 +1000 Message-ID: <87eg67ooe5.fsf@concordia.ellerman.id.au> MIME-Version: 1.0 Content-Type: text/plain List-Id: Linux on PowerPC Developers Mail List List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Kees Cook writes: > On Mon, Aug 1, 2016 at 5:37 AM, Michael Ellerman wrote: >> Kees Cook writes: >> >>> This adds a function that lives in the .rodata section. The section >>> flags are corrected using objcopy since there is no way with gcc to >>> declare section flags in an architecture-agnostic way. >>> >>> Signed-off-by: Kees Cook >>> --- >>> drivers/misc/Makefile | 7 +++++++ >>> drivers/misc/lkdtm.h | 6 ++++++ >>> drivers/misc/lkdtm_core.c | 24 +++++++++++++++++------- >>> drivers/misc/lkdtm_rodata.c | 10 ++++++++++ >>> 4 files changed, 40 insertions(+), 7 deletions(-) >>> create mode 100644 drivers/misc/lkdtm.h >>> create mode 100644 drivers/misc/lkdtm_rodata.c >> >> This is blowing up my linker :( >> >> scripts/link-vmlinux.sh: line 52: 36260 Segmentation fault (core dumped) ${LD} ${LDFLAGS} ${LDFLAGS_vmlinux} -o ${2} -T ${lds} ${KBUILD_VMLINUX_INIT} --start-group ${KBUILD_VMLINUX_MAIN} --end-group ${1} >> >> Haven't had a chance to debug it further. > > Argh. Do you want a quick fix for this now? I can add a PPC CONFIG > blacklist for the rodata check, maybe? Nah that's OK, none of our defconfigs have it enabled so it's not a real blocker. It also builds OK as a module - though I haven't tested the result yet. > Also, what version of gcc? I'll see if I can reproduce this with a > cross compiler... The original hit was with gcc-5.3 (which is actually a x86->ppc cross): http://kisskb.ellerman.id.au/kisskb/buildresult/12762730/ But I can also reproduce with 5.4, and 6.1.0. Interestingly I *can't* reproduce with the Ubuntu x86->ppc cross (5.4.0-6ubuntu1~16.04.1). Those toolchains are all using binutils 2.26 AFAIK. Going back to a really old toolchain (gcc 4.6.3/binutils 2.22) it does build but I get these warnings: powerpc64-linux-ld: drivers/misc/built-in.o: .opd is not a regular array of opd entries powerpc64-linux-ld: drivers/built-in.o: .opd is not a regular array of opd entries powerpc64-linux-ld: drivers/built-in.o: .opd is not a regular array of opd entries powerpc64-linux-ld: drivers/built-in.o: .opd is not a regular array of opd entries powerpc64-linux-ld: drivers/built-in.o: .opd is not a regular array of opd entries So probably don't worry about it and we'll try and work it out on our end. cheers From mboxrd@z Thu Jan 1 00:00:00 1970 Reply-To: kernel-hardening@lists.openwall.com From: Michael Ellerman In-Reply-To: References: <1465336628-18219-1-git-send-email-keescook@chromium.org> <1465336628-18219-4-git-send-email-keescook@chromium.org> <87h9b4oebf.fsf@concordia.ellerman.id.au> Date: Tue, 02 Aug 2016 13:12:02 +1000 Message-ID: <87eg67ooe5.fsf@concordia.ellerman.id.au> MIME-Version: 1.0 Content-Type: text/plain Subject: Re: [kernel-hardening] Re: Linker segfault on powerpc when CONFIG_LKDTM=y (was Re: [kernel-hardening] [PATCH 3/5] lkdtm: add function for testing .rodata section) To: Kees Cook Cc: "kernel-hardening@lists.openwall.com" , Arnd Bergmann , Greg Kroah-Hartman , Andrew Morton , "David S. Miller" , Mauro Carvalho Chehab , Jiri Slaby , Guenter Roeck , LKML , "linuxppc-dev@lists.ozlabs.org" , Anton Blanchard , Alan Modra List-ID: Kees Cook writes: > On Mon, Aug 1, 2016 at 5:37 AM, Michael Ellerman wrote: >> Kees Cook writes: >> >>> This adds a function that lives in the .rodata section. The section >>> flags are corrected using objcopy since there is no way with gcc to >>> declare section flags in an architecture-agnostic way. >>> >>> Signed-off-by: Kees Cook >>> --- >>> drivers/misc/Makefile | 7 +++++++ >>> drivers/misc/lkdtm.h | 6 ++++++ >>> drivers/misc/lkdtm_core.c | 24 +++++++++++++++++------- >>> drivers/misc/lkdtm_rodata.c | 10 ++++++++++ >>> 4 files changed, 40 insertions(+), 7 deletions(-) >>> create mode 100644 drivers/misc/lkdtm.h >>> create mode 100644 drivers/misc/lkdtm_rodata.c >> >> This is blowing up my linker :( >> >> scripts/link-vmlinux.sh: line 52: 36260 Segmentation fault (core dumped) ${LD} ${LDFLAGS} ${LDFLAGS_vmlinux} -o ${2} -T ${lds} ${KBUILD_VMLINUX_INIT} --start-group ${KBUILD_VMLINUX_MAIN} --end-group ${1} >> >> Haven't had a chance to debug it further. > > Argh. Do you want a quick fix for this now? I can add a PPC CONFIG > blacklist for the rodata check, maybe? Nah that's OK, none of our defconfigs have it enabled so it's not a real blocker. It also builds OK as a module - though I haven't tested the result yet. > Also, what version of gcc? I'll see if I can reproduce this with a > cross compiler... The original hit was with gcc-5.3 (which is actually a x86->ppc cross): http://kisskb.ellerman.id.au/kisskb/buildresult/12762730/ But I can also reproduce with 5.4, and 6.1.0. Interestingly I *can't* reproduce with the Ubuntu x86->ppc cross (5.4.0-6ubuntu1~16.04.1). Those toolchains are all using binutils 2.26 AFAIK. Going back to a really old toolchain (gcc 4.6.3/binutils 2.22) it does build but I get these warnings: powerpc64-linux-ld: drivers/misc/built-in.o: .opd is not a regular array of opd entries powerpc64-linux-ld: drivers/built-in.o: .opd is not a regular array of opd entries powerpc64-linux-ld: drivers/built-in.o: .opd is not a regular array of opd entries powerpc64-linux-ld: drivers/built-in.o: .opd is not a regular array of opd entries powerpc64-linux-ld: drivers/built-in.o: .opd is not a regular array of opd entries So probably don't worry about it and we'll try and work it out on our end. cheers