linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* Re: freezer: exec should clear PF_NOFREEZE along with PF_KTHREAD
       [not found] ` <1354762294.17107.157.camel@deadeye.wl.decadent.org.uk>
@ 2012-12-06 12:42   ` Oleg Nesterov
  2012-12-06 20:44     ` Joseph Salisbury
  0 siblings, 1 reply; 6+ messages in thread
From: Oleg Nesterov @ 2012-12-06 12:42 UTC (permalink / raw)
  To: Ben Hutchings
  Cc: Joseph Salisbury, Rafael J. Wysocki, Herton Krzesinski, linux-kernel

Hi,

(add lkml)

On 12/06, Ben Hutchings wrote:
>
> On Wed, 2012-12-05 at 14:13 -0500, Joseph Salisbury wrote:
>
> > Hi Oleg,
> >
> > A bug was opened against the Ubuntu kernel[0].  It was found that
> > reverting commit b40a79591ca918e7b91b0d9b6abd5d00f2e88c19 resolved this
> > bug, and allowed suspend/resume to work properly.
> >
> > I see that you are the author of this patch, so I wanted to run it by
> > you.  I was thinking of requesting a revert for 3.2 stable, but I wanted
> > to get your feedback first.
> >
> > Thanks,
> >
> > Joe
> >
> >
> > [0] https://bugs.launchpad.net/ubuntu/+source/v86d/+bug/1080530
>
> If I understand this rightly:
> 1. Suspend is aborted because the v86d usermodehelper cannot be frozen.
> 2. Before this fix, usermodehelpers could inherit PF_NOFREEZE (what
> could possibly go wrong with that?!), which is why this didn't
> previously happen.

Yes, try_to_freeze_tasks() ignores PF_NOFREEZE tasks

> 3. However, usermodehelpers are supposed to be disabled while the
> freezer is running.  Why is this one still running?

__usermodehelper_disable() doesn't try to kill/stop/whatever the already
spawned tasks...

The question is, why v86d refuses to freeze? It sleeps in TASK_INTERRUPTIBLE.


Oh... I seem to understand. This is 3.2 kernel, it also has PF_FREEZER_NOSIG.
which should be cleared along with PF_NOFREEZE.

This flag was removed upstream, but the older kernel need the fix. Could
you test the patch below?

Oleg.

--- a/fs/exec.c
+++ b/fs/exec.c
@@ -1084,7 +1084,7 @@ int flush_old_exec(struct linux_binprm *
 
 	set_fs(USER_DS);
 	current->flags &=
-		~(PF_RANDOMIZE | PF_FORKNOEXEC | PF_KTHREAD | PF_NOFREEZE);
+		~(PF_RANDOMIZE | PF_FORKNOEXEC | PF_KTHREAD | PF_NOFREEZE | PF_FREEZER_NOSIG);
 	flush_thread();
 	current->personality &= ~bprm->per_clear;
 


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: freezer: exec should clear PF_NOFREEZE along with PF_KTHREAD
  2012-12-06 12:42   ` freezer: exec should clear PF_NOFREEZE along with PF_KTHREAD Oleg Nesterov
@ 2012-12-06 20:44     ` Joseph Salisbury
  2012-12-07 14:49       ` [PATCH -stable 0/1] freezer: PF_FREEZER_NOSIG should be cleared along with PF_NOFREEZE Oleg Nesterov
  0 siblings, 1 reply; 6+ messages in thread
From: Joseph Salisbury @ 2012-12-06 20:44 UTC (permalink / raw)
  To: Oleg Nesterov
  Cc: Ben Hutchings, Rafael J. Wysocki, Herton Krzesinski, linux-kernel

On 12/06/2012 07:42 AM, Oleg Nesterov wrote:
> Hi,
>
> (add lkml)
>
> On 12/06, Ben Hutchings wrote:
>> On Wed, 2012-12-05 at 14:13 -0500, Joseph Salisbury wrote:
>>
>>> Hi Oleg,
>>>
>>> A bug was opened against the Ubuntu kernel[0].  It was found that
>>> reverting commit b40a79591ca918e7b91b0d9b6abd5d00f2e88c19 resolved this
>>> bug, and allowed suspend/resume to work properly.
>>>
>>> I see that you are the author of this patch, so I wanted to run it by
>>> you.  I was thinking of requesting a revert for 3.2 stable, but I wanted
>>> to get your feedback first.
>>>
>>> Thanks,
>>>
>>> Joe
>>>
>>>
>>> [0] https://bugs.launchpad.net/ubuntu/+source/v86d/+bug/1080530
>> If I understand this rightly:
>> 1. Suspend is aborted because the v86d usermodehelper cannot be frozen.
>> 2. Before this fix, usermodehelpers could inherit PF_NOFREEZE (what
>> could possibly go wrong with that?!), which is why this didn't
>> previously happen.
> Yes, try_to_freeze_tasks() ignores PF_NOFREEZE tasks
>
>> 3. However, usermodehelpers are supposed to be disabled while the
>> freezer is running.  Why is this one still running?
> __usermodehelper_disable() doesn't try to kill/stop/whatever the already
> spawned tasks...
>
> The question is, why v86d refuses to freeze? It sleeps in TASK_INTERRUPTIBLE.
>
>
> Oh... I seem to understand. This is 3.2 kernel, it also has PF_FREEZER_NOSIG.
> which should be cleared along with PF_NOFREEZE.
>
> This flag was removed upstream, but the older kernel need the fix. Could
> you test the patch below?
>
> Oleg.
>
> --- a/fs/exec.c
> +++ b/fs/exec.c
> @@ -1084,7 +1084,7 @@ int flush_old_exec(struct linux_binprm *
>   
>   	set_fs(USER_DS);
>   	current->flags &=
> -		~(PF_RANDOMIZE | PF_FORKNOEXEC | PF_KTHREAD | PF_NOFREEZE);
> +		~(PF_RANDOMIZE | PF_FORKNOEXEC | PF_KTHREAD | PF_NOFREEZE | PF_FREEZER_NOSIG);
>   	flush_thread();
>   	current->personality &= ~bprm->per_clear;
>   
>

Hi Oleg,

A couple of people have tested your patch and report if fixes the 
suspend/resume bug[0].  Thanks for the quick fix!  Will you be 
requesting this patch in the stable kernels?

Thanks again,

Joe


[0] https://bugs.launchpad.net/bugs/1080530

^ permalink raw reply	[flat|nested] 6+ messages in thread

* [PATCH -stable 0/1] freezer: PF_FREEZER_NOSIG should be cleared along with PF_NOFREEZE
  2012-12-06 20:44     ` Joseph Salisbury
@ 2012-12-07 14:49       ` Oleg Nesterov
  2012-12-07 14:49         ` [PATCH -stable 1/1] " Oleg Nesterov
  0 siblings, 1 reply; 6+ messages in thread
From: Oleg Nesterov @ 2012-12-07 14:49 UTC (permalink / raw)
  To: Joseph Salisbury, Greg Kroah-Hartman
  Cc: Ben Hutchings, Rafael J. Wysocki, Herton Krzesinski,
	linux-kernel, stable

On 12/06, Joseph Salisbury wrote:
>
> A couple of people have tested your patch and report if fixes the
> suspend/resume bug[0].

Great, thanks a lot.

> Will you be
> requesting this patch in the stable kernels?

I have to ;)

I tried to explain this in the changelog, but once again just in case...

This patch is only for -stable. It is only needed if a) b40a7959 was
backported and b) the kernel still has PF_FREEZER_NOSIG removed in 3.3.

Alernatively, b40a7959 can be reverted. But please note that this will
just hide the problem revealed by "incomplete" b40a7959.

Oleg.


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH -stable 1/1] freezer: PF_FREEZER_NOSIG should be cleared along with PF_NOFREEZE
  2012-12-07 14:49       ` [PATCH -stable 0/1] freezer: PF_FREEZER_NOSIG should be cleared along with PF_NOFREEZE Oleg Nesterov
@ 2012-12-07 14:49         ` Oleg Nesterov
  2012-12-09 23:04           ` Ben Hutchings
  2012-12-10 20:34           ` Greg Kroah-Hartman
  0 siblings, 2 replies; 6+ messages in thread
From: Oleg Nesterov @ 2012-12-07 14:49 UTC (permalink / raw)
  To: Joseph Salisbury, Greg Kroah-Hartman
  Cc: Ben Hutchings, Rafael J. Wysocki, Herton Krzesinski,
	linux-kernel, stable

This patch is only for pre-v3.3 stable trees which backported
b40a7959 "freezer: exec should clear PF_NOFREEZE along with PF_KTHREAD".
v3.3+ doesn't need this fix.

b40a7959 is the trivial bugfix, but unfortunately I forgot that
until 34b087e4 "freezer: kill unused set_freezable_with_signal()"
there were another only-for-kernel-threads flag, PF_FREEZER_NOSIG,
which should be cleared as well.

See https://bugs.launchpad.net/ubuntu/+source/v86d/+bug/1080530
The freezer fails because it expects that a PF_FREEZER_NOSIG task
doesn't need a signal. Before b40a7959 it wrongly succeeds leaving
the PF_NOFREEZE | PF_FREEZER_NOSIG task unfrozen.

Reported-and-tested-by: Joseph Salisbury <joseph.salisbury@canonical.com>
Cc: stable@vger.kernel.org # pre v3.3 if commit b40a7959 was taken
Signed-off-by: Oleg Nesterov <oleg@redhat.com>

--- a/fs/exec.c
+++ b/fs/exec.c
@@ -1084,7 +1084,7 @@ int flush_old_exec(struct linux_binprm *
 
 	set_fs(USER_DS);
 	current->flags &=
-		~(PF_RANDOMIZE | PF_FORKNOEXEC | PF_KTHREAD | PF_NOFREEZE);
+		~(PF_RANDOMIZE | PF_FORKNOEXEC | PF_KTHREAD | PF_NOFREEZE | PF_FREEZER_NOSIG);
 	flush_thread();
 	current->personality &= ~bprm->per_clear;
 


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH -stable 1/1] freezer: PF_FREEZER_NOSIG should be cleared along with PF_NOFREEZE
  2012-12-07 14:49         ` [PATCH -stable 1/1] " Oleg Nesterov
@ 2012-12-09 23:04           ` Ben Hutchings
  2012-12-10 20:34           ` Greg Kroah-Hartman
  1 sibling, 0 replies; 6+ messages in thread
From: Ben Hutchings @ 2012-12-09 23:04 UTC (permalink / raw)
  To: Oleg Nesterov
  Cc: Joseph Salisbury, Greg Kroah-Hartman, Rafael J. Wysocki,
	Herton Krzesinski, linux-kernel, stable

[-- Attachment #1: Type: text/plain, Size: 514 bytes --]

On Fri, 2012-12-07 at 15:49 +0100, Oleg Nesterov wrote:
> This patch is only for pre-v3.3 stable trees which backported
> b40a7959 "freezer: exec should clear PF_NOFREEZE along with PF_KTHREAD".
> v3.3+ doesn't need this fix.
[...]

Thanks very much, I've added this to the queue for 3.2.  However, in 3.2
PF_FORKNOEXEC is cleared by the binfmt code and not in fs/exec.c, and I
left that as it is.

Ben.

-- 
Ben Hutchings
It is impossible to make anything foolproof because fools are so ingenious.

[-- Attachment #2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 828 bytes --]

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH -stable 1/1] freezer: PF_FREEZER_NOSIG should be cleared along with PF_NOFREEZE
  2012-12-07 14:49         ` [PATCH -stable 1/1] " Oleg Nesterov
  2012-12-09 23:04           ` Ben Hutchings
@ 2012-12-10 20:34           ` Greg Kroah-Hartman
  1 sibling, 0 replies; 6+ messages in thread
From: Greg Kroah-Hartman @ 2012-12-10 20:34 UTC (permalink / raw)
  To: Oleg Nesterov
  Cc: Joseph Salisbury, Ben Hutchings, Rafael J. Wysocki,
	Herton Krzesinski, linux-kernel, stable

On Fri, Dec 07, 2012 at 03:49:22PM +0100, Oleg Nesterov wrote:
> This patch is only for pre-v3.3 stable trees which backported
> b40a7959 "freezer: exec should clear PF_NOFREEZE along with PF_KTHREAD".
> v3.3+ doesn't need this fix.
> 
> b40a7959 is the trivial bugfix, but unfortunately I forgot that
> until 34b087e4 "freezer: kill unused set_freezable_with_signal()"
> there were another only-for-kernel-threads flag, PF_FREEZER_NOSIG,
> which should be cleared as well.
> 
> See https://bugs.launchpad.net/ubuntu/+source/v86d/+bug/1080530
> The freezer fails because it expects that a PF_FREEZER_NOSIG task
> doesn't need a signal. Before b40a7959 it wrongly succeeds leaving
> the PF_NOFREEZE | PF_FREEZER_NOSIG task unfrozen.
> 
> Reported-and-tested-by: Joseph Salisbury <joseph.salisbury@canonical.com>
> Cc: stable@vger.kernel.org # pre v3.3 if commit b40a7959 was taken

>From what I can tell, 3.0-stable didn't take this patch, so it should be
fine.  Ben, I don't know about 3.2, you should check this.

Oleg, thanks for doing this work, much appreciated.

greg k-h

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2012-12-10 20:34 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <50BF9CC2.7070705@canonical.com>
     [not found] ` <1354762294.17107.157.camel@deadeye.wl.decadent.org.uk>
2012-12-06 12:42   ` freezer: exec should clear PF_NOFREEZE along with PF_KTHREAD Oleg Nesterov
2012-12-06 20:44     ` Joseph Salisbury
2012-12-07 14:49       ` [PATCH -stable 0/1] freezer: PF_FREEZER_NOSIG should be cleared along with PF_NOFREEZE Oleg Nesterov
2012-12-07 14:49         ` [PATCH -stable 1/1] " Oleg Nesterov
2012-12-09 23:04           ` Ben Hutchings
2012-12-10 20:34           ` Greg Kroah-Hartman

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).