Received: by 2002:a05:6a10:a841:0:0:0:0 with SMTP id d1csp772622pxy; Wed, 28 Apr 2021 13:59:46 -0700 (PDT) X-Google-Smtp-Source: ABdhPJy40tF1lxq0FrkmTcJlrBVgfV6Cw3/7/bY+udSbeW3FaEVHrPv8FtKFIsHc9hQtImvwnm6p X-Received: by 2002:a50:fe81:: with SMTP id d1mr14241024edt.308.1619643586455; Wed, 28 Apr 2021 13:59:46 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1619643586; cv=none; d=google.com; s=arc-20160816; b=NSMnrEY/zDL5ISTrd9hp1ncjHEAXRLqOk0/UBbK7JWgKK4XgllIvo4DnN3nhpf44Np aDQTdR+qmnVH2SfLXLihhI/H2wrndHMcvb+LfAn+lyzc+/esppVlokzPnjDukq76kkJf RXFPtzPztW2iCUyIeEzXL8vIK85bbgAedSbPaWOUiwAPd6d81yY7qPRapLRnYISDEPhk ljfusu4qCxDxV2NgI7S6KcC2O0+aJO1xUhm6f+hj5IYJSkUI9OIAsGE9G59cL6wkasNQ JoY/4Du4yJBZEJL29quKTDqujaHDix3uqJG/qClJQnPpcKvVl42fLtaBMPfvIKdMkvQs P/mg== 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=bP0jsyLUeBZMcia9mVsWBqP6zFcasRiNfS5tk4kM0rM=; b=HkxCJYkxpkCjMLo1bD5WZzAjZDBr8FgJXo7igmZd7UoOQvNvmJYvWCcs+UJOBHF8Ct lEjYTeam/fraNvY9iyiQl6cwDk7nctydXgW4iEb5xRuzlhy5qsrgzMouEqmOFnMCYC4X sy9+6yVTlwI2Laz+upCWrjNppuSyAd8v7EQ8RRUotq5U124xw1hF5J1xYqNQ+cSiyKaz EWBtXLDblxWVcZrrHapEydnDFFRr0Q+lxee+sL6giJYuM5vyWt50q2S/PHcqrzuX/qGL usz5w0nhZDElabfovgZQjj9rBnFtsCQBdQjTaFIxKcktpOhNTrNDFxUlRER5pHhLN4vT 3C+A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=A8+FVi1m; 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 hp34si1130873ejc.292.2021.04.28.13.59.21; Wed, 28 Apr 2021 13:59:46 -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=A8+FVi1m; 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 S242006AbhD1UkO (ORCPT + 99 others); Wed, 28 Apr 2021 16:40:14 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59782 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S242013AbhD1UkN (ORCPT ); Wed, 28 Apr 2021 16:40:13 -0400 Received: from mail-pf1-x42d.google.com (mail-pf1-x42d.google.com [IPv6:2607:f8b0:4864:20::42d]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B2E27C06138D for ; Wed, 28 Apr 2021 13:39:28 -0700 (PDT) Received: by mail-pf1-x42d.google.com with SMTP id q2so12615744pfk.9 for ; Wed, 28 Apr 2021 13:39:28 -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=bP0jsyLUeBZMcia9mVsWBqP6zFcasRiNfS5tk4kM0rM=; b=A8+FVi1mPar4WLP24ObFpp1Q218abKlV0OQrmnoXUgmmTraergbRvRIY1olI2H8FM5 Zs2ESIBKBScQGKK1e8f+Sa1YgkVnUJgNUswDh4G4ZG1eWdx+7ssZlBxd43RQhC93UIcT UKYW2k8b4p/NrYoP+17PCBkBmkSnwJZS6FulQ= 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=bP0jsyLUeBZMcia9mVsWBqP6zFcasRiNfS5tk4kM0rM=; b=sPhtzlWdgq6/G4lJRsJN5AUIBcUsFm1aHPNwbpMd+qjzaKIdXc58hI0FTGYvqi2AQN 2Zu814m1U4VWBijhz8sfjcTxU6yVAjolAqk6qKlP0Uz1O94kp09tKjcJE8RMwRJooSPR xO7nO5DvmAAYEhnbxNFiUcuGR7ietq1xduN3UCWtSAta1R4+bqYt731n1niO60T9mMQ3 5N6UqZowSoD8BXUteQivslBXXXvVETFg6g3khqCw9At7C789/oGQJr4Ad7eZq4Rtoa/T 5dY9C0wxjb98mEg/IsEgStZKyslGnE3t3m6RBB0bWjWbN+pbqzAg5Cp3TW3REMFNZ98/ nZzQ== X-Gm-Message-State: AOAM531HWgYO9qUYTFeLPeiPr0Fn/uZ7/pO1p3hDbUpwWblT5OgSWLy4 GzZlTbJ6Rnj5IVYiKj5cDadmIg== X-Received: by 2002:a62:cd83:0:b029:275:d87e:612e with SMTP id o125-20020a62cd830000b0290275d87e612emr18839700pfg.49.1619642368304; Wed, 28 Apr 2021 13:39:28 -0700 (PDT) Received: from www.outflux.net (smtp.outflux.net. [198.145.64.163]) by smtp.gmail.com with ESMTPSA id l18sm5405576pjq.33.2021.04.28.13.39.27 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 28 Apr 2021 13:39:27 -0700 (PDT) Date: Wed, 28 Apr 2021 13:39:26 -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 , Jarkko Sakkinen Subject: Re: [PATCH v26 9/9] x86/vdso: Add ENDBR to __vdso_sgx_enter_enclave Message-ID: <202104281339.E21514F9D@keescook> References: <20210427204720.25007-1-yu-cheng.yu@intel.com> <20210427204720.25007-10-yu-cheng.yu@intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20210427204720.25007-10-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:20PM -0700, Yu-cheng Yu wrote: > ENDBR is a special new instruction for the Indirect Branch Tracking (IBT) > component of CET. IBT prevents attacks by ensuring that (most) indirect > branches and function calls may only land at ENDBR instructions. Branches > that don't follow the rules will result in control flow (#CF) exceptions. > > ENDBR is a noop when IBT is unsupported or disabled. Most ENDBR > instructions are inserted automatically by the compiler, but branch > targets written in assembly must have ENDBR added manually. > > Add ENDBR to __vdso_sgx_enter_enclave() branch targets. > > Signed-off-by: Yu-cheng Yu Reviewed-by: Kees Cook -- Kees Cook