[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <47845502.8614.1612540043986.JavaMail.zimbra@efficios.com>
Date: Fri, 5 Feb 2021 10:47:23 -0500 (EST)
From: Mathieu Desnoyers <mathieu.desnoyers@...icios.com>
To: Peter Zijlstra <peterz@...radead.org>
Cc: Brendan Jackman <jackmanb@...omium.org>,
linux-kernel <linux-kernel@...r.kernel.org>,
bpf <bpf@...r.kernel.org>,
linux-security-module <linux-security-module@...r.kernel.org>,
Paul Renauld <renauld@...gle.com>,
Alexei Starovoitov <ast@...nel.org>,
Daniel Borkmann <daniel@...earbox.net>,
James Morris <jmorris@...ei.org>, Paul Turner <pjt@...gle.com>,
Jann Horn <jannh@...gle.com>,
"Rafael J. Wysocki" <rafael.j.wysocki@...el.com>,
Kees Cook <keescook@...omium.org>, thgarnie@...omium.org,
kpsingh@...gle.com,
paul renauld epfl <paul.renauld.epfl@...il.com>,
Brendan Jackman <jackmanb@...gle.com>,
rostedt <rostedt@...dmis.org>
Subject: Re: [RFC] security: replace indirect calls with static calls
----- On Feb 5, 2021, at 10:40 AM, Peter Zijlstra peterz@...radead.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
Powered by blists - more mailing lists