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]
Message-ID: <SA1PR21MB13359F44D6EB8037117F9F31BFC39@SA1PR21MB1335.namprd21.prod.outlook.com>
Date:   Sat, 14 Jan 2023 00:11:37 +0000
From:   Dexuan Cui <decui@...rosoft.com>
To:     "Rafael J. Wysocki" <rafael@...nel.org>,
        Shradha Gupta <shradhagupta@...ux.microsoft.com>
CC:     "linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
        "linux-pm@...r.kernel.org" <linux-pm@...r.kernel.org>,
        Pavel Machek <pavel@....cz>, Len Brown <len.brown@...el.com>,
        "Michael Kelley (LINUX)" <mikelley@...rosoft.com>
Subject: RE: [PATCH] kernel: power: swap: Suppress expected 'Image not found'
 error on Ubuntu

> From: Rafael J. Wysocki <rafael@...nel.org>
> Sent: Friday, January 13, 2023 12:14 PM
> To: Shradha Gupta <shradhagupta@...ux.microsoft.com>
> Cc: linux-kernel@...r.kernel.org; linux-pm@...r.kernel.org; Rafael J. Wysocki
> <rafael@...nel.org>; Pavel Machek <pavel@....cz>; Len Brown
> <len.brown@...el.com>; Dexuan Cui <decui@...rosoft.com>; Michael Kelley
> (LINUX) <mikelley@...rosoft.com>
> Subject: Re: [PATCH] kernel: power: swap: Suppress expected 'Image not
> found' error on Ubuntu
> 
> On Thu, Dec 15, 2022 at 7:20 AM Shradha Gupta
> <shradhagupta@...ux.microsoft.com> wrote:
> >
> > In 'systemctl hibernate' if resume device is written to the sysfs
> > resume parameter, a software_resume() call is triggerred. This call
> > is expected to fail in swsusp_check() call with -EBUSY error and an
> > 'Image not found' error message. This fix suppresses the expected
> > failure message from getting logged in Ubuntu setups where
> > CONFIG_DYNAMIC_DEBUG is enabled by default.
> 
> I see what you mean, so what about this change instead (modulo
> GMail-induced white-space breakage):
> 
> ---
>  kernel/power/swap.c |    9 ++++-----
>  1 file changed, 4 insertions(+), 5 deletions(-)
> 
> Index: linux-pm/kernel/power/swap.c
> ================================================================
> ===
> --- linux-pm.orig/kernel/power/swap.c
> +++ linux-pm/kernel/power/swap.c
> @@ -1546,17 +1546,16 @@ int swsusp_check(void)
>          }
> 
>  put:
> -        if (error)
> +        if (error) {
>              blkdev_put(hib_resume_bdev, FMODE_READ | FMODE_EXCL);
> -        else
> +            pr_debug("Image not found (code %d)\n", error);
> +        } else {
>              pr_debug("Image signature found, resuming\n");
> +        }
>      } else {
>          error = PTR_ERR(hib_resume_bdev);
>      }
> 
> -    if (error)
> -        pr_debug("Image not found (code %d)\n", error);
> -
>      return error;
>  }

software_resume() -> swsusp_check() can be used in 2 scenarios: 

1) After a VM hibernated and powered off, we start the VM, and the script 
in initrd writes to the sys file 'resume', so resume_store() -> 
software_resume() is called to resume the VM. In this scenario, if
software_resume() -> swsusp_check() -> blkdev_get_by_dev() hits an
error, we still want to see the message "Image not found", but with the
new proposed change, the message is not printed. With Shradha's change,
the message is printed.

2) When we run "systemctl hibernate", systemctl writes to the 'resume' sys
file, so resume_store() -> software_resume() -> swsusp_check() is called.
Here typically the swap file/partition is already in use as the swap space, so
the blkdev_get_by_dev() in swsusp_check() always fails with -EBUSY. This is
the scenario we want to suppress the misleading "Image not found" message.

IIUC, Shradha's change is better.

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ