Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751962AbdCAM6q (ORCPT ); Wed, 1 Mar 2017 07:58:46 -0500 Received: from mx1.redhat.com ([209.132.183.28]:41662 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751439AbdCAM6m (ORCPT ); Wed, 1 Mar 2017 07:58:42 -0500 Date: Wed, 1 Mar 2017 06:56:22 -0600 From: Josh Poimboeuf To: Ingo Molnar Cc: hpa@zytor.com, linux-tip-commits@vger.kernel.org, tip-bot for Josh Poimboeuf , a.p.zijlstra@chello.nl, torvalds@linux-foundation.org, tglx@linutronix.de, linux-kernel@vger.kernel.org, peterz@infradead.org Subject: Re: [PATCH] objtool, compiler.h: Fix __unreachable section relocation size Message-ID: <20170301125622.vcc7shod33hv6wnw@treble> References: <20170301060504.oltm3iws6fmubnom@treble> <1A185271-A629-43C0-9A1B-9EDB75630057@zytor.com> <20170301124121.urubwf7jo2s45wt2@treble> <20170301124401.GA27671@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: <20170301124401.GA27671@gmail.com> User-Agent: Mutt/1.6.0.1 (2016-04-01) X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.28]); Wed, 01 Mar 2017 12:56:25 +0000 (UTC) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 4069 Lines: 105 On Wed, Mar 01, 2017 at 01:44:01PM +0100, Ingo Molnar wrote: > > * Josh Poimboeuf wrote: > > > On Wed, Mar 01, 2017 at 12:15:38AM -0800, hpa@zytor.com wrote: > > > On March 1, 2017 12:10:59 AM PST, tip-bot for Josh Poimboeuf wrote: > > > >Commit-ID: 90a7e63a31b8f7d630d12ef0d8d37d3ab87f76e5 > > > >Gitweb: > > > >http://git.kernel.org/tip/90a7e63a31b8f7d630d12ef0d8d37d3ab87f76e5 > > > >Author: Josh Poimboeuf > > > >AuthorDate: Wed, 1 Mar 2017 00:05:04 -0600 > > > >Committer: Ingo Molnar > > > >CommitDate: Wed, 1 Mar 2017 07:38:25 +0100 > > > > > > > >objtool: Fix __unreachable section relocation size > > > > > > > >Linus reported the following commit broke module loading on his laptop: > > > > > > > >d1091c7fa3d5 ("objtool: Improve detection of BUG() and other dead > > > >ends") > > > > > > > >It showed errors like the following: > > > > > > > > module: overflow in relocation type 10 val ffffffffc02afc81 > > > > module: 'nvme' likely not compiled with -mcmodel=kernel > > > > > > > >The problem is that the __unreachable section addresses are stored > > > >using > > > >the '.long' asm directive, which isn't big enough for .text section > > > >relative kernel addresses. Use '.quad' instead. > > > > > > > >Suggested-by: Linus Torvalds > > > >Reported-by: Linus Torvalds > > > >Signed-off-by: Josh Poimboeuf > > > >Cc: Peter Zijlstra > > > >Cc: Peter Zijlstra > > > >Cc: Thomas Gleixner > > > >Fixes: d1091c7fa3d5 ("objtool: Improve detection of BUG() and other > > > >dead ends") > > > >Link: http://lkml.kernel.org/r/20170301060504.oltm3iws6fmubnom@treble > > > >Signed-off-by: Ingo Molnar > > > >--- > > > > include/linux/compiler-gcc.h | 2 +- > > > > 1 file changed, 1 insertion(+), 1 deletion(-) > > > > > > > >diff --git a/include/linux/compiler-gcc.h > > > >b/include/linux/compiler-gcc.h > > > >index 76e28c2..91a77a5 100644 > > > >--- a/include/linux/compiler-gcc.h > > > >+++ b/include/linux/compiler-gcc.h > > > >@@ -201,7 +201,7 @@ > > > > #define annotate_unreachable() ({ \ > > > > asm("%c0:\t\n" \ > > > > ".pushsection __unreachable, \"a\"\t\n" \ > > > >- ".long %c0b\t\n" \ > > > >+ ".quad %c0b\t\n" \ > > > > ".popsection\t\n" : : "i" (__LINE__)); \ > > > > }) > > > > #else > > > > > > Or perhaps better use relative addresses, so: > > > > > > .long foo - (.+4) > > > > Hm, yeah, something like that would indeed be better as it only needs 4 > > bytes instead of 8. For this use case, the following seems to work: > > > > ".long %c0b - .\t\n" > > > > It produces the same relocation section+addend as before but with a > > X86_64_PC32 relocation. > > > > It looks like the above patch was already merged so I'll add that change > > to the TODO list unless Ingo can squash it with the above patch. > > I've squashed it - attached the latest version. Does this look good to everyone? > > Thanks, > > Ingo > > ================> > From a6ae17f553bf9b4a0c7f8534e5f0f983bc7955c7 Mon Sep 17 00:00:00 2001 > From: Josh Poimboeuf > Date: Wed, 1 Mar 2017 00:05:04 -0600 > Subject: [PATCH] objtool, compiler.h: Fix __unreachable section relocation size > > Linus reported the following commit broke module loading on his laptop: > > d1091c7fa3d5 ("objtool: Improve detection of BUG() and other dead ends") > > It showed errors like the following: > > module: overflow in relocation type 10 val ffffffffc02afc81 > module: 'nvme' likely not compiled with -mcmodel=kernel > > The problem is that the __unreachable section addresses are stored using > the '.long' asm directive, which isn't big enough for .text section > relative kernel addresses. Use relative addresses instead: Maybe remove the first "relative" in the last line. Otherwise it looks good to me. Thanks Ingo! -- Josh