Received: by 2002:a05:6a10:8c0a:0:0:0:0 with SMTP id go10csp2339800pxb; Fri, 5 Feb 2021 15:40:05 -0800 (PST) X-Google-Smtp-Source: ABdhPJxX6EXrSv7fJIsa7i9qipJNk15TANu9JpGdrVsMQC7qk90cy5Qp6PzI9OxnfZ0aYYQrZ2Rb X-Received: by 2002:a17:906:654d:: with SMTP id u13mr6461418ejn.530.1612568405375; Fri, 05 Feb 2021 15:40:05 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1612568405; cv=none; d=google.com; s=arc-20160816; b=ypDiWAZ2KgeMKlvd28rqDh6DNogZbVAl9n8xnZC+nE5eq4RnlhFtUZqiWnualJBauL MRVYxSYniufbtiFU4mP2w23tWq7f5L1FEpETwsh4S0xbRhkM0h9fa6puywPHWVFsdqeI 3Lae+fWP5kzz12rP5aV2AEnZsM9vyNyeOP+Ula3MCdrVP9zhWKsxeKw2HElQkgiRHlSr 95bZLZF3E5l4RSSH84iZUhq7jJ4KBeGXkgezo/Tkrs72FFnDgactCrLsuHAxd7MLFAOT mLVmFiu1GSWMIEKYgNJ50RJvkfnP0tQ9+nFFvRovZY7kTgqykytlzmWRH6Xvm2Ozu7Mw BwmA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=p8yliEbMqP3V4TzvseSTLJIbhTkc7zBiOssiRDK3Nzk=; b=cpDbEkvjv9I0mWaM64By/5HC+jV9KAziHMG+35bk+msvrGOA2OzP04CmMA+zzTjwso zYXOkbCD7diThmu+kktYaG6R+CBw7tzvOrST5TtRZ2vJ3WhTJ+xQPVUJrYR/Y1kboz2h jYbMzZoIoBxcJ+TQ3Axh92pDwS2nRp1NIcz+j1UOdCgPGF36BzbWwrvFAyle4QApfsDR 8K9tZ9hAEtZrNP0Zbfnbbq8VxAqpVEYiXQLwYDOSjPIw+yO4Sr+VVSlG0zD7IvwjLb6t 2Yjrzykux1z7XYWyPI5BvDvysRBbUUHnOMO16DhcAB0JO2I/dJZg0aeNMxPxMrwhf+TN lkUg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@infradead.org header.s=casper.20170209 header.b=uwYQHBNs; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id gq1si6064084ejb.675.2021.02.05.15.39.39; Fri, 05 Feb 2021 15:40:05 -0800 (PST) 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; dkim=pass header.i=@infradead.org header.s=casper.20170209 header.b=uwYQHBNs; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230400AbhBEXfX (ORCPT + 99 others); Fri, 5 Feb 2021 18:35:23 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41414 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232469AbhBEOWY (ORCPT ); Fri, 5 Feb 2021 09:22:24 -0500 Received: from casper.infradead.org (casper.infradead.org [IPv6:2001:8b0:10b:1236::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C51B8C06121C; Fri, 5 Feb 2021 07:59:51 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=casper.20170209; h=In-Reply-To:Content-Type:MIME-Version: References:Message-ID:Subject:Cc:To:From:Date:Sender:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description; bh=p8yliEbMqP3V4TzvseSTLJIbhTkc7zBiOssiRDK3Nzk=; b=uwYQHBNsUi+sKrXn/Gp+6afzBg Xns98RH8bmqXcEhJIa8XRSVjoGdo4DpAwHn3yNX/rJ73sh+V204eiqAmvwGalKgqkQAghHOGKBwjN R4Ben6HR849Yd+CPx466InoUjG3/6v6zyhQdt0gzl9V2xt3B9iLCLpEtK0F38gpMavuyO5bW7W0jt ZibdfTAwuLyk6woueT/BIt9iMEdBu7xEkgsboGf0JRhKjXh+ePIbupKU1bJQ4IarZyfibFDRNL4IY Cnt1B3Bg1gfsBKHmBd4wasZGMrJSXKg5kQYzQKEMUjTTz9CXlZ2GUK1kx+VIXf9YdBZKFlhXoNpyv sboo4gUw==; Received: from j217100.upc-j.chello.nl ([24.132.217.100] helo=noisy.programming.kicks-ass.net) by casper.infradead.org with esmtpsa (Exim 4.94 #2 (Red Hat Linux)) id 1l83DR-002Sec-9G; Fri, 05 Feb 2021 15:40:14 +0000 Received: from hirez.programming.kicks-ass.net (hirez.programming.kicks-ass.net [192.168.1.225]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by noisy.programming.kicks-ass.net (Postfix) with ESMTPS id 0DB8E3012DF; Fri, 5 Feb 2021 16:40:11 +0100 (CET) Received: by hirez.programming.kicks-ass.net (Postfix, from userid 1000) id EAD3D2BC43F6C; Fri, 5 Feb 2021 16:40:10 +0100 (CET) Date: Fri, 5 Feb 2021 16:40:10 +0100 From: Peter Zijlstra To: Mathieu Desnoyers Cc: Brendan Jackman , linux-kernel@vger.kernel.org, bpf@vger.kernel.org, linux-security-module@vger.kernel.org, Paul Renauld , Alexei Starovoitov , Daniel Borkmann , James Morris , pjt@google.com, jannh@google.com, rafael.j.wysocki@intel.com, keescook@chromium.org, thgarnie@chromium.org, kpsingh@google.com, paul.renauld.epfl@gmail.com, Brendan Jackman , rostedt@goodmis.org Subject: Re: [RFC] security: replace indirect calls with static calls Message-ID: References: <20200820164753.3256899-1-jackmanb@chromium.org> <20210205150926.GA12608@localhost> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20210205150926.GA12608@localhost> Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, Feb 05, 2021 at 10:09:26AM -0500, Mathieu Desnoyers wrote: > Then we should be able to generate the following using static keys as a > jump table and N static calls: > > jump > label_N: > stack setup > call > label_N-1: > stack setup > call > label_N-2: > stack setup > call > ... > label_0: > jump end > label_fallback: > > end: > > So the static keys would be used to jump to the appropriate label (using > a static branch, which has pretty much 0 overhead). Static calls would > be used to implement each of the calls. > > Thoughts ? At some point I tried to extend the static_branch infra to do multiple targets and while the low level plumbing is trivial, I ran into trouble trying to get a sane C level API for it.