From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755979AbcHCEy6 (ORCPT ); Wed, 3 Aug 2016 00:54:58 -0400 Received: from ozlabs.org ([103.22.144.67]:47869 "EHLO ozlabs.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754258AbcHCEyu (ORCPT ); Wed, 3 Aug 2016 00:54:50 -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> <87eg67ooe5.fsf@concordia.ellerman.id.au> User-Agent: Notmuch/0.21 (https://notmuchmail.org) Date: Wed, 03 Aug 2016 14:46:49 +1000 Message-ID: <87lh0elarq.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 8:12 PM, Michael Ellerman wrote: >> Kees Cook writes: >>> On Mon, Aug 1, 2016 at 5:37 AM, Michael Ellerman wrote: >>>> >>>> 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. ... >> Interestingly I *can't* reproduce with the Ubuntu x86->ppc cross >> (5.4.0-6ubuntu1~16.04.1). > > Oh, weird. Well, that does explains my lack of hitting the problem, > though: that's the cross compiler I was using. :P Actually that was a false negative. The trick is you have to have LKDTM=y *and* FUNCTION_TRACER=y. It is a linker bug: https://sourceware.org/bugzilla/show_bug.cgi?id=20428 Which Alan has already fixed. But we need to workaround existing linkers that are out there. We can do that by marking lkdtm_rodata_do_nothing() notrace, which I think makes sense for all arches actually. So I'll send you a patch to do that. cheers