lkml.org 
[lkml]   [2017]   [Mar]   [8]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
Date
From
Subject[RFC PATCH] sched/wait: Add <linux/sched/signal.h> dependency for now

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

> In any case, it's clear that this stuff is in no way v4.11 material, so as a
> bridging fix I propose we add a sched/signal.h include to wait.h (or just move
> signal_pending() temporarily), until it's all resolved for real for v4.12.

I.e. I propose the patch below as the v4.11 solution.

The two dependency quirks are not very elegant, plus to add insult to injury we
now revert to the original situation in v4.10 where wait.h includes sched/signal.h
and sched/signal.h includes wait.h (which the header guards sort out properly),
but it appears to build fine here in (still very light, x86-defconfig) build
testing.

Note that there's some dependency fallout from the cred.h change, but it's all
correctly adding a dependency for types/APIs that are defined in cred.h - i.e.
it's improving things in that regard. (Could split this patch into two patches:
first the cred.h change, then the signal types hack.)

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.

Thanks,

Ingo

======================>
From 2ddf85215d5ded5abfa592da69a8d84d6fcaf34b Mon Sep 17 00:00:00 2001
From: Ingo Molnar <mingo@kernel.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@linux-foundation.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: linux-kernel@vger.kernel.org
Not-Yet-Signed-off-by: Ingo Molnar <mingo@kernel.org>
---
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 +
5 files changed, 12 insertions(+), 3 deletions(-)

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>

/*
\
 
 \ /
  Last update: 2017-03-08 10:26    [W:0.091 / U:0.856 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site