From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-11.0 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_CR_TRAILER,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id F2075C433ED for ; Wed, 28 Apr 2021 20:39:33 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id C6C5A61445 for ; Wed, 28 Apr 2021 20:39:31 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S242022AbhD1UkP (ORCPT ); Wed, 28 Apr 2021 16:40:15 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59778 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S242014AbhD1UkN (ORCPT ); Wed, 28 Apr 2021 16:40:13 -0400 Received: from mail-pg1-x533.google.com (mail-pg1-x533.google.com [IPv6:2607:f8b0:4864:20::533]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id AE9CBC06138B for ; Wed, 28 Apr 2021 13:39:28 -0700 (PDT) Received: by mail-pg1-x533.google.com with SMTP id d10so7218390pgf.12 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=f7kZsTTbVGTj3Km+efCexIFxSSDn+DDCOp5IqNB6DhH/S+b03lNKRsWpxLQq4d1k/i mHCahDqTsv4scax/CCKARDz0p9Jo2PeSWbefefUyTdeO4ybRqDqfNr9jdscSK200HvoQ lRxFViuGGHx/VSd9iFNuVgatFUh4WUQfLrxQ1g3awxczFQpA0FemFIyMBlwzEapfqVBu qdRRfouyM+KACUAP6dsD9ty9ebJKxPcvrq+T1Y8HV0NjuNGQoNcau8MSvkXwQiPbcLXW 3bpx8qG9Tii7IAKiF/i+q4MK2IkNTBerHyG5nbLZxt/MR38mQAoXjooEE4OFlF+60wne QZ6A== X-Gm-Message-State: AOAM5302pp59EHpAqLfrV1ey+6qDtwqHh/WjoEXFzu7A4cWgtzp4sQxv xtD0YI9hdAJWMLwt3zVUYCbOVQ== X-Google-Smtp-Source: ABdhPJz7TORt5UPUxQHJtcwUy7DLeU9h16cX0ZufDjJxSEVTidsxEub3MlR7oNmOUCLjsAVtm6Bv+w== 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-api@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