Re: [v3.13][v3.14][Regression] kthread: make kthread_create() killable

2014-03-18 Thread Oleg Nesterov
On 03/17, One Thousand Gnomes wrote: > > > and b) permits userspace to produce surprising results in the kernel, > > which I suspect is what we're seeing here. > > There is enough information for kernel side code to decide whether a > signal came from kernel or userspace. Not really. SIGKILL can c

Re: [v3.13][v3.14][Regression] kthread: make kthread_create() killable

2014-03-18 Thread Oleg Nesterov
On 03/17, Andrew Morton wrote: > > On Mon, 17 Mar 2014 21:19:19 +0100 Oleg Nesterov wrote: > > > > Root cause time: it's wrong for the oom-killer to use SIGKILL. > > > > Not sure... what else? > > If we really really have to use userspace IPC in the kernel then I > suppose we could add a new signa

Re: [v3.13][v3.14][Regression] kthread: make kthread_create() killable

2014-03-17 Thread One Thousand Gnomes
> Root cause time: it's wrong for the oom-killer to use SIGKILL. In fact It has to use SIGKILL anything else might be caught and grow the user stack a page.. > it's basically always wrong to send signals from in-kernel. Signals > are a userspace IPC mechanism and using them in-kernel a) makes i

Re: [v3.13][v3.14][Regression] kthread: make kthread_create()killable

2014-03-17 Thread Tetsuo Handa
Andrew Morton wrote: > What process is running here? Presumably modprobe. Yes. It is a worker systemd-udevd process who is acting like modprobe . > A possible explanation is that modprobe has genuinely received a > SIGKILL. Can you identify anything in this setup which might send a > SIGKILL to

Re: [v3.13][v3.14][Regression] kthread: make kthread_create() killable

2014-03-17 Thread Andrew Morton
On Mon, 17 Mar 2014 21:19:19 +0100 Oleg Nesterov wrote: > > kthread_create_on_node() thinks that SIGKILL came from the oom-killer > > and it cheerfully returns -ENOMEM, which is incorrect if that signal > > came from userspace. > > Yes, I think it should return -EINTR. > > > And I don't _think_

Re: [v3.13][v3.14][Regression] kthread: make kthread_create() killable

2014-03-17 Thread Oleg Nesterov
esolved this bug: > > > > > > commit 786235eeba0e1e85e5cbbb9f97d1087ad03dfa21 > > Author: Tetsuo Handa > > Date: Tue Nov 12 15:06:45 2013 -0800 > > > > kthread: make kthread_create() killable > > > > The regression was introduced as of v3.13

Re: [v3.13][v3.14][Regression] kthread: make kthread_create() killable

2014-03-17 Thread Andrew Morton
087ad03dfa21 > Author: Tetsuo Handa > Date: Tue Nov 12 15:06:45 2013 -0800 > > kthread: make kthread_create() killable > > The regression was introduced as of v3.13-rc1. > > The bug indicates an issue with the SAS controller during > initialization, which prevents th

Re: [v3.13][v3.14][Regression] kthread: make kthread_create()killable

2014-03-17 Thread Oleg Nesterov
gt; > rather than > > return -ENOMEM; Why complicate the things? Following this logic you can change you can change almost every user of, say, fatal_signal_pending() to take TIF_MEMDIE into account. For what? Just return -EINTR. > > > Commit 786235ee "kthread: make kthre

Re: [v3.13][v3.14][Regression] kthread: make kthread_create()killable

2014-03-17 Thread Tetsuo Handa
ey the reason properly if current thread was SIGKILLed by other than the OOM killer. Maybe return test_tsk_thread_flag(current, TIF_MEMDIE) ? -ENOMEM : -EINTR; rather than return -ENOMEM; ? > > Commit 786235ee "kthread: make kthread_create() killable" changed to > > leave

Re: [v3.13][v3.14][Regression] kthread: make kthread_create() killable

2014-03-16 Thread Oleg Nesterov
On 03/17, Tetsuo Handa wrote: > > Therefore, I'd like to propose this patch for 3.14-final > and 3.13-stable. Well, I disagree. To me, the patch tries to fix the problem in the wrong place, > Commit 786235ee "kthread: make kthread_create() killable" changed to > lea

Re: [v3.13][v3.14][Regression] kthread: make kthread_create() killable

2014-03-16 Thread Tetsuo Handa
ccfaab53 Mon Sep 17 00:00:00 2001 From: Tetsuo Handa Date: Sun, 16 Mar 2014 22:44:23 +0900 Subject: [PATCH] kthread: Do not leave kthread_create() immediately upon SIGKILL. Commit 786235ee "kthread: make kthread_create() killable" changed to leave kthread_create() as soon as receiving

Re: [v3.13][v3.14][Regression] kthread: make kthread_create() killable

2014-03-14 Thread Tetsuo Handa
Joseph Salisbury wrote: > A kernel bug report was opened against Ubuntu[0]. We performed a kernel > bisect, and found that reverting the following commit resolved this bug: I added a comment to that bug report. This commit by chance revealed incorrect error handling of mptsas_probe() or mptscsih

[v3.13][v3.14][Regression] kthread: make kthread_create() killable

2014-03-14 Thread Joseph Salisbury
Hi Tetsuo, A kernel bug report was opened against Ubuntu[0]. We performed a kernel bisect, and found that reverting the following commit resolved this bug: commit 786235eeba0e1e85e5cbbb9f97d1087ad03dfa21 Author: Tetsuo Handa Date: Tue Nov 12 15:06:45 2013 -0800 kthread: make

Re: kthread: Make kthread_create() killable.

2013-10-02 Thread Tetsuo Handa
David Rientjes wrote: > I thought you had addressed the kthread_create() issue on > secur...@kernel.org, is it possible to address the others? I don't know how to call call_usermodehelper_keys(). I need a lot of help if I write a patch and a testcase for call_usermodehelper_keys(). Thus, I expla

Re: kthread: Make kthread_create() killable.

2013-10-02 Thread David Rientjes
On Tue, 1 Oct 2013, Tetsuo Handa wrote: > > Or, when the system doesn't respond for a long period of time you do > > sysrq+T and you find the TIF_MEMDIE bit set on a process that makes no > > progress exiting. > > In enterprise systems, an operator is not always sitting in front of the > serve

Re: kthread: Make kthread_create() killable.

2013-10-01 Thread Tetsuo Handa
David Rientjes wrote: > On Sat, 28 Sep 2013, Tetsuo Handa wrote: > > > Some of enterprise users might prefer "kernel panic followed by kdump and > > automatic reboot" to "a system is not responding for unpredictable period", > > for > > the panic helps getting information for analyzing what proce

Re: kthread: Make kthread_create() killable.

2013-09-30 Thread David Rientjes
On Sat, 28 Sep 2013, Tetsuo Handa wrote: > Some of enterprise users might prefer "kernel panic followed by kdump and > automatic reboot" to "a system is not responding for unpredictable period", > for > the panic helps getting information for analyzing what process caused the > freeze. Well, can

Re: kthread: Make kthread_create() killable.

2013-09-28 Thread Tetsuo Handa
David Rientjes wrote: > There may not be any eligible processes left and then the machine panics. Some of enterprise users might prefer "kernel panic followed by kdump and automatic reboot" to "a system is not responding for unpredictable period", for the panic helps getting information for anal

Re: [PATCH v3] kthread: Make kthread_create() killable.

2013-09-26 Thread David Rientjes
the machine panics. These time-based delays also have caused a complete depletion of memory reserves if more than one process is chosen and each consumes an non-neglible amount of memory which would then cause livelock. We used to have a jiffies-based rekill in 2.6.18 internally and we finally co

Re: [PATCH v3] kthread: Make kthread_create() killable.

2013-09-25 Thread Tetsuo Handa
oothly when the chosen process is waiting at kthread_create(). I attach updated patch description. Did I merge your comments appropriately? -- [PATCH v3] kthread: Make kthread_create() killable. Any user process callers of wait_for_completion() except global init process might be chosen by the

Re: [PATCH v3] kthread: Make kthread_create() killable.

2013-09-25 Thread David Rientjes
On Wed, 25 Sep 2013, Tetsuo Handa wrote: > Any users of wait_for_completion() might be chosen by the OOM killer while > waiting for completion() call by some process which does memory > allocation. kthread_create() is one of such users. > Any user process callers of wait_for_completion() you me

Re: [PATCH v3] kthread: Make kthread_create() killable.

2013-09-24 Thread Oleg Nesterov
On 09/25, Tetsuo Handa wrote: > > Subject: [PATCH] kthread: make kthread_create() killable The patch looks correct... although I'll try to reread it later ;) Minor nit, since you are sending the new version anyway... > + if (unlikely(wait_for_completion_

[PATCH v3] kthread: Make kthread_create() killable.

2013-09-24 Thread Tetsuo Handa
>From 0fe0c9d09b45cce0f00457755861204d51d7c2c9 Mon Sep 17 00:00:00 2001 From: Tetsuo Handa Date: Wed, 25 Sep 2013 00:00:27 +0900 Subject: [PATCH] kthread: make kthread_create() killable Any users of wait_for_completion() might be chosen by the OOM killer while waiting for completion() call by

Re: [PATCH v2] kthread: Make kthread_create() killable.

2013-09-23 Thread Andrew Morton
On Mon, 16 Sep 2013 09:53:59 +0900 Tetsuo Handa wrote: > Subject: [PATCH v2] kthread: Make kthread_create() killable. > > Any users of wait_for_completion() might be chosen by the OOM killer while > waiting for completion() call by some process which does memory allocation. >

Re: [PATCH v2] kthread: Make kthread_create() killable.

2013-09-15 Thread Tetsuo Handa
- >From 87373d6938f045abffe8d9b4910bd132036eccaa Mon Sep 17 00:00:00 2001 From: Tetsuo Handa Date: Mon, 16 Sep 2013 09:39:17 +0900 Subject: [PATCH v2] kthread: Make kthread_create() killable. Any users of wait_for_completion() might be chosen by the OOM killer while waiting for completion() call by some

Re: [PATCH] kthread: Make kthread_create() killable.

2013-09-15 Thread Oleg Nesterov
Hi Tetsuo, please do not start the off-list discussions ;) On 09/15, Tetsuo Handa wrote: > > I examined do_coredump() case and found similar result. ... > Do we want to change from call_usermodehelper_exec(UMH_WAIT_EXEC) to > call_usermodehelper_exec(UMH_WAIT_EXEC | UMH_WAIT_KILLABLE) To me, t

Re: [PATCH] kthread: Make kthread_create() killable.

2013-09-15 Thread Oleg Nesterov
On 09/15, Tetsuo Handa wrote: > > Oleg Nesterov wrote: > > I am wondering if this can be simplified... > > > > At least you can move create->done from kthread_create_info to the > > stack, and turn create->owner into the pointer to that completion. > > Use of DECLARE_COMPLETION_ONSTACK() looks harm

Re: [PATCH] kthread: Make kthread_create() killable.

2013-09-14 Thread Tetsuo Handa
Oleg Nesterov wrote: > I am wondering if this can be simplified... > > At least you can move create->done from kthread_create_info to the > stack, and turn create->owner into the pointer to that completion. Use of DECLARE_COMPLETION_ONSTACK() looks harmful to me because current thread needs to be

Re: [PATCH] kthread: Make kthread_create() killable.

2013-09-14 Thread Oleg Nesterov
Add lkml. On 09/13, Tetsuo Handa wrote: > > This patch makes kthread_create() killable, Probably makes sense... > @@ -255,36 +266,59 @@ struct task_struct *kthread_create_on_node(int > (*threadfn)(void *data), > const char namefmt[], >