Linux 3.3-rc4-git5 (upstream b52b80023f262ce8a0ffdcb490acb23e8678377a)
This commit is contained in:
parent
9007bbd9ca
commit
7e4a1e0b31
@ -1,105 +0,0 @@
|
|||||||
From 8791d63af0cf113725ae4cb8cba9492814c59a93 Mon Sep 17 00:00:00 2001
|
|
||||||
From: Jarod Wilson <jarod@redhat.com>
|
|
||||||
Date: Thu, 26 Jan 2012 12:04:11 -0300
|
|
||||||
Subject: [PATCH] [media] imon: don't wedge hardware after early callbacks
|
|
||||||
|
|
||||||
This patch is just a minor update to one titled "imon: Input from ffdc
|
|
||||||
device type ignored" from Corinna Vinschen. An earlier patch to prevent
|
|
||||||
an oops when we got early callbacks also has the nasty side-effect of
|
|
||||||
wedging imon hardware, as we don't acknowledge the urb. Rework the check
|
|
||||||
slightly here to bypass processing the packet, as the driver isn't yet
|
|
||||||
fully initialized, but still acknowlege the urb and submit a new rx_urb.
|
|
||||||
Do this for both interfaces -- irrelevant for ffdc hardware, but
|
|
||||||
relevant for newer hardware, though newer hardware doesn't spew the
|
|
||||||
constant stream of data as soon as the hardware is initialized like the
|
|
||||||
older ffdc devices, so they'd be less likely to trigger this anyway...
|
|
||||||
|
|
||||||
Tested with both an ffdc device and an 0042 device.
|
|
||||||
|
|
||||||
Reported-by: Corinna Vinschen <vinschen@redhat.com>
|
|
||||||
Signed-off-by: Jarod Wilson <jarod@redhat.com>
|
|
||||||
CC: stable@vger.kernel.org
|
|
||||||
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
|
|
||||||
---
|
|
||||||
drivers/media/rc/imon.c | 26 ++++++++++++++++++++++----
|
|
||||||
1 files changed, 22 insertions(+), 4 deletions(-)
|
|
||||||
|
|
||||||
diff --git a/drivers/media/rc/imon.c b/drivers/media/rc/imon.c
|
|
||||||
index 6ed9646..3f175eb 100644
|
|
||||||
--- a/drivers/media/rc/imon.c
|
|
||||||
+++ b/drivers/media/rc/imon.c
|
|
||||||
@@ -47,7 +47,7 @@
|
|
||||||
#define MOD_AUTHOR "Jarod Wilson <jarod@wilsonet.com>"
|
|
||||||
#define MOD_DESC "Driver for SoundGraph iMON MultiMedia IR/Display"
|
|
||||||
#define MOD_NAME "imon"
|
|
||||||
-#define MOD_VERSION "0.9.3"
|
|
||||||
+#define MOD_VERSION "0.9.4"
|
|
||||||
|
|
||||||
#define DISPLAY_MINOR_BASE 144
|
|
||||||
#define DEVICE_NAME "lcd%d"
|
|
||||||
@@ -1658,9 +1658,17 @@ static void usb_rx_callback_intf0(struct urb *urb)
|
|
||||||
return;
|
|
||||||
|
|
||||||
ictx = (struct imon_context *)urb->context;
|
|
||||||
- if (!ictx || !ictx->dev_present_intf0)
|
|
||||||
+ if (!ictx)
|
|
||||||
return;
|
|
||||||
|
|
||||||
+ /*
|
|
||||||
+ * if we get a callback before we're done configuring the hardware, we
|
|
||||||
+ * can't yet process the data, as there's nowhere to send it, but we
|
|
||||||
+ * still need to submit a new rx URB to avoid wedging the hardware
|
|
||||||
+ */
|
|
||||||
+ if (!ictx->dev_present_intf0)
|
|
||||||
+ goto out;
|
|
||||||
+
|
|
||||||
switch (urb->status) {
|
|
||||||
case -ENOENT: /* usbcore unlink successful! */
|
|
||||||
return;
|
|
||||||
@@ -1678,6 +1686,7 @@ static void usb_rx_callback_intf0(struct urb *urb)
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
+out:
|
|
||||||
usb_submit_urb(ictx->rx_urb_intf0, GFP_ATOMIC);
|
|
||||||
}
|
|
||||||
|
|
||||||
@@ -1690,9 +1699,17 @@ static void usb_rx_callback_intf1(struct urb *urb)
|
|
||||||
return;
|
|
||||||
|
|
||||||
ictx = (struct imon_context *)urb->context;
|
|
||||||
- if (!ictx || !ictx->dev_present_intf1)
|
|
||||||
+ if (!ictx)
|
|
||||||
return;
|
|
||||||
|
|
||||||
+ /*
|
|
||||||
+ * if we get a callback before we're done configuring the hardware, we
|
|
||||||
+ * can't yet process the data, as there's nowhere to send it, but we
|
|
||||||
+ * still need to submit a new rx URB to avoid wedging the hardware
|
|
||||||
+ */
|
|
||||||
+ if (!ictx->dev_present_intf1)
|
|
||||||
+ goto out;
|
|
||||||
+
|
|
||||||
switch (urb->status) {
|
|
||||||
case -ENOENT: /* usbcore unlink successful! */
|
|
||||||
return;
|
|
||||||
@@ -1710,6 +1727,7 @@ static void usb_rx_callback_intf1(struct urb *urb)
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
+out:
|
|
||||||
usb_submit_urb(ictx->rx_urb_intf1, GFP_ATOMIC);
|
|
||||||
}
|
|
||||||
|
|
||||||
@@ -2242,7 +2260,7 @@ find_endpoint_failed:
|
|
||||||
mutex_unlock(&ictx->lock);
|
|
||||||
usb_free_urb(rx_urb);
|
|
||||||
rx_urb_alloc_failed:
|
|
||||||
- dev_err(ictx->dev, "unable to initialize intf0, err %d\n", ret);
|
|
||||||
+ dev_err(ictx->dev, "unable to initialize intf1, err %d\n", ret);
|
|
||||||
|
|
||||||
return NULL;
|
|
||||||
}
|
|
||||||
--
|
|
||||||
1.7.2.5
|
|
||||||
|
|
@ -87,7 +87,7 @@ Summary: The Linux kernel
|
|||||||
# The rc snapshot level
|
# The rc snapshot level
|
||||||
%define rcrev 4
|
%define rcrev 4
|
||||||
# The git snapshot level
|
# The git snapshot level
|
||||||
%define gitrev 4
|
%define gitrev 5
|
||||||
# Set rpm version accordingly
|
# Set rpm version accordingly
|
||||||
%define rpmversion 3.%{upstream_sublevel}.0
|
%define rpmversion 3.%{upstream_sublevel}.0
|
||||||
%endif
|
%endif
|
||||||
@ -716,7 +716,6 @@ Patch2802: linux-2.6-silence-acpi-blacklist.patch
|
|||||||
Patch2899: linux-2.6-v4l-dvb-fixes.patch
|
Patch2899: linux-2.6-v4l-dvb-fixes.patch
|
||||||
Patch2900: linux-2.6-v4l-dvb-update.patch
|
Patch2900: linux-2.6-v4l-dvb-update.patch
|
||||||
Patch2901: linux-2.6-v4l-dvb-experimental.patch
|
Patch2901: linux-2.6-v4l-dvb-experimental.patch
|
||||||
Patch2902: imon-dont-wedge-hardware-after-early-callbacks.patch
|
|
||||||
|
|
||||||
# fs fixes
|
# fs fixes
|
||||||
Patch4000: ext4-fix-resize-when-resizing-within-single-group.patch
|
Patch4000: ext4-fix-resize-when-resizing-within-single-group.patch
|
||||||
@ -1447,7 +1446,6 @@ ApplyPatch quite-apm.patch
|
|||||||
ApplyOptionalPatch linux-2.6-v4l-dvb-fixes.patch
|
ApplyOptionalPatch linux-2.6-v4l-dvb-fixes.patch
|
||||||
ApplyOptionalPatch linux-2.6-v4l-dvb-update.patch
|
ApplyOptionalPatch linux-2.6-v4l-dvb-update.patch
|
||||||
ApplyOptionalPatch linux-2.6-v4l-dvb-experimental.patch
|
ApplyOptionalPatch linux-2.6-v4l-dvb-experimental.patch
|
||||||
ApplyPatch imon-dont-wedge-hardware-after-early-callbacks.patch
|
|
||||||
|
|
||||||
# Patches headed upstream
|
# Patches headed upstream
|
||||||
ApplyPatch disable-i8042-check-on-apple-mac.patch
|
ApplyPatch disable-i8042-check-on-apple-mac.patch
|
||||||
@ -2366,6 +2364,9 @@ fi
|
|||||||
# ||----w |
|
# ||----w |
|
||||||
# || ||
|
# || ||
|
||||||
%changelog
|
%changelog
|
||||||
|
* Sat Feb 25 2012 Josh Boyer <jwboyer@redhat.com> - 3.3.0-0.rc4.git5.1
|
||||||
|
- Linux 3.3-rc4-git5 (upstream b52b80023f262ce8a0ffdcb490acb23e8678377a)
|
||||||
|
|
||||||
* Fri Feb 24 2012 Josh Boyer <jwboyer@redhat.com>
|
* Fri Feb 24 2012 Josh Boyer <jwboyer@redhat.com>
|
||||||
- Linux 3.3-rc4-git4 (upstream bb4c7e9a9908548b458f34afb2fee74dc0d49f90)
|
- Linux 3.3-rc4-git4 (upstream bb4c7e9a9908548b458f34afb2fee74dc0d49f90)
|
||||||
|
|
||||||
|
2
sources
2
sources
@ -1,4 +1,4 @@
|
|||||||
364066fa18767ec0ae5f4e4abcf9dc51 linux-3.2.tar.xz
|
364066fa18767ec0ae5f4e4abcf9dc51 linux-3.2.tar.xz
|
||||||
35f3b51bfd9bd47a939753e68d49ca00 patch-3.3-rc4.xz
|
35f3b51bfd9bd47a939753e68d49ca00 patch-3.3-rc4.xz
|
||||||
02c210a8fd24acca8c1ac93f6f1d3913 compat-wireless-2012-02-05.tar.bz2
|
02c210a8fd24acca8c1ac93f6f1d3913 compat-wireless-2012-02-05.tar.bz2
|
||||||
e41cec30d0e61dd975893953eef7d58c patch-3.3-rc4-git4.xz
|
5f197e6bdcf07ec465bbdd503426d7c1 patch-3.3-rc4-git5.xz
|
||||||
|
131
utrace.patch
131
utrace.patch
@ -1,4 +1,8 @@
|
|||||||
utrace for 3.3-rc1 kernel, on top of dcd6c92267155e70a94b3927bce681ce74b80d1f.
|
From d007ce2c3f1f67624fde5e6b7ccc00566b7df9c3 Mon Sep 17 00:00:00 2001
|
||||||
|
From: Oleg Nesterov <oleg@redhat.com>
|
||||||
|
Date: Sat, 25 Feb 2012 07:29:40 -0500
|
||||||
|
Subject: [PATCH] utrace for 3.3-rc4 kernel, on top of
|
||||||
|
b52b80023f262ce8a0ffdcb490acb23e8678377a.
|
||||||
|
|
||||||
The split-out series is available in the git repository at:
|
The split-out series is available in the git repository at:
|
||||||
|
|
||||||
@ -55,7 +59,7 @@ Signed-off-by: Oleg Nesterov <oleg@redhat.com>
|
|||||||
include/linux/sched.h | 25 +-
|
include/linux/sched.h | 25 +-
|
||||||
include/linux/signal.h | 2 +
|
include/linux/signal.h | 2 +
|
||||||
include/linux/tracehook.h | 59 +-
|
include/linux/tracehook.h | 59 +-
|
||||||
include/linux/utrace.h | 773 ++++++++++++
|
include/linux/utrace.h | 774 ++++++++++++
|
||||||
init/Kconfig | 9 +
|
init/Kconfig | 9 +
|
||||||
kernel/Makefile | 1 +
|
kernel/Makefile | 1 +
|
||||||
kernel/exit.c | 5 +
|
kernel/exit.c | 5 +
|
||||||
@ -63,8 +67,8 @@ Signed-off-by: Oleg Nesterov <oleg@redhat.com>
|
|||||||
kernel/ptrace.c | 57 +-
|
kernel/ptrace.c | 57 +-
|
||||||
kernel/sched/core.c | 2 +-
|
kernel/sched/core.c | 2 +-
|
||||||
kernel/signal.c | 97 ++-
|
kernel/signal.c | 97 ++-
|
||||||
kernel/utrace.c | 2462 +++++++++++++++++++++++++++++++++++++
|
kernel/utrace.c | 2466 +++++++++++++++++++++++++++++++++++++
|
||||||
19 files changed, 4069 insertions(+), 56 deletions(-)
|
19 files changed, 4074 insertions(+), 56 deletions(-)
|
||||||
create mode 100644 Documentation/DocBook/utrace.tmpl
|
create mode 100644 Documentation/DocBook/utrace.tmpl
|
||||||
create mode 100644 include/linux/utrace.h
|
create mode 100644 include/linux/utrace.h
|
||||||
create mode 100644 kernel/utrace.c
|
create mode 100644 kernel/utrace.c
|
||||||
@ -721,10 +725,10 @@ index 5026738..97687f3 100644
|
|||||||
clear_tsk_thread_flag(child, TIF_SYSCALL_EMU);
|
clear_tsk_thread_flag(child, TIF_SYSCALL_EMU);
|
||||||
#endif
|
#endif
|
||||||
diff --git a/fs/exec.c b/fs/exec.c
|
diff --git a/fs/exec.c b/fs/exec.c
|
||||||
index aeb135c..36a0cbe 100644
|
index 92ce83a..87ff31f 100644
|
||||||
--- a/fs/exec.c
|
--- a/fs/exec.c
|
||||||
+++ b/fs/exec.c
|
+++ b/fs/exec.c
|
||||||
@@ -1401,9 +1401,12 @@ int search_binary_handler(struct linux_binprm *bprm,struct pt_regs *regs)
|
@@ -1402,9 +1402,12 @@ int search_binary_handler(struct linux_binprm *bprm,struct pt_regs *regs)
|
||||||
*/
|
*/
|
||||||
bprm->recursion_depth = depth;
|
bprm->recursion_depth = depth;
|
||||||
if (retval >= 0) {
|
if (retval >= 0) {
|
||||||
@ -810,7 +814,7 @@ index c2f1f6a..236b920 100644
|
|||||||
|
|
||||||
if (child->ptrace & PT_SEIZED)
|
if (child->ptrace & PT_SEIZED)
|
||||||
diff --git a/include/linux/sched.h b/include/linux/sched.h
|
diff --git a/include/linux/sched.h b/include/linux/sched.h
|
||||||
index 4032ec1..e95c1dc 100644
|
index 7d379a6..a3c4599 100644
|
||||||
--- a/include/linux/sched.h
|
--- a/include/linux/sched.h
|
||||||
+++ b/include/linux/sched.h
|
+++ b/include/linux/sched.h
|
||||||
@@ -185,16 +185,17 @@ print_cfs_rq(struct seq_file *m, int cpu, struct cfs_rq *cfs_rq)
|
@@ -185,16 +185,17 @@ print_cfs_rq(struct seq_file *m, int cpu, struct cfs_rq *cfs_rq)
|
||||||
@ -870,7 +874,7 @@ index 4032ec1..e95c1dc 100644
|
|||||||
u32 parent_exec_id;
|
u32 parent_exec_id;
|
||||||
u32 self_exec_id;
|
u32 self_exec_id;
|
||||||
diff --git a/include/linux/signal.h b/include/linux/signal.h
|
diff --git a/include/linux/signal.h b/include/linux/signal.h
|
||||||
index 7987ce7..c320549 100644
|
index 7987ce74..c320549 100644
|
||||||
--- a/include/linux/signal.h
|
--- a/include/linux/signal.h
|
||||||
+++ b/include/linux/signal.h
|
+++ b/include/linux/signal.h
|
||||||
@@ -239,6 +239,8 @@ static inline int valid_signal(unsigned long sig)
|
@@ -239,6 +239,8 @@ static inline int valid_signal(unsigned long sig)
|
||||||
@ -999,10 +1003,10 @@ index a71a292..a1bac95 100644
|
|||||||
|
|
||||||
diff --git a/include/linux/utrace.h b/include/linux/utrace.h
|
diff --git a/include/linux/utrace.h b/include/linux/utrace.h
|
||||||
new file mode 100644
|
new file mode 100644
|
||||||
index 0000000..f37373b
|
index 0000000..46959af
|
||||||
--- /dev/null
|
--- /dev/null
|
||||||
+++ b/include/linux/utrace.h
|
+++ b/include/linux/utrace.h
|
||||||
@@ -0,0 +1,773 @@
|
@@ -0,0 +1,774 @@
|
||||||
+/*
|
+/*
|
||||||
+ * utrace infrastructure interface for debugging user processes
|
+ * utrace infrastructure interface for debugging user processes
|
||||||
+ *
|
+ *
|
||||||
@ -1322,6 +1326,7 @@ index 0000000..f37373b
|
|||||||
+#define UTRACE_ATTACH_MATCH_MASK 0x000f
|
+#define UTRACE_ATTACH_MATCH_MASK 0x000f
|
||||||
+#define UTRACE_ATTACH_CREATE 0x0010 /* Attach a new engine. */
|
+#define UTRACE_ATTACH_CREATE 0x0010 /* Attach a new engine. */
|
||||||
+#define UTRACE_ATTACH_EXCLUSIVE 0x0020 /* Refuse if existing match. */
|
+#define UTRACE_ATTACH_EXCLUSIVE 0x0020 /* Refuse if existing match. */
|
||||||
|
+#define UTRACE_ATTACH_ATOMIC 0x0040 /* For _CREATE, don't sleep */
|
||||||
+
|
+
|
||||||
+/**
|
+/**
|
||||||
+ * struct utrace_engine - per-engine structure
|
+ * struct utrace_engine - per-engine structure
|
||||||
@ -1809,7 +1814,7 @@ index 2d9de86..6c6749d 100644
|
|||||||
obj-$(CONFIG_AUDITSYSCALL) += auditsc.o
|
obj-$(CONFIG_AUDITSYSCALL) += auditsc.o
|
||||||
obj-$(CONFIG_AUDIT_WATCH) += audit_watch.o
|
obj-$(CONFIG_AUDIT_WATCH) += audit_watch.o
|
||||||
diff --git a/kernel/exit.c b/kernel/exit.c
|
diff --git a/kernel/exit.c b/kernel/exit.c
|
||||||
index 294b170..16108a5 100644
|
index 4b4042f..b1e0518 100644
|
||||||
--- a/kernel/exit.c
|
--- a/kernel/exit.c
|
||||||
+++ b/kernel/exit.c
|
+++ b/kernel/exit.c
|
||||||
@@ -169,6 +169,8 @@ void release_task(struct task_struct * p)
|
@@ -169,6 +169,8 @@ void release_task(struct task_struct * p)
|
||||||
@ -1839,18 +1844,18 @@ index 294b170..16108a5 100644
|
|||||||
|
|
||||||
validate_creds_for_do_exit(tsk);
|
validate_creds_for_do_exit(tsk);
|
||||||
diff --git a/kernel/fork.c b/kernel/fork.c
|
diff --git a/kernel/fork.c b/kernel/fork.c
|
||||||
index 051f090..e103101 100644
|
index e2cd3e2..fa40928 100644
|
||||||
--- a/kernel/fork.c
|
--- a/kernel/fork.c
|
||||||
+++ b/kernel/fork.c
|
+++ b/kernel/fork.c
|
||||||
@@ -66,6 +66,7 @@
|
@@ -67,6 +67,7 @@
|
||||||
#include <linux/user-return-notifier.h>
|
|
||||||
#include <linux/oom.h>
|
#include <linux/oom.h>
|
||||||
#include <linux/khugepaged.h>
|
#include <linux/khugepaged.h>
|
||||||
|
#include <linux/signalfd.h>
|
||||||
+#include <linux/utrace.h>
|
+#include <linux/utrace.h>
|
||||||
|
|
||||||
#include <asm/pgtable.h>
|
#include <asm/pgtable.h>
|
||||||
#include <asm/pgalloc.h>
|
#include <asm/pgalloc.h>
|
||||||
@@ -169,6 +170,8 @@ void free_task(struct task_struct *tsk)
|
@@ -170,6 +171,8 @@ void free_task(struct task_struct *tsk)
|
||||||
free_thread_info(tsk->stack);
|
free_thread_info(tsk->stack);
|
||||||
rt_mutex_debug_task_free(tsk);
|
rt_mutex_debug_task_free(tsk);
|
||||||
ftrace_graph_exit_task(tsk);
|
ftrace_graph_exit_task(tsk);
|
||||||
@ -1859,7 +1864,7 @@ index 051f090..e103101 100644
|
|||||||
free_task_struct(tsk);
|
free_task_struct(tsk);
|
||||||
}
|
}
|
||||||
EXPORT_SYMBOL(free_task);
|
EXPORT_SYMBOL(free_task);
|
||||||
@@ -1092,6 +1095,8 @@ static struct task_struct *copy_process(unsigned long clone_flags,
|
@@ -1115,6 +1118,8 @@ static struct task_struct *copy_process(unsigned long clone_flags,
|
||||||
if (!p)
|
if (!p)
|
||||||
goto fork_out;
|
goto fork_out;
|
||||||
|
|
||||||
@ -1868,7 +1873,7 @@ index 051f090..e103101 100644
|
|||||||
ftrace_graph_init_task(p);
|
ftrace_graph_init_task(p);
|
||||||
|
|
||||||
rt_mutex_init_task(p);
|
rt_mutex_init_task(p);
|
||||||
@@ -1527,6 +1532,8 @@ long do_fork(unsigned long clone_flags,
|
@@ -1550,6 +1555,8 @@ long do_fork(unsigned long clone_flags,
|
||||||
init_completion(&vfork);
|
init_completion(&vfork);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1877,7 +1882,7 @@ index 051f090..e103101 100644
|
|||||||
/*
|
/*
|
||||||
* We set PF_STARTING at creation in case tracing wants to
|
* We set PF_STARTING at creation in case tracing wants to
|
||||||
* use this to distinguish a fully live task from one that
|
* use this to distinguish a fully live task from one that
|
||||||
@@ -1538,6 +1545,8 @@ long do_fork(unsigned long clone_flags,
|
@@ -1561,6 +1568,8 @@ long do_fork(unsigned long clone_flags,
|
||||||
wake_up_new_task(p);
|
wake_up_new_task(p);
|
||||||
|
|
||||||
/* forking complete and child started to run, tell ptracer */
|
/* forking complete and child started to run, tell ptracer */
|
||||||
@ -2017,10 +2022,10 @@ index 00ab2ca..a7024b8 100644
|
|||||||
}
|
}
|
||||||
unlock_task_sighand(child, &flags);
|
unlock_task_sighand(child, &flags);
|
||||||
diff --git a/kernel/sched/core.c b/kernel/sched/core.c
|
diff --git a/kernel/sched/core.c b/kernel/sched/core.c
|
||||||
index df00cb0..24dfee4 100644
|
index 5255c9d..f1719b8 100644
|
||||||
--- a/kernel/sched/core.c
|
--- a/kernel/sched/core.c
|
||||||
+++ b/kernel/sched/core.c
|
+++ b/kernel/sched/core.c
|
||||||
@@ -1172,7 +1172,7 @@ unsigned long wait_task_inactive(struct task_struct *p, long match_state)
|
@@ -1167,7 +1167,7 @@ unsigned long wait_task_inactive(struct task_struct *p, long match_state)
|
||||||
* is actually now running somewhere else!
|
* is actually now running somewhere else!
|
||||||
*/
|
*/
|
||||||
while (task_running(rq, p)) {
|
while (task_running(rq, p)) {
|
||||||
@ -2216,10 +2221,10 @@ index c73c428..0508d93 100644
|
|||||||
trace_signal_deliver(signr, info, ka);
|
trace_signal_deliver(signr, info, ka);
|
||||||
diff --git a/kernel/utrace.c b/kernel/utrace.c
|
diff --git a/kernel/utrace.c b/kernel/utrace.c
|
||||||
new file mode 100644
|
new file mode 100644
|
||||||
index 0000000..c817a46
|
index 0000000..a169e1b
|
||||||
--- /dev/null
|
--- /dev/null
|
||||||
+++ b/kernel/utrace.c
|
+++ b/kernel/utrace.c
|
||||||
@@ -0,0 +1,2462 @@
|
@@ -0,0 +1,2466 @@
|
||||||
+/*
|
+/*
|
||||||
+ * utrace infrastructure interface for debugging user processes
|
+ * utrace infrastructure interface for debugging user processes
|
||||||
+ *
|
+ *
|
||||||
@ -2335,9 +2340,9 @@ index 0000000..c817a46
|
|||||||
+ *
|
+ *
|
||||||
+ * This returns false only in case of a memory allocation failure.
|
+ * This returns false only in case of a memory allocation failure.
|
||||||
+ */
|
+ */
|
||||||
+static bool utrace_task_alloc(struct task_struct *task)
|
+static bool utrace_task_alloc(struct task_struct *task, gfp_t gfp_flags)
|
||||||
+{
|
+{
|
||||||
+ struct utrace *utrace = kmem_cache_zalloc(utrace_cachep, GFP_KERNEL);
|
+ struct utrace *utrace = kmem_cache_zalloc(utrace_cachep, gfp_flags);
|
||||||
+ if (unlikely(!utrace))
|
+ if (unlikely(!utrace))
|
||||||
+ return false;
|
+ return false;
|
||||||
+ spin_lock_init(&utrace->lock);
|
+ spin_lock_init(&utrace->lock);
|
||||||
@ -2517,6 +2522,7 @@ index 0000000..c817a46
|
|||||||
+{
|
+{
|
||||||
+ struct utrace *utrace = task_utrace_struct(target);
|
+ struct utrace *utrace = task_utrace_struct(target);
|
||||||
+ struct utrace_engine *engine;
|
+ struct utrace_engine *engine;
|
||||||
|
+ gfp_t gfp_flags;
|
||||||
+ int ret;
|
+ int ret;
|
||||||
+
|
+
|
||||||
+ if (!(flags & UTRACE_ATTACH_CREATE)) {
|
+ if (!(flags & UTRACE_ATTACH_CREATE)) {
|
||||||
@ -2539,13 +2545,16 @@ index 0000000..c817a46
|
|||||||
+ */
|
+ */
|
||||||
+ return ERR_PTR(-EPERM);
|
+ return ERR_PTR(-EPERM);
|
||||||
+
|
+
|
||||||
|
+ gfp_flags = (flags & UTRACE_ATTACH_ATOMIC)
|
||||||
|
+ ? GFP_ATOMIC : GFP_KERNEL;
|
||||||
|
+
|
||||||
+ if (!utrace) {
|
+ if (!utrace) {
|
||||||
+ if (unlikely(!utrace_task_alloc(target)))
|
+ if (unlikely(!utrace_task_alloc(target, gfp_flags)))
|
||||||
+ return ERR_PTR(-ENOMEM);
|
+ return ERR_PTR(-ENOMEM);
|
||||||
+ utrace = task_utrace_struct(target);
|
+ utrace = task_utrace_struct(target);
|
||||||
+ }
|
+ }
|
||||||
+
|
+
|
||||||
+ engine = kmem_cache_alloc(utrace_engine_cachep, GFP_KERNEL);
|
+ engine = kmem_cache_alloc(utrace_engine_cachep, gfp_flags);
|
||||||
+ if (unlikely(!engine))
|
+ if (unlikely(!engine))
|
||||||
+ return ERR_PTR(-ENOMEM);
|
+ return ERR_PTR(-ENOMEM);
|
||||||
+
|
+
|
||||||
@ -4682,74 +4691,6 @@ index 0000000..c817a46
|
|||||||
+{
|
+{
|
||||||
+ seq_printf(m, "Utrace:\t%lx\n", p->utrace_flags);
|
+ seq_printf(m, "Utrace:\t%lx\n", p->utrace_flags);
|
||||||
+}
|
+}
|
||||||
|
|
||||||
Add the new UTRACE_ATTACH_ATOMIC flag for utrace_attach_task().
|
|
||||||
If it is set, UTRACE_ATTACH_CREATE uses GFP_ATOMIC for memory
|
|
||||||
allocations and thus it can be used in atomic context.
|
|
||||||
|
|
||||||
Suggested-by: Mark Wielaard <mjw@redhat.com>
|
|
||||||
Signed-off-by: Oleg Nesterov <oleg@redhat.com>
|
|
||||||
---
|
|
||||||
include/linux/utrace.h | 1 +
|
|
||||||
kernel/utrace.c | 12 ++++++++----
|
|
||||||
2 files changed, 9 insertions(+), 4 deletions(-)
|
|
||||||
|
|
||||||
diff --git a/include/linux/utrace.h b/include/linux/utrace.h
|
|
||||||
index f37373b..46959af 100644
|
|
||||||
--- a/include/linux/utrace.h
|
|
||||||
+++ b/include/linux/utrace.h
|
|
||||||
@@ -317,6 +317,7 @@ static inline enum utrace_syscall_action utrace_syscall_action(u32 action)
|
|
||||||
#define UTRACE_ATTACH_MATCH_MASK 0x000f
|
|
||||||
#define UTRACE_ATTACH_CREATE 0x0010 /* Attach a new engine. */
|
|
||||||
#define UTRACE_ATTACH_EXCLUSIVE 0x0020 /* Refuse if existing match. */
|
|
||||||
+#define UTRACE_ATTACH_ATOMIC 0x0040 /* For _CREATE, don't sleep */
|
|
||||||
|
|
||||||
/**
|
|
||||||
* struct utrace_engine - per-engine structure
|
|
||||||
diff --git a/kernel/utrace.c b/kernel/utrace.c
|
|
||||||
index c817a46..a169e1b 100644
|
|
||||||
--- a/kernel/utrace.c
|
|
||||||
+++ b/kernel/utrace.c
|
|
||||||
@@ -113,9 +113,9 @@ void task_utrace_unlock(struct task_struct *task)
|
|
||||||
*
|
|
||||||
* This returns false only in case of a memory allocation failure.
|
|
||||||
*/
|
|
||||||
-static bool utrace_task_alloc(struct task_struct *task)
|
|
||||||
+static bool utrace_task_alloc(struct task_struct *task, gfp_t gfp_flags)
|
|
||||||
{
|
|
||||||
- struct utrace *utrace = kmem_cache_zalloc(utrace_cachep, GFP_KERNEL);
|
|
||||||
+ struct utrace *utrace = kmem_cache_zalloc(utrace_cachep, gfp_flags);
|
|
||||||
if (unlikely(!utrace))
|
|
||||||
return false;
|
|
||||||
spin_lock_init(&utrace->lock);
|
|
||||||
@@ -295,6 +295,7 @@ struct utrace_engine *utrace_attach_task(
|
|
||||||
{
|
|
||||||
struct utrace *utrace = task_utrace_struct(target);
|
|
||||||
struct utrace_engine *engine;
|
|
||||||
+ gfp_t gfp_flags;
|
|
||||||
int ret;
|
|
||||||
|
|
||||||
if (!(flags & UTRACE_ATTACH_CREATE)) {
|
|
||||||
@@ -317,13 +318,16 @@ struct utrace_engine *utrace_attach_task(
|
|
||||||
*/
|
|
||||||
return ERR_PTR(-EPERM);
|
|
||||||
|
|
||||||
+ gfp_flags = (flags & UTRACE_ATTACH_ATOMIC)
|
|
||||||
+ ? GFP_ATOMIC : GFP_KERNEL;
|
|
||||||
+
|
|
||||||
if (!utrace) {
|
|
||||||
- if (unlikely(!utrace_task_alloc(target)))
|
|
||||||
+ if (unlikely(!utrace_task_alloc(target, gfp_flags)))
|
|
||||||
return ERR_PTR(-ENOMEM);
|
|
||||||
utrace = task_utrace_struct(target);
|
|
||||||
}
|
|
||||||
|
|
||||||
- engine = kmem_cache_alloc(utrace_engine_cachep, GFP_KERNEL);
|
|
||||||
+ engine = kmem_cache_alloc(utrace_engine_cachep, gfp_flags);
|
|
||||||
if (unlikely(!engine))
|
|
||||||
return ERR_PTR(-ENOMEM);
|
|
||||||
|
|
||||||
--
|
--
|
||||||
1.5.5.1
|
1.7.9.1
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user