Received: by 2002:a05:6358:111d:b0:dc:6189:e246 with SMTP id f29csp3032393rwi; Tue, 1 Nov 2022 15:06:48 -0700 (PDT) X-Google-Smtp-Source: AMsMyM7w8jor3fWuv5zTzDOjvJTVOavJJ/UiXwOqhQOq+lvXzh/L2PxFnWpCeIqBXmi4/sR4jc3X X-Received: by 2002:a05:6402:28b5:b0:461:c6e9:8cc with SMTP id eg53-20020a05640228b500b00461c6e908ccmr21308557edb.170.1667340408270; Tue, 01 Nov 2022 15:06:48 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1667340408; cv=none; d=google.com; s=arc-20160816; b=uHl/6QzpAeq6VZXuU312vVjw7OJvyp/PtEt809rgAArpSwJ2kx3eH4SCRuCC0LCnAX dye29axQVlOqfydo+ENoamYHvCVy1zw3VFUfi5igJxSeT5seCeNB4S/CrhMj05liPDp3 bIKFvpELqKdX3paRkTSdQ4SRF4kMYt3ZSpQT/qa8K/s68dZz5FLyvA5nGyhewWK/NloY pxag/auKif7U4lESoBWfoTv2c8BO3I3YcI2dSiTBdHCh4p7rPPHk55rqmDRnLlOyHQ8N 1Mk3mH/2pxVi809Q1fLHvLpLgKCVOjbnjJVkubMTUiT85LAXzc6Ab0GNpodmBPxWYEvo Ub3g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:message-id:references :in-reply-to:subject:cc:to:from:date:mime-version; bh=y7GpN1n3sRkpCg3mMdwYvK6IihMZI6XVKf1HUWu0v9g=; b=aQawawEHsYbKWZl/aARNFPhESTbow+C24zSI0YJ6UzutRvgZuEAfB8MuqYTx3r3ZJ5 EP/+UG/Q9+yNojqx3tW0LQ2Ru3JZ4EaC8jmDEQxwMvEmQeWweRuZ5oHF9B7ei0hPqdJo 0n7TxR03j1ElXd2EX1HuDYN/0ov/iTUrpsO3RrQ+X7mz3thGK8vgnhjFPItfvyfxxFDc zbBPH+k1eKiN1RDeVgD70uK74wIDqEV0sV8yAGpmDdT00wiLrx3XGRfiVL4oF0DQ6nuc DBrBQrogPpOFYbUEXnTEt5TaWD7Kb46omB9oJdJI+O7/2xdyXfoperANtrF0JVQyNZoP nsRQ== ARC-Authentication-Results: i=1; mx.google.com; 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 Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id b11-20020a170906708b00b007801a197a1bsi9746601ejk.449.2022.11.01.15.06.23; Tue, 01 Nov 2022 15:06:48 -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; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230184AbiKAVu3 (ORCPT + 97 others); Tue, 1 Nov 2022 17:50:29 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:32920 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229964AbiKAVu1 (ORCPT ); Tue, 1 Nov 2022 17:50:27 -0400 Received: from relay10.mail.gandi.net (relay10.mail.gandi.net [IPv6:2001:4b98:dc4:8::230]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id EDD8F26E5 for ; Tue, 1 Nov 2022 14:50:25 -0700 (PDT) Received: (Authenticated sender: joao@overdrivepizza.com) by mail.gandi.net (Postfix) with ESMTPA id 0AA9E240006; Tue, 1 Nov 2022 21:50:22 +0000 (UTC) MIME-Version: 1.0 Date: Tue, 01 Nov 2022 14:50:22 -0700 From: Joao Moreira To: Kees Cook Cc: Peter Zijlstra , x86@kernel.org, Sami Tolvanen , linux-kernel@vger.kernel.org, Mark Rutland , Josh Poimboeuf Subject: Re: [PATCH] x86/ibt: Implement FineIBT In-Reply-To: <202211011437.F82B61B8C@keescook> References: <202210181020.79AF7F7@keescook> <202210182218.56AD2871@keescook> <202211011437.F82B61B8C@keescook> Message-ID: <1f6069657f4630c36d60baab2e9b3d10@overdrivepizza.com> X-Sender: joao@overdrivepizza.com Content-Type: text/plain; charset=US-ASCII; format=flowed Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-2.6 required=5.0 tests=BAYES_00,RCVD_IN_DNSWL_LOW, 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 2022-11-01 14:39, Kees Cook wrote: > On Mon, Oct 31, 2022 at 12:13:50PM -0700, Joao Moreira wrote: >> On 2022-10-18 22:19, Kees Cook wrote: >> > On Tue, Oct 18, 2022 at 09:48:42PM -0700, Joao Moreira wrote: >> > > > > Is it useful to get the compiler to emit 0xcc with >> > > > > -fpatchable-function-entry under any circumstance? I can probably >> > > > > change >> > > > > that quickly if needed/useful. >> > > > >> > > > Having it emit 0xcc for the bytes in front of the symbol might be >> > > > interesting. It would mean a few kernel changes, but nothing too hard. >> >> Should I push for this within clang? I have the patch semi-ready >> (below) and >> would have some cycles this week for polishing it. > > Sure! While the NOP vs CC issue isn't very interesting when IBT is > available, it's nice for non-IBT to make attackers have to target > addresses precisely. > > If it's really invasive or hard to maintain in Clang (or objtool), > then I'd say leave it as-is. The Clang implementation is actually quite simple and, IIRC, I heard in the past someone mentioning that trapping instructions actually provide benefits for holding undesired straight-line speculation. Maybe someone can comment on that, or even if that is really relevant. Meanwhile I'll work on pushing it then.