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] [day] [month] [year] [list]
Date:   Mon, 27 Apr 2020 10:43:58 +0200
From:   "Rafael J. Wysocki" <rafael@...nel.org>
To:     Bart Van Assche <bvanassche@....org>
Cc:     "Rafael J. Wysocki" <rjw@...ysocki.net>,
        Dexuan Cui <decui@...rosoft.com>,
        Linux PM <linux-pm@...r.kernel.org>,
        Len Brown <len.brown@...el.com>, Pavel Machek <pavel@....cz>,
        Michael Kelley <mikelley@...rosoft.com>, longli@...rosoft.com,
        Linux Kernel Mailing List <linux-kernel@...r.kernel.org>,
        Ming Lei <ming.lei@...hat.com>, wei.liu@...nel.org,
        Stephen Hemminger <sthemmin@...rosoft.com>,
        Haiyang Zhang <haiyangz@...rosoft.com>,
        KY Srinivasan <kys@...rosoft.com>,
        Stable <stable@...r.kernel.org>
Subject: Re: [PATCH] PM: hibernate: Freeze kernel threads in software_resume()

On Sun, Apr 26, 2020 at 8:34 PM Bart Van Assche <bvanassche@....org> wrote:
>
> On 2020-04-26 09:24, Rafael J. Wysocki wrote:
> > On Friday, April 24, 2020 5:40:16 AM CEST Dexuan Cui wrote:
> >> Currently the kernel threads are not frozen in software_resume(), so
> >> between dpm_suspend_start(PMSG_QUIESCE) and resume_target_kernel(),
> >> system_freezable_power_efficient_wq can still try to submit SCSI
> >> commands and this can cause a panic since the low level SCSI driver
> >> (e.g. hv_storvsc) has quiesced the SCSI adapter and can not accept
> >> any SCSI commands: https://lkml.org/lkml/2020/4/10/47
> >>
> >> At first I posted a fix (https://lkml.org/lkml/2020/4/21/1318) trying
> >> to resolve the issue from hv_storvsc, but with the help of
> >> Bart Van Assche, I realized it's better to fix software_resume(),
> >> since this looks like a generic issue, not only pertaining to SCSI.
> >>
> >> Cc: Bart Van Assche <bvanassche@....org>
> >> Cc: stable@...r.kernel.org
> >> Signed-off-by: Dexuan Cui <decui@...rosoft.com>
> >> ---
> >>  kernel/power/hibernate.c | 7 +++++++
> >>  1 file changed, 7 insertions(+)
> >>
> >> diff --git a/kernel/power/hibernate.c b/kernel/power/hibernate.c
> >> index 86aba8706b16..30bd28d1d418 100644
> >> --- a/kernel/power/hibernate.c
> >> +++ b/kernel/power/hibernate.c
> >> @@ -898,6 +898,13 @@ static int software_resume(void)
> >>      error = freeze_processes();
> >>      if (error)
> >>              goto Close_Finish;
> >> +
> >> +    error = freeze_kernel_threads();
> >> +    if (error) {
> >> +            thaw_processes();
> >> +            goto Close_Finish;
> >> +    }
> >> +
> >>      error = load_image_and_restore();
> >>      thaw_processes();
> >>   Finish:
> >
> > Applied as a fix for 5.7-rc4, thanks!
>
> Hi Rafael,
>
> What is not clear to me is how kernel threads are thawed after
> load_image_and_restore() has finished? Should a comment perhaps be added
> above the freeze_kernel_threads() call that explains how
> thaw_kernel_threads() is invoked after load_image_and_restore() has
> finished?

It isn't, because that is not necessary.

thaw_processes() will thaw them along with the user space.

Cheers!

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ