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 mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id C7EB8C433F5 for ; Mon, 1 Nov 2021 09:38:50 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id B154C60187 for ; Mon, 1 Nov 2021 09:38:50 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232629AbhKAJlR convert rfc822-to-8bit (ORCPT ); Mon, 1 Nov 2021 05:41:17 -0400 Received: from eu-smtp-delivery-151.mimecast.com ([185.58.85.151]:60072 "EHLO eu-smtp-delivery-151.mimecast.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231830AbhKAJjO (ORCPT ); Mon, 1 Nov 2021 05:39:14 -0400 Received: from AcuMS.aculab.com (156.67.243.121 [156.67.243.121]) (Using TLS) by relay.mimecast.com with ESMTP id uk-mta-234-XozaET42MpedHXy8zfaPCg-1; Mon, 01 Nov 2021 09:36:34 +0000 X-MC-Unique: XozaET42MpedHXy8zfaPCg-1 Received: from AcuMS.Aculab.com (fd9f:af1c:a25b:0:994c:f5c2:35d6:9b65) by AcuMS.aculab.com (fd9f:af1c:a25b:0:994c:f5c2:35d6:9b65) with Microsoft SMTP Server (TLS) id 15.0.1497.24; Mon, 1 Nov 2021 09:36:32 +0000 Received: from AcuMS.Aculab.com ([fe80::994c:f5c2:35d6:9b65]) by AcuMS.aculab.com ([fe80::994c:f5c2:35d6:9b65%12]) with mapi id 15.00.1497.024; Mon, 1 Nov 2021 09:36:32 +0000 From: David Laight To: 'Peter Zijlstra' , Ard Biesheuvel CC: Sami Tolvanen , Mark Rutland , X86 ML , Kees Cook , Josh Poimboeuf , "Nathan Chancellor" , Nick Desaulniers , Sedat Dilek , Steven Rostedt , "linux-hardening@vger.kernel.org" , "Linux Kernel Mailing List" , "llvm@lists.linux.dev" Subject: RE: [PATCH] static_call,x86: Robustify trampoline patching Thread-Topic: [PATCH] static_call,x86: Robustify trampoline patching Thread-Index: AQHXzv/P+Rz8ZcLBT06sRWcPs/oqcKvuZWlw Date: Mon, 1 Nov 2021 09:36:32 +0000 Message-ID: References: <20211030180249.GU174703@worktop.programming.kicks-ass.net> <20211031163920.GV174703@worktop.programming.kicks-ass.net> <20211101090155.GW174703@worktop.programming.kicks-ass.net> In-Reply-To: <20211101090155.GW174703@worktop.programming.kicks-ass.net> Accept-Language: en-GB, en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-ms-exchange-transport-fromentityheader: Hosted x-originating-ip: [10.202.205.107] MIME-Version: 1.0 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=C51A453 smtp.mailfrom=david.laight@aculab.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: aculab.com Content-Language: en-US Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8BIT Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Peter Zijlstra > Sent: 01 November 2021 09:02 .. > In any case, I really want the discussion to start at square one, and > show/explain why any chosen CFI scheme is actually good for the kernel. > Just because clang happened to have implemented it, doesn't make it the > most suitable scheme for the kernel. How much overhead does it add to write("/dev/null", "", 1) ? You've two large jump tables. One for the syscall entry - (all the syscalls have the same prototype), and a second for selecting the correct device driver's 'write' entry point. You really don't want to be doing any kind of search. Hardware that supported a (say) 16-bit constant in both the 'landing pad' and call indirect instruction and trapped if they differed would be useful - but I doubt any hardware that checks landing pads is anywhere near that useful. David. - Registered Address Lakeside, Bramley Road, Mount Farm, Milton Keynes, MK1 1PT, UK Registration No: 1397386 (Wales)