Received: by 2002:a05:6358:1087:b0:cb:c9d3:cd90 with SMTP id j7csp249300rwi; Tue, 18 Oct 2022 17:14:31 -0700 (PDT) X-Google-Smtp-Source: AMsMyM7fXO6U595Cv5wCQBnqijEeEkelXitklmhcdyrY4Z3AVSHpMyTsLzj9n+jOl1is03sRDc2W X-Received: by 2002:a05:6402:27c7:b0:45d:45f0:e6c4 with SMTP id c7-20020a05640227c700b0045d45f0e6c4mr4812293ede.325.1666138471610; Tue, 18 Oct 2022 17:14:31 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666138471; cv=none; d=google.com; s=arc-20160816; b=qC2+8BSWW5xtgYkLOZe5BiHPHkQKdyhb+7Q6VOfSvUE1Gf62jJ8Fps3o8GnpG6bOXQ hVx1aeWvJhejzVi8nZVUIKJrMKmwt4lUx8si00n+KJMHf2wZWBuvAGv3AyuqVF7LUkTL ecC34dTD4KUvErtYE4Yw9xTJmbtJ+x4Rki2EOMv/cNwCF8bBg0++dzAj29o/qvm86p+0 +ACE3QFQeJExOvlxq851FWc3MCXYKMvq0ok5BoTkywdlGEnjHaZJ9HFYEBeOW5XfqdBm RzZ/mdWiER8m+mfqGz0CPOjyKC6zRhsAQKheLCOUj7iMGU79EDRnOEtU+rljiXZ89xAC ZfvA== 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=oTtwt0/lj7hRBmFtYNxeRUbR176hK69FIugX9GsRDsg=; b=Hli7nYHXNw4GFX76SAiPwPTcmS3Kcj0bmDsV+Ef0dhGc46S3KOVKFaIwdnnn/md8nN mCIDJpRgtPilbh5meIswQwHB0j5jlsJv0BSTQKCEHeWXbyF6wHtnagg87IVyAuCcTo02 crFvBhwPXFGwJjsAwUHOF2L2cmPPw+sSS0hMhe2HLI3LMkZmo0S2HN21YX1OAkzI3pJj vurlVGq6PixfM0HPx7MZvIG8mAfdjdilRB/fx69cWrf8XEAEHzJtOVAYleC5FPJOw42L VrNWbUznMzbxV2gaz7JuHzHdBm6eELL+Yyri84XMI6WJXmpNuh4jVr+1QLrYR9A6GZgv xaUg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=RU4sxfZU; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id gr1-20020a170906e2c100b00782069599b8si11780345ejb.379.2022.10.18.17.14.05; Tue, 18 Oct 2022 17:14:31 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=RU4sxfZU; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229687AbiJRXjC (ORCPT + 99 others); Tue, 18 Oct 2022 19:39:02 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60986 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229520AbiJRXjB (ORCPT ); Tue, 18 Oct 2022 19:39:01 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 783D7C8209 for ; Tue, 18 Oct 2022 16:38:59 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id D90E2B8218A for ; Tue, 18 Oct 2022 23:38:57 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 31A61C433C1; Tue, 18 Oct 2022 23:38:56 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1666136336; bh=esm08ZulWwZ80WMHJ6WXGV+D01NZx6TnxbzZ8V0xbFQ=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=RU4sxfZU6VWLNJWMi2463MZILGF+3y9ghSy3+WCddc4NvggJshJFs5LIaZdNgu74K Tvfv4JuOtLZnRdoLSA6QtMpY4skIWOQTNttItNhhTxlzJ8vjOW7yv5D59CJjyKhmME M4lzxopDiWwE5QHD+hRH7HPk8EdimkM7lva1sOC5WukLc/FMFqbP2ATaZYZqQ81GJ3 2I8pf5DwEgSY4rXFH6OivXIg1L1KhwYRE8Tf45xCDK2+URu0DulDZIbsn9vOs7iRyf cUDoEgy8jG1we5Trw0FOW+FKcFpB0qJAf8S0/8fCaMp9tdKx1kdWZoge052puqj+Sb z8a4u5xOL9uYQ== Date: Tue, 18 Oct 2022 16:38:54 -0700 From: Josh Poimboeuf To: Peter Zijlstra Cc: x86@kernel.org, Kees Cook , Sami Tolvanen , Joao Moreira , linux-kernel@vger.kernel.org, Mark Rutland , Josh Poimboeuf Subject: Re: [PATCH] x86/ibt: Implement FineIBT Message-ID: <20221018233854.qj3vrdxsnc6ds7qs@treble> References: MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: X-Spam-Status: No, score=-7.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, Oct 18, 2022 at 03:35:50PM +0200, Peter Zijlstra wrote: > > Implement an alternative CFI scheme that merges both the fine-grained > nature of kCFI but also takes full advantage of the coarse grained > hardware CFI as provided by IBT. > > To contrast: > > kCFI is a pure software CFI scheme and relies on being able to read > text -- specifically the instruction *before* the target symbol, and > does the hash validation *before* doing the call (otherwise control > flow is compromised already). > > FineIBT is a software and hardware hybrid scheme; by ensuring every > branch target starts with a hash validation it is possible to place > the hash validation after the branch. This has several advantages: > > o the (hash) load is avoided; no memop; no RX requirement. > > o IBT WAIT-FOR-ENDBR state is a speculation stop; by placing > the hash validation in the immediate instruction after > the branch target there is a minimal speculation window > and the whole is a viable defence against SpectreBHB. > > Obviously this patch relies on kCFI (upstream), but additionally it also > relies on the padding from the call-depth-tracking patches > (tip/x86/core). It uses this padding to place the hash-validation while > the call-sites are re-written to modify the indirect target to be 16 > bytes in front of the original target, thus hitting this new preamble. Can the objtool changes be moved to a separate patch? The RFC was 11 patches, is it now much smaller because of the new dependencies? The RFC had some eBPF changes and a test module, are those no longer needed? -- Josh