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: <20191116205310.GD23231@zn.tnic>
Date:   Sat, 16 Nov 2019 21:53:10 +0100
From:   Borislav Petkov <bp@...en8.de>
To:     Thomas Gleixner <tglx@...utronix.de>
Cc:     linux-tip-commits@...r.kernel.org,
        Thomas Gleixner <tglx@...utronix.de>,
        Ingo Molnar <mingo@...nel.org>,
        "Peter Zijlstra (Intel)" <peterz@...radead.org>,
        linux-kernel@...r.kernel.org
Subject: Re: [tip: locking/core] futex: Move futex exit handling into futex
 code

On Fri, Nov 15, 2019 at 06:19:20PM -0000, tip-bot2 for Thomas Gleixner wrote:
> The following commit has been merged into the locking/core branch of tip:
> 
> Commit-ID:     01e06025a2f81d7b797916a1b34731c6de0cf2e3
> Gitweb:        https://git.kernel.org/tip/01e06025a2f81d7b797916a1b34731c6de0cf2e3
> Author:        Thomas Gleixner <tglx@...utronix.de>
> AuthorDate:    Wed, 06 Nov 2019 22:55:36 +01:00
> Committer:     Thomas Gleixner <tglx@...utronix.de>
> CommitterDate: Fri, 15 Nov 2019 19:10:49 +01:00
> 
> futex: Move futex exit handling into futex code
> 
> The futex exit handling is #ifdeffed into mm_release() which is not pretty
> to begin with. But upcoming changes to address futex exit races need to add
> more functionality to this exit code.
> 
> Split it out into a function, move it into futex code and make the various
> futex exit functions static.
> 
> Preparatory only and no functional change.
> 
> Signed-off-by: Thomas Gleixner <tglx@...utronix.de>
> Reviewed-by: Ingo Molnar <mingo@...nel.org>
> Acked-by: Peter Zijlstra (Intel) <peterz@...radead.org>
> Link: https://lkml.kernel.org/r/20191106224556.049705556@linutronix.de
> 
> ---
>  include/linux/compat.h |  2 --
>  include/linux/futex.h  | 27 ++++++++++++++-------------
>  kernel/fork.c          | 25 +++----------------------
>  kernel/futex.c         | 33 +++++++++++++++++++++++++++++----
>  4 files changed, 46 insertions(+), 41 deletions(-)
> 
> diff --git a/include/linux/compat.h b/include/linux/compat.h
> index 16dafd9..c4c389c 100644
> --- a/include/linux/compat.h
> +++ b/include/linux/compat.h
> @@ -410,8 +410,6 @@ struct compat_kexec_segment;
>  struct compat_mq_attr;
>  struct compat_msgbuf;
>  
> -extern void compat_exit_robust_list(struct task_struct *curr);
> -
>  #define BITS_PER_COMPAT_LONG    (8*sizeof(compat_long_t))
>  
>  #define BITS_TO_COMPAT_LONGS(bits) DIV_ROUND_UP(bits, BITS_PER_COMPAT_LONG)
> diff --git a/include/linux/futex.h b/include/linux/futex.h
> index ccaef00..2ffbb9c 100644
> --- a/include/linux/futex.h
> +++ b/include/linux/futex.h
> @@ -48,15 +48,24 @@ union futex_key {
>  #define FUTEX_KEY_INIT (union futex_key) { .both = { .ptr = NULL } }
>  
>  #ifdef CONFIG_FUTEX
> -extern void exit_robust_list(struct task_struct *curr);
>  
> -long do_futex(u32 __user *uaddr, int op, u32 val, ktime_t *timeout,
> -	      u32 __user *uaddr2, u32 val2, u32 val3);
> -#else
> -static inline void exit_robust_list(struct task_struct *curr)
> +static inline void futex_init_task(struct task_struct *tsk)
>  {
> +	tsk->robust_list = NULL;
> +#ifdef CONFIG_COMPAT
> +	tsk->compat_robust_list = NULL;
> +#endif
> +	INIT_LIST_HEAD(&tsk->pi_state_list);
> +	tsk->pi_state_cache = NULL;
>  }

I don't see why it would happen besides maybe moving stuff around in the
headers would upset the include hell but I'm triggering this with the
attached randconfig:

---
In file included from <command-line>:
./include/linux/futex.h: In function ‘futex_init_task’:
./include/linux/futex.h:59:5: error: dereferencing pointer to incomplete type ‘struct task_struct’
  tsk->robust_list = NULL;
     ^~
./include/linux/futex.h:66:2: error: implicit declaration of function ‘mutex_init’; did you mean ‘tsc_init’? [-Werror=implicit-function-declaration]
  mutex_init(&tsk->futex_exit_mutex);
  ^~~~~~~~~~
  tsc_init
cc1: some warnings being treated as errors
make[1]: *** [scripts/Makefile.build:293: include/linux/futex.h.s] Error 1
make[1]: *** Waiting for unfinished jobs....
make: *** [Makefile:1652: include] Error 2
make: *** Waiting for unfinished jobs....

---

This seems to fix it:

---
diff --git a/include/linux/futex.h b/include/linux/futex.h
index 214284cc984e..025b44b6bdcf 100644
--- a/include/linux/futex.h
+++ b/include/linux/futex.h
@@ -3,6 +3,7 @@
 #define _LINUX_FUTEX_H
 
 #include <linux/ktime.h>
+#include <linux/sched.h>
 #include <uapi/linux/futex.h>
 
 struct inode;
---

HTH.

-- 
Regards/Gruss,
    Boris.

https://people.kernel.org/tglx/notes-about-netiquette

View attachment ".config" of type "text/plain" (162489 bytes)

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ