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] [thread-next>] [day] [month] [year] [list]
Date:   Thu, 26 Mar 2020 18:09:07 +0000
From:   Nadav Amit <namit@...are.com>
To:     Peter Zijlstra <peterz@...radead.org>
CC:     x86 <x86@...nel.org>, LKML <linux-kernel@...r.kernel.org>,
        "rostedt@...dmis.org" <rostedt@...dmis.org>,
        "mhiramat@...nel.org" <mhiramat@...nel.org>,
        "bristot@...hat.com" <bristot@...hat.com>,
        "jbaron@...mai.com" <jbaron@...mai.com>,
        "torvalds@...ux-foundation.org" <torvalds@...ux-foundation.org>,
        tglx <tglx@...utronix.de>, "mingo@...nel.org" <mingo@...nel.org>,
        "hpa@...or.com" <hpa@...or.com>, Andy Lutomirski <luto@...nel.org>,
        "ard.biesheuvel@...aro.org" <ard.biesheuvel@...aro.org>,
        "jpoimboe@...hat.com" <jpoimboe@...hat.com>
Subject: Re: [RESEND][PATCH v3 06/17] static_call: Add basic static call
 infrastructure

> On Mar 26, 2020, at 10:01 AM, Peter Zijlstra <peterz@...radead.org> wrote:
> 
> On Thu, Mar 26, 2020 at 04:42:07PM +0000, Nadav Amit wrote:
>>> On Mar 24, 2020, at 6:56 AM, Peter Zijlstra <peterz@...radead.org> wrote:
> 
>>> + * API overview:
>>> + *
>>> + *   DECLARE_STATIC_CALL(name, func);
>>> + *   DEFINE_STATIC_CALL(name, func);
>>> + *   static_call(name)(args...);
>>> + *   static_call_update(name, func);
>>> + *
>>> + * Usage example:
>>> + *
>>> + *   # Start with the following functions (with identical prototypes):
>>> + *   int func_a(int arg1, int arg2);
>>> + *   int func_b(int arg1, int arg2);
>>> + *
>>> + *   # Define a 'my_name' reference, associated with func_a() by default
>>> + *   DEFINE_STATIC_CALL(my_name, func_a);
>> 
>> Do you want to support optional function attributes, such as “pure” and
>> “const”?
> 
> Do you see a need for that? And what is the syntax for a pointer to a
> pure function?

I think that the kernel underutilizes the pure attribute in general.
Building it with "-Wsuggest-attribute=pure” results in many warnings.
Function pointers such kvm_x86_ops.get_XXX() could have been candidates to
use the “pure” attribute.

The syntax is what you would expect:

  static void __attribute__((pure))(*ptr)(void);

However, you have a point, gcc does not appear to respect “pure” for
function pointers and emits a warning it is ignored. GCC apparently only
respects “const”. In contrast clang appears to respect the pure attribute
for function pointers.

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ