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: <20170308101118.GA6775@gmail.com>
Date:   Wed, 8 Mar 2017 11:11:18 +0100
From:   Ingo Molnar <mingo@...nel.org>
To:     Linus Torvalds <torvalds@...ux-foundation.org>
Cc:     Linux Kernel Mailing List <linux-kernel@...r.kernel.org>,
        Peter Zijlstra <a.p.zijlstra@...llo.nl>,
        Thomas Gleixner <tglx@...utronix.de>,
        Andrew Morton <akpm@...ux-foundation.org>
Subject: [PATCH -v2] sched/wait: Add <linux/sched/signal.h> dependency for now


* Ingo Molnar <mingo@...nel.org> wrote:

> I'll do more testing over the day to see how well this approach works. Not yet 
> signed off by me. I'll post updated versions over the day if there's any 
> changes.
> 
> This removes the time pressure to untangle the wait.h mess for v4.11.

I've completed a full [allno|def|allmod|allyes]config test on x86, plus 
[allno|def]config builds on 20+ architectures, and beyond a single obvious
Alpha build fix, the patch held up pretty well.

So if we can live with the ugliness temporarily, this approach might work as a 
stop-gap measure. I'll push out the patch to get the various build bots active
as well.

I've attached -v2 below.

Also as a test I removed the <linux/sched/signal.h> from fs/overlayfs/util.c, and 
the build failure you saw originally does not trigger anymore.

Since I'm not aware of this particular dependency bug having appeared in anything 
else but the overlayfs bug you worked around in the merge window (there's some 
pending build fixes but they are unrelated), I could also wait for a linux-next 
test iteration to get more cross-arch build coverage of this patch and send this 
fix to you in about two days.

But feel free to apply it from email as well.

Thoughts?

Thanks,

	Ingo

====================>
>From 65eb2b3976f1b78563a8be7120c7fe3de27a1258 Mon Sep 17 00:00:00 2001
From: Ingo Molnar <mingo@...nel.org>
Date: Wed, 8 Mar 2017 09:42:52 +0100
Subject: [PATCH] sched/wait: Add <linux/sched/signal.h> dependency for now

The wait_event_interruptible*() APIs are using signal_pending(), so
include its header to not build-break users of those APIs.

Note that this is overkill as most wait_event*() users don't care
about signals - but solving that problem turned out to be more
complex.

Note two dependency quirks:

- the <linux/sched/signal.h> include line needs to be last in
  wait.h, because that header itself depends on wait-queue types.

- we shouldn't include cred.h from sched/signal.h, because cred.h is
  a complex header that will create a circular dependency if we do so.
  Instead we include wait.h to gain the waitqueue types, plus we
  predeclare 'struct cred' for a function prototype.

Note that the cred.h change has some knock-on effects.

Reported-by: Linus Torvalds <torvalds@...ux-foundation.org>
Cc: Peter Zijlstra <peterz@...radead.org>
Cc: Thomas Gleixner <tglx@...utronix.de>
Cc: linux-kernel@...r.kernel.org
Signed-off-by: Ingo Molnar <mingo@...nel.org>
---
 arch/alpha/kernel/asm-offsets.c | 2 ++
 include/linux/audit.h           | 2 ++
 include/linux/fs.h              | 1 +
 include/linux/sched/signal.h    | 8 +++++---
 include/linux/wait.h            | 3 +++
 kernel/tsacct.c                 | 1 +
 6 files changed, 14 insertions(+), 3 deletions(-)

diff --git a/arch/alpha/kernel/asm-offsets.c b/arch/alpha/kernel/asm-offsets.c
index 6ff8886e7e22..357632578142 100644
--- a/arch/alpha/kernel/asm-offsets.c
+++ b/arch/alpha/kernel/asm-offsets.c
@@ -9,6 +9,8 @@
 #include <linux/sched.h>
 #include <linux/ptrace.h>
 #include <linux/kbuild.h>
+#include <linux/cred.h>
+
 #include <asm/io.h>
 
 void foo(void)
diff --git a/include/linux/audit.h b/include/linux/audit.h
index 504e784b7ffa..57b3d6c07875 100644
--- a/include/linux/audit.h
+++ b/include/linux/audit.h
@@ -25,6 +25,8 @@
 
 #include <linux/sched.h>
 #include <linux/ptrace.h>
+#include <linux/cred.h>
+
 #include <uapi/linux/audit.h>
 
 #define AUDIT_INO_UNSET ((unsigned long)-1)
diff --git a/include/linux/fs.h b/include/linux/fs.h
index aad3fd0ff5f8..bf51dc2dc14a 100644
--- a/include/linux/fs.h
+++ b/include/linux/fs.h
@@ -3,6 +3,7 @@
 
 #include <linux/linkage.h>
 #include <linux/wait.h>
+#include <linux/cred.h>
 #include <linux/kdev_t.h>
 #include <linux/dcache.h>
 #include <linux/path.h>
diff --git a/include/linux/sched/signal.h b/include/linux/sched/signal.h
index 2cf446704cd4..0a5abc3dc937 100644
--- a/include/linux/sched/signal.h
+++ b/include/linux/sched/signal.h
@@ -6,7 +6,7 @@
 #include <linux/sched.h>
 #include <linux/sched/jobctl.h>
 #include <linux/sched/task.h>
-#include <linux/cred.h>
+#include <linux/wait.h>
 
 /*
  * Types defining task->signal and task->sighand and APIs using them:
@@ -289,8 +289,10 @@ extern int force_sigsegv(int, struct task_struct *);
 extern int force_sig_info(int, struct siginfo *, struct task_struct *);
 extern int __kill_pgrp_info(int sig, struct siginfo *info, struct pid *pgrp);
 extern int kill_pid_info(int sig, struct siginfo *info, struct pid *pid);
-extern int kill_pid_info_as_cred(int, struct siginfo *, struct pid *,
-				const struct cred *, u32);
+
+struct cred;
+extern int kill_pid_info_as_cred(int, struct siginfo *, struct pid *, const struct cred *, u32);
+
 extern int kill_pgrp(struct pid *pid, int sig, int priv);
 extern int kill_pid(struct pid *pid, int sig, int priv);
 extern int kill_proc_info(int, struct siginfo *, pid_t);
diff --git a/include/linux/wait.h b/include/linux/wait.h
index aacb1282d19a..e8e5a2ea3bbd 100644
--- a/include/linux/wait.h
+++ b/include/linux/wait.h
@@ -1224,4 +1224,7 @@ int wait_on_atomic_t(atomic_t *val, int (*action)(atomic_t *), unsigned mode)
 	return out_of_line_wait_on_atomic_t(val, action, mode);
 }
 
+/* NOTE: this is temporary, and it needs to come last, due to type dependencies: */
+#include <linux/sched/signal.h>
+
 #endif /* _LINUX_WAIT_H */
diff --git a/kernel/tsacct.c b/kernel/tsacct.c
index 370724b45391..63834bd86639 100644
--- a/kernel/tsacct.c
+++ b/kernel/tsacct.c
@@ -23,6 +23,7 @@
 #include <linux/tsacct_kern.h>
 #include <linux/acct.h>
 #include <linux/jiffies.h>
+#include <linux/cred.h>
 #include <linux/mm.h>
 
 /*

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ