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, 5 Jan 2017 10:46:30 -0800
From:   Linus Torvalds <torvalds@...ux-foundation.org>
To:     Peter Zijlstra <peterz@...radead.org>
Cc:     Srinivas Pandruvada <srinivas.pandruvada@...ux.intel.com>,
        Thomas Gleixner <tglx@...utronix.de>,
        Jiri Olsa <jolsa@...hat.com>,
        Dave Hansen <dave.hansen@...ux.intel.com>, davidcc@...gle.com,
        Linux Kernel Mailing List <linux-kernel@...r.kernel.org>,
        kan.liang@...el.com, Arnaldo Carvalho de Melo <acme@...hat.com>,
        Peter Anvin <hpa@...or.com>, Borislav Petkov <bp@...e.de>,
        Paul Turner <pjt@...gle.com>,
        Alexander Shishkin <alexander.shishkin@...ux.intel.com>,
        Stephane Eranian <eranian@...gle.com>,
        Ingo Molnar <mingo@...nel.org>,
        "linux-tip-commits@...r.kernel.org" 
        <linux-tip-commits@...r.kernel.org>
Subject: Re: [tip:perf/urgent] perf/x86: Set pmu->module in Intel PMU modules

On Thu, Jan 5, 2017 at 7:52 AM, Peter Zijlstra <peterz@...radead.org> wrote:
>
> The first time I saw this I thought about doing something like the
> below, but never got around to testing if that works and subsequently
> forgot about things again.
>
> Does this make sense and or work?

I'd argue against it.

It will "work", but it's fragile. In particular, if something ever
ends up using perf_pmu_register() through some indirect helper
function, it will do the wrong thing, because

> +#define perf_pmu_register(_pmu, _name, _type)                  \
> +({                                                             \
> +       (_pmu)->module = THIS_MODULE;                           \
> +       __perf_pmu_register((_pmu), (_name), (_type));          \
> +})

.. at that point "THIS_MODULE" could be the module that contains the
helper function that may not actually be the actual end-point module.

Looking at the situation right now, that never happens and all the
users seem to be "leaf" modules. But it would worry me a bit.

                Linus

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ