Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S933041AbbDODdD (ORCPT ); Tue, 14 Apr 2015 23:33:03 -0400 Received: from ozlabs.org ([103.22.144.67]:33244 "EHLO ozlabs.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932597AbbDODcs (ORCPT ); Tue, 14 Apr 2015 23:32:48 -0400 From: Rusty Russell To: Quentin Casasnovas , Thierry Reding Cc: Quentin Casasnovas , lkml , Oleg Nesterov , Borislav Petkov , Linus Torvalds Subject: Re: [PATCH 7/7] modpost: handle relocations mismatch in __ex_table. In-Reply-To: <20150414123516.GB2925@chrystal.uk.oracle.com> References: <1426596002-26128-1-git-send-email-quentin.casasnovas@oracle.com> <1426596002-26128-8-git-send-email-quentin.casasnovas@oracle.com> <20150414121405.GA30442@ulmo.nvidia.com> <20150414123516.GB2925@chrystal.uk.oracle.com> User-Agent: Notmuch/0.17 (http://notmuchmail.org) Emacs/24.3.1 (x86_64-pc-linux-gnu) Date: Wed, 15 Apr 2015 12:57:37 +0930 Message-ID: <87egnmrryu.fsf@rustcorp.com.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 Content-Length: 2795 Lines: 63 Quentin Casasnovas writes: > On Tue, Apr 14, 2015 at 02:14:14PM +0200, Thierry Reding wrote: >> On Tue, Mar 17, 2015 at 01:40:02PM +0100, Quentin Casasnovas wrote: >> > If one of these addresses point to a non-executable section, something is >> > seriously wrong since it either means the kernel will never fault from >> > there or it will not be able to jump to there. As both cases are serious >> > enough, we simply error out in these cases so the build fails and the >> > developper has to fix the issue. >> > >> > Signed-off-by: Quentin Casasnovas >> > --- >> > scripts/mod/modpost.c | 141 ++++++++++++++++++++++++++++++++++++++++++++++++++ >> > 1 file changed, 141 insertions(+) >> >> This causes a bunch of mismatch warnings on 32-bit and 64-bit ARM >> because there are two additional sections, .text.fixup and >> .exception.text that store executable code. I've attached a patch >> to fix those, but feel free to squash that into the original commit >> if that's still possible. >> > > Thanks Thierry! > > Your patch looks good to me, though I was wondering if we should just add > .text.* in the TEXT_SECTIONS macro. Some architectures define > -ffunction-sections (parisc, score, metag and frv) so there are tons of > useless warnings on these.. It also means the current modpost sanity > checks don't run for those so it might even uncover some real mismatch ;) Yes, but this adds ".exception.text" so a .text.* wildcard won't quite cover it. I've applied his patch, then the following: modpost: handle -ffunction-sections 52dc0595d540 introduced OTHER_TEXT_SECTIONS for identifying what sections could validly have __ex_table entries. Unfortunately, it wasn't tested with -ffunction-sections, which some architectures use. Reported-by: kbuild test robot Cc: Quentin Casasnovas Signed-off-by: Rusty Russell diff --git a/scripts/mod/modpost.c b/scripts/mod/modpost.c index cbd53e08769d..22dbc604cdb9 100644 --- a/scripts/mod/modpost.c +++ b/scripts/mod/modpost.c @@ -876,7 +876,7 @@ static void check_section(const char *modname, struct elf_info *elf, #define TEXT_SECTIONS ".text", ".text.unlikely", ".sched.text", \ ".kprobes.text" #define OTHER_TEXT_SECTIONS ".ref.text", ".head.text", ".spinlock.text", \ - ".fixup", ".entry.text" + ".fixup", ".entry.text", ".exception.text", ".text.*" #define INIT_SECTIONS ".init.*" #define MEM_INIT_SECTIONS ".meminit.*" -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/