Received: by 2002:a05:6a10:5bc5:0:0:0:0 with SMTP id os5csp2828410pxb; Mon, 1 Nov 2021 02:40:53 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwUPIXMHjfcsJfxGCcVRshWgpoL7frl/kpnX7p7PQHpvHmNR40S/ouCEHVUOSa0j9qK9DUQ X-Received: by 2002:a05:6638:29b:: with SMTP id c27mr4026571jaq.67.1635759653181; Mon, 01 Nov 2021 02:40:53 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1635759653; cv=none; d=google.com; s=arc-20160816; b=zIxsOQ1zl9t/ES6zs1WvU3+UjHMArQe7tHSF4CF9jcR9bCxqhuibYOCqUR0C5N2Xyk cfkuyXM6pNwdgG2Ftms6HQrcjLY3wa451lZV6MaPWIsBD/NGVbXzktTruQBVyVPgFBIR 83ptIPMg6C7/Vo5rkBZWT1IqP7k0kjGPGJqBoyx6gkq9BbAa4r+mgIrB4fzk62YCnt1f 82m25aHRO1WgL3IH11WF3tb+yLsYGGbn3P6694fEMm9Jy+dVP29Vnj0Y94RoiXnfmLXl PF+m6W4NJFZTFI1aQ0ituXoA7FVaU46/Qg66VefvprQsYXQ0E3kUtzLkWplXPyxcY8RB idmQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:content-language :mime-version:accept-language:in-reply-to:references:message-id:date :thread-index:thread-topic:subject:cc:to:from; bh=0K5ve6ZL/cwe1g6ZHkysrAIRfOmM1kXOHJqqryIV/bY=; b=IWQdDgraKcosdazcaiPToXVymPQ4GqZwlqiUyaJve/FCm2+e9w83aCXMPZ69KqNHK8 /M5B4CvbEv7buljtQrl3DjFT9jjEyOIIA5vWdgkR02GV1eEGDu359AJzP5mcro3oklMl 0PLv+P81Q702/cqJjnPJmF7GQOElSdbv8Cecf8q3rov2AzegpU6wzwUwlAlOb+ytoqvV TfeglUVW9B6lp52lRk7SuQIzl9KE4oTC/7QjC/rGckCTtTb2lJf9euwsIvNjj/SvaN3s ljWYLBHtzyEaC5VFsNTDWYa0lftnEojyWKM07I49H/KtJyGWc38F7GOxJaUNUgzxrXZw 29gg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=aculab.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id l8si3301045jaj.73.2021.11.01.02.40.42; Mon, 01 Nov 2021 02:40:53 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=aculab.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232533AbhKAJlQ convert rfc822-to-8bit (ORCPT + 99 others); Mon, 1 Nov 2021 05:41:16 -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)