Received: by 2002:ac0:a582:0:0:0:0:0 with SMTP id m2-v6csp1037156imm; Tue, 2 Oct 2018 01:23:21 -0700 (PDT) X-Google-Smtp-Source: ACcGV61b4fTB5pMpMxkEwBj+uOf3KGS34wGNunSF3/21qNA79beL68x59ORTkR40Yu3Hpj50JXci X-Received: by 2002:a17:902:694c:: with SMTP id k12-v6mr15765962plt.17.1538468601602; Tue, 02 Oct 2018 01:23:21 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1538468601; cv=none; d=google.com; s=arc-20160816; b=FzQHwMuL0Z4wsluN6cmnBjxcqk14IRN5J6jyniBkG6C9MCZjj/FwEF4CAbDmiQmEGt b8Zx+/bPQBa0WAzC5sZtK4/761Q4Q1bqb8HRzJWASDsxC+dhlzRG1hCwX8F4xW0tf9hz 6GtrrAy5RcftSE7e0NkVafjXTUrEg8WYLiET0tNu4vZdf9X86E9gTBqhHzSkifWjolZ6 JlRU344U6eMBsdrjhxJCTdfMF0oYPIOqAuunOp3LH+TguQ+x9ECFZrePAJvvpR8CZwDF Vs33JYoC1L9CCzLvz+vBsA48ipxJONrbGbJH3/HODQLmw5M0w+wt3upnDNK9yT0f6j/6 k4Gw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:dkim-signature:dkim-filter; bh=mtmBl/oPSqPwMP1oK9NVgfaYZouquMQnZ3M0a/bkXH8=; b=WmCOquN1uRTHN70YX+gCFuHU91ULHYhkFESKwknRnbz0UPXV53fBOUEiywlVcdV5OP kYwafQzIsKNbxKA2P26FELrZLNwzviXnsWy/ql6D8PthgMc4f10bpZLdFDkOfTdyDVik XEmFTybTVYdv+abgwDqoxVR+i3uyHqi2Ge/kwzsY/uJ8GWfyFzlyvm0W4Ho8K0hMC1eh ePZUZ+VyQdSKzK+TINcztTSHT8AAE7Zb6bE++VDVgfUDr4v5EgczMFcKfcBNtPOpeOZ/ EpAUPfxpnOjhdVJHA1HCEyeovGF3fivNz/sDbpOxCVvuBmo5RhJOU06LjYI8NYLWITpC ChKw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxbox.cz header.s=default header.b="BXdImC//"; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id a15-v6si5132473pfn.248.2018.10.02.01.23.06; Tue, 02 Oct 2018 01:23:21 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxbox.cz header.s=default header.b="BXdImC//"; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727545AbeJBPDr (ORCPT + 99 others); Tue, 2 Oct 2018 11:03:47 -0400 Received: from gwu.lbox.cz ([62.245.111.132]:43476 "EHLO gwu.lbox.cz" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727285AbeJBPDq (ORCPT ); Tue, 2 Oct 2018 11:03:46 -0400 X-Greylist: delayed 721 seconds by postgrey-1.27 at vger.kernel.org; Tue, 02 Oct 2018 11:03:45 EDT Received: from linuxbox.linuxbox.cz (linuxbox.linuxbox.cz [10.76.66.10]) by gwu.lbox.cz (Sendmail) with ESMTPS id w9286wUw002506 (version=TLSv1.2 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=NO); Tue, 2 Oct 2018 10:06:58 +0200 DKIM-Filter: OpenDKIM Filter v2.11.0 gwu.lbox.cz w9286wUw002506 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linuxbox.cz; s=default; t=1538467620; bh=mtmBl/oPSqPwMP1oK9NVgfaYZouquMQnZ3M0a/bkXH8=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=BXdImC//9xqpCqewXDFdVrEDNXTgSkOdm8dB9vP03vXOGjGPPWrSaBhzZbCyKf6ID VVGPHHX6fFTxW5X0Rc9vJp+jiOTwHeHVCcDr6cx4oe5VEC0TrR4rtkHkw3Q8/Hd7Ch PKeJQDTK1aMuziFPzvymVByCBrCFH/6bV4rHsllQ= Received: from pcnci.linuxbox.cz (pcnci.linuxbox.cz [10.76.3.14]) by linuxbox.linuxbox.cz (Sendmail) with ESMTPS id w9286v4w020948 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NO); Tue, 2 Oct 2018 10:06:57 +0200 Received: from pcnci.linuxbox.cz (localhost [127.0.0.1]) by pcnci.linuxbox.cz (8.15.2/8.15.2) with SMTP id w9286tWj019974; Tue, 2 Oct 2018 10:06:55 +0200 Date: Tue, 2 Oct 2018 10:06:55 +0200 From: Nikola Ciprich To: Greg Kroah-Hartman Cc: linux-kernel@vger.kernel.org, stable@vger.kernel.org, Andy Lutomirski , Thomas Gleixner , Matt Rickard , Borislav Petkov , Jason Vas Dias , David Woodhouse , Peter Zijlstra , Andi Kleen , Nikola Ciprich Subject: Re: [PATCH 4.14 114/165] x86/vdso: Fix vDSO build if a retpoline is emitted Message-ID: <20181002080655.GV31855@pcnci.linuxbox.cz> References: <20180903165655.003605184@linuxfoundation.org> <20180903165701.245301231@linuxfoundation.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20180903165701.245301231@linuxfoundation.org> User-Agent: Mutt/1.5.21 (2010-09-15) X-Antivirus: on proxybox by F-Secure antivirus, database version 2018-10-02_02 X-Scanned-By: MIMEDefang v2.74/SpamAssassin v3.004001 on proxybox (nik) X-Spam-Score: N/A (imported whitelist) X-Milter-Copy-Status: O Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi Greg and others, sorry for reporting this so late, but still... this breaks build on older compilers, since it requires -mindirect-branch=thunk-inline -mindirect-branch-register even though retpoline support is disabled in kernel config.. is this expected? BR nik On Mon, Sep 03, 2018 at 06:56:40PM +0200, Greg Kroah-Hartman wrote: > 4.14-stable review patch. If anyone has any objections, please let me know. > > ------------------ > > From: Andy Lutomirski > > commit 2e549b2ee0e358bc758480e716b881f9cabedb6a upstream. > > Currently, if the vDSO ends up containing an indirect branch or > call, GCC will emit the "external thunk" style of retpoline, and it > will fail to link. > > Fix it by building the vDSO with inline retpoline thunks. > > I haven't seen any reports of this triggering on an unpatched > kernel. > > Fixes: commit 76b043848fd2 ("x86/retpoline: Add initial retpoline support") > Signed-off-by: Andy Lutomirski > Signed-off-by: Thomas Gleixner > Acked-by: Matt Rickard > Cc: Borislav Petkov > Cc: Jason Vas Dias > Cc: David Woodhouse > Cc: Peter Zijlstra > Cc: Andi Kleen > Cc: stable@vger.kernel.org > Link: https://lkml.kernel.org/r/c76538cd3afbe19c6246c2d1715bc6a60bd63985.1534448381.git.luto@kernel.org > Signed-off-by: Greg Kroah-Hartman > > --- > Makefile | 4 ++++ > arch/x86/entry/vdso/Makefile | 6 ++++-- > 2 files changed, 8 insertions(+), 2 deletions(-) > > --- a/Makefile > +++ b/Makefile > @@ -490,9 +490,13 @@ KBUILD_AFLAGS += $(CLANG_TARGET) $(CLANG > endif > > RETPOLINE_CFLAGS_GCC := -mindirect-branch=thunk-extern -mindirect-branch-register > +RETPOLINE_VDSO_CFLAGS_GCC := -mindirect-branch=thunk-inline -mindirect-branch-register > RETPOLINE_CFLAGS_CLANG := -mretpoline-external-thunk > +RETPOLINE_VDSO_CFLAGS_CLANG := -mretpoline > RETPOLINE_CFLAGS := $(call cc-option,$(RETPOLINE_CFLAGS_GCC),$(call cc-option,$(RETPOLINE_CFLAGS_CLANG))) > +RETPOLINE_VDSO_CFLAGS := $(call cc-option,$(RETPOLINE_VDSO_CFLAGS_GCC),$(call cc-option,$(RETPOLINE_VDSO_CFLAGS_CLANG))) > export RETPOLINE_CFLAGS > +export RETPOLINE_VDSO_CFLAGS > > ifeq ($(config-targets),1) > # =========================================================================== > --- a/arch/x86/entry/vdso/Makefile > +++ b/arch/x86/entry/vdso/Makefile > @@ -74,9 +74,9 @@ $(obj)/vdso-image-%.c: $(obj)/vdso%.so.d > CFL := $(PROFILING) -mcmodel=small -fPIC -O2 -fasynchronous-unwind-tables -m64 \ > $(filter -g%,$(KBUILD_CFLAGS)) $(call cc-option, -fno-stack-protector) \ > -fno-omit-frame-pointer -foptimize-sibling-calls \ > - -DDISABLE_BRANCH_PROFILING -DBUILD_VDSO > + -DDISABLE_BRANCH_PROFILING -DBUILD_VDSO $(RETPOLINE_VDSO_CFLAGS) > > -$(vobjs): KBUILD_CFLAGS := $(filter-out $(GCC_PLUGINS_CFLAGS),$(KBUILD_CFLAGS)) $(CFL) > +$(vobjs): KBUILD_CFLAGS := $(filter-out $(GCC_PLUGINS_CFLAGS) $(RETPOLINE_CFLAGS),$(KBUILD_CFLAGS)) $(CFL) > > # > # vDSO code runs in userspace and -pg doesn't help with profiling anyway. > @@ -147,11 +147,13 @@ KBUILD_CFLAGS_32 := $(filter-out -mcmode > KBUILD_CFLAGS_32 := $(filter-out -fno-pic,$(KBUILD_CFLAGS_32)) > KBUILD_CFLAGS_32 := $(filter-out -mfentry,$(KBUILD_CFLAGS_32)) > KBUILD_CFLAGS_32 := $(filter-out $(GCC_PLUGINS_CFLAGS),$(KBUILD_CFLAGS_32)) > +KBUILD_CFLAGS_32 := $(filter-out $(RETPOLINE_CFLAGS),$(KBUILD_CFLAGS_32)) > KBUILD_CFLAGS_32 += -m32 -msoft-float -mregparm=0 -fpic > KBUILD_CFLAGS_32 += $(call cc-option, -fno-stack-protector) > KBUILD_CFLAGS_32 += $(call cc-option, -foptimize-sibling-calls) > KBUILD_CFLAGS_32 += -fno-omit-frame-pointer > KBUILD_CFLAGS_32 += -DDISABLE_BRANCH_PROFILING > +KBUILD_CFLAGS_32 += $(RETPOLINE_VDSO_CFLAGS) > $(obj)/vdso32.so.dbg: KBUILD_CFLAGS = $(KBUILD_CFLAGS_32) > > $(obj)/vdso32.so.dbg: FORCE \ > > -- ------------------------------------- Ing. Nikola CIPRICH LinuxBox.cz, s.r.o. 28.rijna 168, 709 00 Ostrava tel.: +420 591 166 214 fax: +420 596 621 273 mobil: +420 777 093 799 www.linuxbox.cz mobil servis: +420 737 238 656 email servis: servis@linuxbox.cz -------------------------------------