Received: by 2002:a05:6a10:a0d1:0:0:0:0 with SMTP id j17csp2530753pxa; Mon, 24 Aug 2020 17:32:59 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxORt1oAsJbnJxRf+WKeAlpDmJ7cK8TMTHj2nloCr3idFQ343d8I32eWZgB+BoQ+WPilxrT X-Received: by 2002:a17:906:fcdc:: with SMTP id qx28mr4307058ejb.289.1598315578973; Mon, 24 Aug 2020 17:32:58 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1598315578; cv=none; d=google.com; s=arc-20160816; b=loSfXoYu8QhdE8A5ENgvjOtn9wLeO8QLLcz9/wV7x9b27OvZjDCqmbfKMzQaOUsakp ywdTP+nmKzQsbWu9PhlbQ3la0ffcMSmcDgdQAhj8SFEOBde6eQbT+uz2YER1DbgNWbqL Ezsuc0QhkriRhH0hhDOiznIPlMk5XPoufIMpFocUjxxMoOv1V5/7vTSxm7gCr4ox/e22 BytxA0A9fMPEQ3CPTrR8nS+LTdeILc/YPws1UW6rgD/ImdMmMVav2TnGOwsdPC53puBE L2QzR7bpDnH4qqy31IlvDtG/Cf/XqpZ19nnk69sha3OoxrKE86IGyS75btEWBENjOzTL SWFA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :ironport-sdr:ironport-sdr; bh=VG9y9itM9wPM3gOhOt6xJKbXZKccFPitiCYxMP/yNTI=; b=ThezraQgq86Rc11/Nq+5ZjQchhuczQlLjxoIKjsEL6AhPUnHt6D1e6pKoFsNgmaFC2 SIqwJjCSjEZ/dQnUts5qp8SNvktYrK6iqQdWAUxb5AWPgVNS4xQdfH1QPw7NjIU1V3HL Ol/cajgkfBl5+w0WcVFWveayE4efONN33pSP9xUar7PX+ACQDVgbThqdKmXtA4Vbq5YK cBfxYoKp2RoYOtyKuD6NRZmzaLVzwjdpfDSfp3cBfMxKuMfhXBByGlf/Cm83dPtQgZU7 H/xuz7SWkanHvITwXfLQf1t0JD+vKCQEM41AZEwmUZO3QqQzg/gVBmlpvIF9pEHy8Ryj YByA== 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 ds7si11804385ejc.511.2020.08.24.17.32.36; Mon, 24 Aug 2020 17:32:58 -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 S1728605AbgHYAba (ORCPT + 99 others); Mon, 24 Aug 2020 20:31:30 -0400 Received: from mga01.intel.com ([192.55.52.88]:28753 "EHLO mga01.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728483AbgHYAak (ORCPT ); Mon, 24 Aug 2020 20:30:40 -0400 IronPort-SDR: IQblzNwWXYSwQ0IGeHwqx0J/SrQEd3irhmNIF/BD9sYk/nye4grqhqs4aLqmIASsC/VVw60NW6 BaRcplCxaD5Q== X-IronPort-AV: E=McAfee;i="6000,8403,9723"; a="174053286" X-IronPort-AV: E=Sophos;i="5.76,350,1592895600"; d="scan'208";a="174053286" X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga004.jf.intel.com ([10.7.209.38]) by fmsmga101.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 24 Aug 2020 17:30:37 -0700 IronPort-SDR: CZm3evfZq44Iuma7t7gzSLCDG2cHQ7o1phBaZEox/ofJXa60prL8D8E403ktCzTNSEgX7s4fhO Zc0d8Ug5grWQ== X-IronPort-AV: E=Sophos;i="5.76,350,1592895600"; d="scan'208";a="443429337" Received: from yyu32-desk.sc.intel.com ([143.183.136.146]) by orsmga004-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 24 Aug 2020 17:30:37 -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 Cc: Yu-cheng Yu Subject: [PATCH v11 8/9] x86/vdso: Insert endbr32/endbr64 to vDSO Date: Mon, 24 Aug 2020 17:26:43 -0700 Message-Id: <20200825002645.3658-9-yu-cheng.yu@intel.com> X-Mailer: git-send-email 2.21.0 In-Reply-To: <20200825002645.3658-1-yu-cheng.yu@intel.com> References: <20200825002645.3658-1-yu-cheng.yu@intel.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org 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..82f8e25e139f 100644 --- a/arch/x86/entry/vdso/Makefile +++ b/arch/x86/entry/vdso/Makefile @@ -130,6 +130,10 @@ $(obj)/%-x32.o: $(obj)/%.o FORCE targets += vdsox32.lds $(vobjx32s-y) +ifdef CONFIG_X86_INTEL_BRANCH_TRACKING_USER + $(obj)/vclock_gettime.o $(obj)/vgetcpu.o $(obj)/vdso32/vclock_gettime.o: KBUILD_CFLAGS += -fcf-protection=branch +endif + $(obj)/%.so: OBJCOPYFLAGS := -S $(obj)/%.so: $(obj)/%.so.dbg FORCE $(call if_changed,objcopy) -- 2.21.0