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:   Sat, 22 Apr 2023 12:36:18 +0200
From:   Peter Zijlstra <peterz@...radead.org>
To:     John Stultz <jstultz@...gle.com>
Cc:     LKML <linux-kernel@...r.kernel.org>,
        Juri Lelli <juri.lelli@...hat.com>,
        Joel Fernandes <joelaf@...gle.com>,
        Qais Yousef <qyousef@...gle.com>,
        Ingo Molnar <mingo@...hat.com>,
        Vincent Guittot <vincent.guittot@...aro.org>,
        Dietmar Eggemann <dietmar.eggemann@....com>,
        Valentin Schneider <vschneid@...hat.com>,
        Steven Rostedt <rostedt@...dmis.org>,
        Ben Segall <bsegall@...gle.com>,
        Zimuzo Ezeozue <zezeozue@...gle.com>,
        Mel Gorman <mgorman@...e.de>,
        Daniel Bristot de Oliveira <bristot@...hat.com>,
        Will Deacon <will@...nel.org>,
        Waiman Long <longman@...hat.com>,
        Boqun Feng <boqun.feng@...il.com>,
        "Paul E . McKenney" <paulmck@...nel.org>,
        Valentin Schneider <valentin.schneider@....com>,
        Connor O'Brien <connoro@...gle.com>
Subject: Re: [PATCH v3 06/14] locking/mutex: Expose mutex_owner()

On Tue, Apr 11, 2023 at 04:25:03AM +0000, John Stultz wrote:

>  include/linux/mutex.h  | 2 ++
>  kernel/locking/mutex.c | 5 +++++
>  2 files changed, 7 insertions(+)
> 
> diff --git a/include/linux/mutex.h b/include/linux/mutex.h
> index 8f226d460f51..ebdc59cb0bf6 100644
> --- a/include/linux/mutex.h
> +++ b/include/linux/mutex.h
> @@ -118,6 +118,8 @@ do {									\
>  extern void __mutex_init(struct mutex *lock, const char *name,
>  			 struct lock_class_key *key);
>  
> +extern struct task_struct *mutex_owner(struct mutex *lock);
> +
>  /**
>   * mutex_is_locked - is the mutex locked
>   * @lock: the mutex to be queried
> diff --git a/kernel/locking/mutex.c b/kernel/locking/mutex.c
> index 45f1b7519f63..cbc34d5f4486 100644
> --- a/kernel/locking/mutex.c
> +++ b/kernel/locking/mutex.c
> @@ -81,6 +81,11 @@ static inline struct task_struct *__mutex_owner(struct mutex *lock)
>  	return (struct task_struct *)(atomic_long_read(&lock->owner) & ~MUTEX_FLAGS);
>  }
>  
> +struct task_struct *mutex_owner(struct mutex *lock)
> +{
> +	return __mutex_owner(lock);
> +}
> +
>  static inline struct task_struct *__owner_task(unsigned long owner)
>  {
>  	return (struct task_struct *)(owner & ~MUTEX_FLAGS);


Urgh, no.

It exposes mutex_owner() far wider than it should be, and also it turns
what should be a simple load into a function call :/

Looking at the lastest patches I have here this used to be an inline in
kernel/locking/mutex.h and kernel/sched/core.c got to #include
"../locking/mutex.h".

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ