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]
Message-ID: <c6852cb4-a929-2f42-bfcd-04c4aa99b4a5@gmail.com>
Date:   Fri, 4 Nov 2022 10:38:02 -0700
From:   Florian Fainelli <f.fainelli@...il.com>
To:     Peter Zijlstra <peterz@...radead.org>
Cc:     linux-kernel@...r.kernel.org, anand.gore@...adcom.com,
        william.zhang@...adcom.com, Ingo Molnar <mingo@...hat.com>,
        Arnaldo Carvalho de Melo <acme@...nel.org>,
        Mark Rutland <mark.rutland@....com>,
        Alexander Shishkin <alexander.shishkin@...ux.intel.com>,
        Jiri Olsa <jolsa@...nel.org>,
        Namhyung Kim <namhyung@...nel.org>,
        Anna-Maria Gleixner <anna-maria@...utronix.de>,
        Sebastian Siewior <bigeasy@...utronix.de>,
        Thomas Gleixner <tglx@...utronix.de>,
        "open list:PERFORMANCE EVENTS SUBSYSTEM" 
        <linux-perf-users@...r.kernel.org>
Subject: Re: [PATCH] perf: Fix perf_event_{init,exit}_cpu stubs



On 11/4/2022 6:06 AM, Peter Zijlstra wrote:
> On Thu, Nov 03, 2022 at 03:43:03PM -0700, Florian Fainelli wrote:
>> The original commit that introduced those stubs was already at fault,
>> but in the absence of a caller of perf_event_{init,exit}_cpu outside of
>> code that is compiled regardless of CONFIG_PERF_EVENTS, the build
>> failure cannot be observed. This was observed with the Android kernel to
>> produce a build failure similar to this:
>>
>>      In file included from ./include/uapi/linux/posix_types.h:5,
>>                       from ./include/uapi/linux/types.h:14,
>>                       from ./include/linux/types.h:6,
>>                       from ./include/linux/limits.h:6,
>>                       from ./include/linux/kernel.h:7,
>>                       from ./include/linux/sched/mm.h:5,
>>                       from kernel/cpu.c:6:
>>      kernel/cpu.c: In function 'random_and_perf_prepare_fusion':
>>      ./include/linux/stddef.h:8:14: error: called object is not a function or function pointer
>>       #define NULL ((void *)0)
>>                    ^
>>      ./include/linux/perf_event.h:1607:29: note: in expansion of macro 'NULL'
>>       #define perf_event_init_cpu NULL
>>                                   ^~~~
>>      kernel/cpu.c:1686:2: note: in expansion of macro 'perf_event_init_cpu'
>>        perf_event_init_cpu(cpu);
>>        ^~~~~~~~~~~~~~~~~~~
> 
> What is the actual problem reported here? Did you see all the other NULL
> assignments in cpuhp_hp_states ?

Anand reported to me that the following downstream commit in the Android 
common kernel repository:

https://android.googlesource.com/kernel/common/+/ca927bd22ad8bd26fd8dcebf3c7f2a093385d8ea

was resulting in the build failure above.

While this is an Android inflicted change and I still intend to get a 
fix there, upon closer look, the build failure could be experienced 
upstream as well with any code calling perf_event_{init,exit}_cpu() as a 
regular function call as opposed to being used as a function pointer.

This felt worthy of fixing in the upstream kernel, hence this patch.
-- 
Florian

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ