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] [thread-next>] [day] [month] [year] [list]
Date:   Mon, 21 Dec 2020 20:07:32 +0100
From:   Pavel Machek <pavel@....cz>
To:     Dexuan Cui <decui@...rosoft.com>
Cc:     "linux-acpi@...r.kernel.org" <linux-acpi@...r.kernel.org>,
        "linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
        "linux-hyperv@...r.kernel.org" <linux-hyperv@...r.kernel.org>,
        Michael Kelley <mikelley@...rosoft.com>
Subject: Re: How can a userspace program tell if the system supports the ACPI
 S4 state (Suspend-to-Disk)?

On Sat 2020-12-12 01:20:30, Dexuan Cui wrote:
> Hi all,
> It looks like Linux can hibernate even if the system does not support the ACPI
> S4 state, as long as the system can shut down, so "cat /sys/power/state"
> always contains "disk", unless we specify the kernel parameter "nohibernate"
> or we use LOCKDOWN_HIBERNATION.
> 
> In some scenarios IMO it can still be useful if the userspace is able to detect
> if the ACPI S4 state is supported or not, e.g. when a Linux guest runs on 
> Hyper-V, Hyper-V uses the virtual ACPI S4 state as an indicator of the proper
> support of the tool stack on the host, i.e. the guest is discouraged from 
> trying hibernation if the state is not supported.

Umm. Does not sound like exactly strong reason to me.

If ACPI S4 is special to the hypervisor, perhaps that should be
reported to userspace...?

> I know we can check the S4 state by 'dmesg':
> 
> # dmesg |grep ACPI: | grep support
> [    3.034134] ACPI: (supports S0 S4 S5)
> 
> But this method is unreliable because the kernel msg buffer can be filled
> and overwritten. Is there any better method? If not, do you think if the
> below patch is appropriate? Thanks!


> @@ -600,8 +601,12 @@ static ssize_t state_show(struct kobject *kobj, struct kobj_attribute *attr,
>                         s += sprintf(s,"%s ", pm_states[i]);
> 
>  #endif
> -       if (hibernation_available())
> -               s += sprintf(s, "disk ");
> +       if (hibernation_available()) {
> +               if (acpi_sleep_state_supported(ACPI_STATE_S4))
> +                       s += sprintf(s, "disk+ ");
> +               else
> +                       s += sprintf(s, "disk ");
> +       }
>         if (s != buf)

Will this compile on all the systems?

Certainly needs documentation.

Plus if ACPI S4 is supported, kernel can support both normal
hibernation and ACPI S4... so perhaps it should list two entries? And
"disk+" sounds wrong, "acpidisk"?

...and that would bring next question. Usespace writes "disk" there
and uses different file to select between S4 and S5...

								Pavel
-- 
http://www.livejournal.com/~pavelmachek

Download attachment "signature.asc" of type "application/pgp-signature" (182 bytes)

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ