linux-security-module.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
To: Peter Zijlstra <peterz@infradead.org>
Cc: Brendan Jackman <jackmanb@chromium.org>,
	linux-kernel <linux-kernel@vger.kernel.org>,
	bpf <bpf@vger.kernel.org>,
	linux-security-module <linux-security-module@vger.kernel.org>,
	Paul Renauld <renauld@google.com>,
	Alexei Starovoitov <ast@kernel.org>,
	Daniel Borkmann <daniel@iogearbox.net>,
	James Morris <jmorris@namei.org>, Paul Turner <pjt@google.com>,
	Jann Horn <jannh@google.com>,
	"Rafael J. Wysocki" <rafael.j.wysocki@intel.com>,
	Kees Cook <keescook@chromium.org>,
	thgarnie@chromium.org, kpsingh@google.com,
	paul renauld epfl <paul.renauld.epfl@gmail.com>,
	Brendan Jackman <jackmanb@google.com>,
	rostedt <rostedt@goodmis.org>
Subject: Re: [RFC] security: replace indirect calls with static calls
Date: Fri, 5 Feb 2021 10:47:23 -0500 (EST)	[thread overview]
Message-ID: <47845502.8614.1612540043986.JavaMail.zimbra@efficios.com> (raw)
In-Reply-To: <YB1m2i6bUM0LO5wS@hirez.programming.kicks-ass.net>

----- On Feb 5, 2021, at 10:40 AM, Peter Zijlstra peterz@infradead.org wrote:

> 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 <static key label target>
>> label_N:
>>   stack setup
>>   call
>> label_N-1:
>>   stack setup
>>   call
>> label_N-2:
>>   stack setup
>>   call
>>   ...
>> label_0:
>>   jump end
>> label_fallback:
>>   <iteration and indirect calls>
>> 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.

Did you try doing an API for a variable number of targets, or was it for
a specific number of targets ? It might be easier to just duplicate some
of the API code for number of targets between 2 and 12, and let the
users code choose the maximum number of targets they want to accelerate.

Thanks,

Mathieu


-- 
Mathieu Desnoyers
EfficiOS Inc.
http://www.efficios.com

      reply	other threads:[~2021-02-05 22:28 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-08-20 16:47 [RFC] security: replace indirect calls with static calls Brendan Jackman
2020-08-20 18:43 ` James Morris
2020-08-20 19:04   ` KP Singh
2020-08-20 21:45 ` Kees Cook
2020-08-24 14:09   ` Brendan Jackman
2020-08-24 14:33     ` Peter Zijlstra
2020-08-24 15:05       ` Brendan Jackman
2020-08-20 22:46 ` Casey Schaufler
2020-08-24 15:20   ` Brendan Jackman
2020-08-24 16:42     ` Casey Schaufler
2020-08-24 17:04       ` Brendan Jackman
2020-08-24 17:54         ` Casey Schaufler
2021-02-05 15:09 ` Mathieu Desnoyers
2021-02-05 15:40   ` Peter Zijlstra
2021-02-05 15:47     ` Mathieu Desnoyers [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=47845502.8614.1612540043986.JavaMail.zimbra@efficios.com \
    --to=mathieu.desnoyers@efficios.com \
    --cc=ast@kernel.org \
    --cc=bpf@vger.kernel.org \
    --cc=daniel@iogearbox.net \
    --cc=jackmanb@chromium.org \
    --cc=jackmanb@google.com \
    --cc=jannh@google.com \
    --cc=jmorris@namei.org \
    --cc=keescook@chromium.org \
    --cc=kpsingh@google.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-security-module@vger.kernel.org \
    --cc=paul.renauld.epfl@gmail.com \
    --cc=peterz@infradead.org \
    --cc=pjt@google.com \
    --cc=rafael.j.wysocki@intel.com \
    --cc=renauld@google.com \
    --cc=rostedt@goodmis.org \
    --cc=thgarnie@chromium.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).