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 Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 582E0C4332F for ; Tue, 1 Nov 2022 21:50:32 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230193AbiKAVu3 (ORCPT ); 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 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.