Received: by 2002:a05:6a10:a841:0:0:0:0 with SMTP id d1csp771365pxy; Wed, 28 Apr 2021 13:57:54 -0700 (PDT) X-Google-Smtp-Source: ABdhPJx1UIEXLyyJJjVKdzK77vobsnB+JMbt2T7wdZyt/O1zg54ZKLanFv7cYfqENyo8hnTTOXvF X-Received: by 2002:aa7:df0b:: with SMTP id c11mr13626472edy.288.1619643473810; Wed, 28 Apr 2021 13:57:53 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1619643473; cv=none; d=google.com; s=arc-20160816; b=toQOVzG8OmV8wJHVlHOhY+SjKvUW5NhLY+ofyc3GZZINu+k72gmiIySpVbZaEdX4oj iRfvvZ4e2fDX046CrJ6Uz+1yfJIUekl05b+UiinmA9aOJTl889zE7ITLdlMU5yJ0S6OZ VoOI1nV81//MkONLL8wq77qfVmri3hbS9OI/hWvJUbdMSnRLi/JnZz9XzlvgZn2hCOCd SeAIzwPMNpYX/2JYH5roT1PJZVJfoUvPIo9NUX3AsAvnFqdTg2/MQ2MBYJU7ffucjUUy A25veemjUMyKUzWvA1Fdu0ZuKY9iiD9PP72aTFE6PIsBKFpInOCByeBC9Fne5p1Tyfo2 WzqQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=lzyHFl3XvpD8uLoAKMCr+4eH/NJBzwafsnTS+S805fk=; b=j9dx5KOFiWD5ivtxZYkiopoiIR16ZA5YB2LJef3+VHaWjb05mTO3RvYSPvODTs0pgy VcdHzmvW2IfjdU39kUqrfudTxs3DLp7UZ0rdhPMiLjAN82JPRslqtZr5JDtfnqA/wPdm PH8UZBXSHXWZ2Rzegxv5sO3RvJOmLN7cpX7FAZWbY82LOffpjlZwQVxc7Gdwjahn1ZT2 gFvdENn4UcV/oiN591bSwSzvicEmy/0yQXV2sKLDgvyL2i6B9LJS50iHkSmlxOIyb2gI /iqgRfD6VUDVElqdtqa9ZYjFEPnlvvxNJo4SP2Ldo8OiFWiQ5VTD8oOzTeoUFIu08osT 5NdQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=bdXMxB5V; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=chromium.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id m19si888730edd.340.2021.04.28.13.57.30; Wed, 28 Apr 2021 13:57:53 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=bdXMxB5V; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=chromium.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S240449AbhD1Udz (ORCPT + 99 others); Wed, 28 Apr 2021 16:33:55 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58352 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S240395AbhD1Udx (ORCPT ); Wed, 28 Apr 2021 16:33:53 -0400 Received: from mail-pl1-x635.google.com (mail-pl1-x635.google.com [IPv6:2607:f8b0:4864:20::635]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 90713C06138A for ; Wed, 28 Apr 2021 13:33:08 -0700 (PDT) Received: by mail-pl1-x635.google.com with SMTP id a11so2631311plh.3 for ; Wed, 28 Apr 2021 13:33:08 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to; bh=lzyHFl3XvpD8uLoAKMCr+4eH/NJBzwafsnTS+S805fk=; b=bdXMxB5VuwcJ7B/NZ1R1f4hO5v01BHFCLeBjI3nekCdeo5Co2s9IkQJne2LWDogsn+ qQoIeLnMSdxvF8y+JHKLF2YKtCI8cd3GOCFdIcG17iHVAUnzlpncasGaaF6uGVmr4f84 62Cp3BPVAxKRzOEE9IOTQ6Aq1Jb4lFikH3SB0= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=lzyHFl3XvpD8uLoAKMCr+4eH/NJBzwafsnTS+S805fk=; b=FGk7UNpH/+79lP8ZqEGMagShfnxTbMFRKpoObjA1A3pyWaz3ioNXkkSOjujKVl5VS6 xUyQ9BD53uN7RDzp50xnihrHeedNNHQlQC9KwPYC9B3K4+SO4sK9Y6kjsi9uzto5gxLI I09/iGO7AZ4HOeL0FFAOqJQzd64GcrqcdG8HzSPh3P10SBIBH8rscEik0ejwZjM8ALyl XgOhOz23N1DoeDWCuUo8BtGlizdeR6Kn/L7asrv62olT4hV9xGwCvECYDXegj7dIWpfz GCy6hzUo9E/3F3LOXD9MZeGWNLWw4hcI8iQrEOzhcJOIZCtEl1yeaLWc1KJp2ZGsFa6+ 6APQ== X-Gm-Message-State: AOAM532PqNAFskJDnisAy4duNC7tichL7MyBdqrFEVgRj/rTLqHz8KOF s/1aFHKDR1DSKnGuHbmNSILVLg== X-Received: by 2002:a17:902:aa98:b029:ec:a55f:f4bc with SMTP id d24-20020a170902aa98b02900eca55ff4bcmr32332974plr.82.1619641988198; Wed, 28 Apr 2021 13:33:08 -0700 (PDT) Received: from www.outflux.net (smtp.outflux.net. [198.145.64.163]) by smtp.gmail.com with ESMTPSA id w2sm468892pfi.104.2021.04.28.13.33.07 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 28 Apr 2021 13:33:07 -0700 (PDT) Date: Wed, 28 Apr 2021 13:33:06 -0700 From: Kees Cook To: Yu-cheng Yu Cc: x86@kernel.org, "H. Peter Anvin" , Thomas Gleixner , Ingo Molnar , linux-kernel@vger.kernel.org, linux-doc@vger.kernel.org, linux-mm@kvack.org, linux-arch@vger.kernel.org, linux-api@vger.kernel.org, Arnd Bergmann , Andy Lutomirski , Balbir Singh , Borislav Petkov , Cyrill Gorcunov , Dave Hansen , Eugene Syromiatnikov , Florian Weimer , "H.J. Lu" , Jann Horn , Jonathan Corbet , Mike Kravetz , Nadav Amit , Oleg Nesterov , Pavel Machek , Peter Zijlstra , Randy Dunlap , "Ravi V. Shankar" , Vedvyas Shanbhogue , Dave Martin , Weijiang Yang , Pengfei Xu , Haitao Huang Subject: Re: [PATCH v26 6/9] x86/vdso: Insert endbr32/endbr64 to vDSO Message-ID: <202104281332.94A153C@keescook> References: <20210427204720.25007-1-yu-cheng.yu@intel.com> <20210427204720.25007-7-yu-cheng.yu@intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20210427204720.25007-7-yu-cheng.yu@intel.com> Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, Apr 27, 2021 at 01:47:17PM -0700, Yu-cheng Yu wrote: > From: "H.J. Lu" > > When Indirect Branch Tracking (IBT) is enabled, vDSO functions may be > called indirectly, and must have ENDBR32 or ENDBR64 as the first > instruction. The compiler must support -fcf-protection=branch so that it > can be used to compile vDSO. If you respin this, you can maybe rephrase this since CONFIG_X86_IBT has already tested for the compiler support. > > Signed-off-by: H.J. Lu > Signed-off-by: Yu-cheng Yu > Cc: Andy Lutomirski > Cc: Kees Cook Reviewed-by: Kees Cook -Kees > --- > v24: > - Replace CONFIG_X86_CET with CONFIG_X86_IBT to reflect splitting of shadow > stack and ibt. > > arch/x86/entry/vdso/Makefile | 4 ++++ > 1 file changed, 4 insertions(+) > > diff --git a/arch/x86/entry/vdso/Makefile b/arch/x86/entry/vdso/Makefile > index 05c4abc2fdfd..a773a5f03b63 100644 > --- a/arch/x86/entry/vdso/Makefile > +++ b/arch/x86/entry/vdso/Makefile > @@ -93,6 +93,10 @@ endif > > $(vobjs): KBUILD_CFLAGS := $(filter-out $(CC_FLAGS_LTO) $(GCC_PLUGINS_CFLAGS) $(RETPOLINE_CFLAGS),$(KBUILD_CFLAGS)) $(CFL) > > +ifdef CONFIG_X86_IBT > +$(vobjs) $(vobjs32): KBUILD_CFLAGS += -fcf-protection=branch > +endif > + > # > # vDSO code runs in userspace and -pg doesn't help with profiling anyway. > # > -- > 2.21.0 > -- Kees Cook