Received: by 2002:a05:6a10:6744:0:0:0:0 with SMTP id w4csp4072828pxu; Mon, 12 Oct 2020 08:48:32 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzYGFL7yGxic+KjsfB+tnR84ZlIfMZUPBEILWmBfQiU+3lKCAqpyV3x18hSM/QfJpQkRq9e X-Received: by 2002:aa7:c9ce:: with SMTP id i14mr14440063edt.279.1602517711762; Mon, 12 Oct 2020 08:48:31 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1602517711; cv=none; d=google.com; s=arc-20160816; b=xl3exCr0rfqcVoOTRm9+4oJgUIH62+7/joQqefybf7XzCmZ77ZCIyoFsBK5bZrdox3 ygVta1TsUioUn3MkA4R4p7v4ZItSF6NS+FiHR4Y8ax9cqzUDFW9wMcxb5CtIVPjTK3E+ TPW1pDzAoTSfIvJvSO49N/rf9ufGyiXhkQAKtTGdGZpjZUj4yrNTRb9mEBAdQOCNEF3u UIJ3UnJqFDsjQyv1HQ92StoUoxyKteBqCbPJlQUVSu4dHkOOwWIYv3f6vn5m0Gq2rXLK /lCVl92jGF2QRaKhvIOHmZEMOArmKB2cyQSZvrx7kR1WNfll9rc+AlaYw+2G/peIDGUT Sz9A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :ironport-sdr:ironport-sdr; bh=W/TdYsh0x2KgjbTYxRQ06XmPmDs5fn38tr7K0Vq1J20=; b=fEi35Ces9e4cOE9D0/Z/n4nhL+buujx1SiQQ4+0uF7TpsacUzlG5uxeiK9wy0WIW5J hv1a3LzLlHUG5ixCTt13mzfEQ/Ak+iOyNf2MV/8SlfkvcBojlUDFJftLDjkB/OBm/kkt pggaF6adiyW6J5s9OPk5LuWj/eyHcq963zLvgJofbsphmTLttZa/h1P85IJINBNPBU9b MX7ygKXUWRHTwhYU4BeGb5tyPVwHaTsQvocRhDjJUn3MxwR1QW++HlQ9YQGTit7xvnPS qSv36OIygbY4/GH3kkdTO344i+nwC3lb2KmH6GMUbLgO0D62kqLOKmMzTemI14AA6PoA 9PLQ== ARC-Authentication-Results: i=1; mx.google.com; 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=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id bo4si7277154edb.324.2020.10.12.08.48.09; Mon, 12 Oct 2020 08:48:31 -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; 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=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2390594AbgJLPqI (ORCPT + 99 others); Mon, 12 Oct 2020 11:46:08 -0400 Received: from mga07.intel.com ([134.134.136.100]:28367 "EHLO mga07.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2390391AbgJLPpz (ORCPT ); Mon, 12 Oct 2020 11:45:55 -0400 IronPort-SDR: Tt3zefFKzByUYb0rQwEpbeh/U/wFrhZuiONnQR3pquxOsEdWUaHPjLEiTBwpNnYSRfj0oI2yqz YT8ReG1Zz2Wg== X-IronPort-AV: E=McAfee;i="6000,8403,9772"; a="229939284" X-IronPort-AV: E=Sophos;i="5.77,367,1596524400"; d="scan'208";a="229939284" X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga005.jf.intel.com ([10.7.209.41]) by orsmga105.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 12 Oct 2020 08:45:54 -0700 IronPort-SDR: uktNiKl6OrGraGtBexLD49EBKoSk4PWqNdqvRfE9JUhTzhcs8JxM9dleflCvMSf5Pd2el9vp80 gvY7DK0IsBSA== X-IronPort-AV: E=Sophos;i="5.77,367,1596524400"; d="scan'208";a="530012655" Received: from yyu32-desk.sc.intel.com ([143.183.136.146]) by orsmga005-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 12 Oct 2020 08:45:54 -0700 From: Yu-cheng Yu To: 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 , Kees Cook , Mike Kravetz , Nadav Amit , Oleg Nesterov , Pavel Machek , Peter Zijlstra , Randy Dunlap , "Ravi V. Shankar" , Vedvyas Shanbhogue , Dave Martin , Weijiang Yang , Pengfei Xu Cc: Yu-cheng Yu Subject: [PATCH v14 7/7] x86/vdso: Insert endbr32/endbr64 to vDSO Date: Mon, 12 Oct 2020 08:45:30 -0700 Message-Id: <20201012154530.28382-8-yu-cheng.yu@intel.com> X-Mailer: git-send-email 2.21.0 In-Reply-To: <20201012154530.28382-1-yu-cheng.yu@intel.com> References: <20201012154530.28382-1-yu-cheng.yu@intel.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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. Signed-off-by: H.J. Lu Signed-off-by: Yu-cheng Yu Acked-by: Andy Lutomirski --- 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 215376d975a2..1f1b6893068a 100644 --- a/arch/x86/entry/vdso/Makefile +++ b/arch/x86/entry/vdso/Makefile @@ -94,6 +94,10 @@ endif $(vobjs): KBUILD_CFLAGS := $(filter-out $(GCC_PLUGINS_CFLAGS) $(RETPOLINE_CFLAGS),$(KBUILD_CFLAGS)) $(CFL) +ifdef CONFIG_X86_BRANCH_TRACKING_USER +$(vobjs) $(vobjs32): KBUILD_CFLAGS += -fcf-protection=branch +endif + # # vDSO code runs in userspace and -pg doesn't help with profiling anyway. # -- 2.21.0