lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <6C3BA76B-6C03-470E-91DB-3228A912F315@vmware.com>
Date:   Wed, 12 Dec 2018 21:45:53 +0000
From:   Nadav Amit <namit@...are.com>
To:     Edward Cree <ecree@...arflare.com>
CC:     Josh Poimboeuf <jpoimboe@...hat.com>,
        LKML <linux-kernel@...r.kernel.org>,
        "x86@...nel.org" <x86@...nel.org>, Paolo Abeni <pabeni@...hat.com>
Subject: Re: [PATCH v2 0/4] Static calls

> On Dec 12, 2018, at 1:36 PM, Edward Cree <ecree@...arflare.com> wrote:
> 
> On 12/12/18 21:15, Nadav Amit wrote:
>>> On Dec 12, 2018, at 10:33 AM, Edward Cree <ecree@...arflare.com> wrote:
>>> 
>>> AIUI the outline version uses a tail-call (i.e. jmpq *target) rather than an
>>> additional call and ret.  So I wouldn't expect it to be too expensive.
>>> More to the point, it seems like it's easier to get right than the inline
>>> version, and if we get the inline version working later we can introduce it
>>> without any API change, much as Josh's existing patches have both versions
>>> behind a Kconfig switch.
>> I see. For my outlined blocks I used the opposite approach - a call followed
>> by jmp
> That's what Josh did too.  I.e. caller calls the trampoline, which jmps to the
>  callee; later it rets, taking it back to the caller.  Perhaps I wasn't clear.
> The point is that there's still only one call and one ret.

Sorry for the misunderstanding.

> 
>>> I was working on the assumption that it would be opt-in, wrapping a macro
>>> around indirect calls that are known to have a fairly small number of hot
>>> targets.  There are plenty of indirect calls in the kernel that are only
>>> called once in a blue moon, e.g. in control-plane operations like ethtool;
>>> we don't really need to bulk up .text with trampolines for all of them.
>> On the other hand, I’m not sure the static_call interface is so intuitive.
>> And extending it into “dynamic_call” might be even worse. As I initially
>> used an opt-in approach, I can tell you that it was very exhausting.
> Well, if it's done with a gcc plugin after all, then it wouldn't be too hard
>  to make it opt-out.
> One advantage of the explicit opt-in dynamic_call, though, which can be seen
>  in my patch is that multiple call sites can share the same learning-state,
>  if they're expected to call the same set of functions.  An opt-out approach
>  would automatically give each indirect call statement its own individual BTB.
> Either way, I think the question is orthogonal to what the trampolines
>  themselves look like (and even to the inline vs outline question).

Not entirely. If the mechanism is opt-out and outlined, and especially if it
also supports multiple targets, you may not want to allocate all the memory
for them during build-time, and instead use module memory to allocate them
dynamically (that’s what we did).

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ