From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eu-smtp-delivery-151.mimecast.com (eu-smtp-delivery-151.mimecast.com [185.58.85.151]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id BDAD572 for ; Mon, 1 Nov 2021 09:36:37 +0000 (UTC) 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] Precedence: bulk X-Mailing-List: llvm@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: 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: quoted-printable 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. =09David. - Registered Address Lakeside, Bramley Road, Mount Farm, Milton Keynes, MK1 1= PT, UK Registration No: 1397386 (Wales)