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: <875yry9bia.mognet@arm.com>
Date:   Thu, 09 Dec 2021 13:02:53 +0000
From:   Valentin Schneider <valentin.schneider@....com>
To:     Steven Rostedt <rostedt@...dmis.org>
Cc:     linux-kernel@...r.kernel.org,
        Abhijeet Dharmapurikar <adharmap@...cinc.com>,
        Uwe Kleine-König 
        <u.kleine-koenig@...gutronix.de>,
        Dietmar Eggemann <dietmar.eggemann@....com>,
        Peter Zijlstra <peterz@...radead.org>,
        Ingo Molnar <mingo@...nel.org>,
        Vincent Guittot <vincent.guittot@...aro.org>,
        Thomas Gleixner <tglx@...utronix.de>,
        Sebastian Andrzej Siewior <bigeasy@...utronix.de>,
        Juri Lelli <juri.lelli@...hat.com>,
        Daniel Bristot de Oliveira <bristot@...hat.com>,
        Kees Cook <keescook@...omium.org>,
        Andrew Morton <akpm@...ux-foundation.org>
Subject: Re: [RFC PATCH 1/2] sched/tracing: Don't re-read p->state when emitting sched_switch event

On 08/12/21 15:12, Steven Rostedt wrote:
> On Mon, 29 Nov 2021 12:36:00 +0000
> Valentin Schneider <valentin.schneider@....com> wrote:
>
>> As of commit
>>
>>   c6e7bd7afaeb ("sched/core: Optimize ttwu() spinning on p->on_cpu")
>>
>> the following sequence becomes possible:
>>
>>                    p->__state = TASK_INTERRUPTIBLE;
>>                    __schedule()
>>                      deactivate_task(p);
>>   ttwu()
>>     READ !p->on_rq
>>     p->__state=TASK_WAKING
>>                      trace_sched_switch()
>>                        __trace_sched_switch_state()
>>                          task_state_index()
>>                            return 0;
>>
>> TASK_WAKING isn't in TASK_REPORT, so the task appears as TASK_RUNNING in
>> the trace event.
>>
>> Prevent this by pushing the value read from __schedule() down the trace
>> event.
>>
>> Reported-by: Abhijeet Dharmapurikar <adharmap@...cinc.com>
>> Signed-off-by: Valentin Schneider <valentin.schneider@....com>
>> ---
>>  include/linux/sched.h             | 11 ++++++++---
>>  include/trace/events/sched.h      | 11 +++++++----
>>  kernel/sched/core.c               |  4 ++--
>>  kernel/trace/fgraph.c             |  4 +++-
>>  kernel/trace/ftrace.c             |  4 +++-
>>  kernel/trace/trace_events.c       |  8 ++++++--
>>  kernel/trace/trace_sched_switch.c |  1 +
>
> I believe you may have missed some functions that register the sched_switch
> event. Do a git grep on register_trace_sched_switch.
>

Thanks! I'll wait a bit to see if anyone truly hates the idea and then will
patch those up.

> -- Steve
>
>
>>  7 files changed, 30 insertions(+), 13 deletions(-)
>>
>> diff --git a/include/linux/sched.h b/include/linux/sched.h
>> index d2e261adb8ea..d00837d12b9d 100644

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ