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, 27 May 2024 10:54:52 +0000
From: "Sukrit.Bhatnagar@...y.com" <Sukrit.Bhatnagar@...y.com>
To: Chris Li <chrisl@...nel.org>
CC: "Rafael J. Wysocki" <rafael@...nel.org>, Pavel Machek <pavel@....cz>,
        Christian Brauner <brauner@...nel.org>,
        "Darrick J. Wong"
	<djwong@...nel.org>,
        Andrew Morton <akpm@...ux-foundation.org>,
        "linux-xfs@...r.kernel.org" <linux-xfs@...r.kernel.org>,
        "linux-pm@...r.kernel.org" <linux-pm@...r.kernel.org>,
        linux-fsdevel
	<linux-fsdevel@...r.kernel.org>,
        linux-kernel <linux-kernel@...r.kernel.org>,
        linux-mm <linux-mm@...ck.org>
Subject: RE: [PATCH 1/2] iomap: swap: print warning for unaligned swapfile

Hi Chris,

On 2024-05-23 03:02, Chris Li wrote:
> Hi Sukrit,
> 
> It seems that you need the swap file block start address to read the
> swap file headers.
> This warning still requires the user to read the dmesg. The kernel
> still does not have the swapfile header at resume. In other words, it
> does not fix the issue.

This was not intended to be a fix.

I had created this patch thinking that adding an actual fix for this might
be non-trivial and may not be desirable to everyone, especially when
swapfile+hibernation is not commonly used.

> I don't know the suspend/resume code enough, will adding recording the
> physical start address of the swapfile in swap_info_struct help you
> address this problem? The suspend code can write that value to
> "somewhere* for resume to pick it up.
> 
> Let's find a proper way to fix this issue rather than just warning on it.
 
Adding a new member in swap_info_struct for the physical block offset
will help in the fix, I think. It can even be enclosed in #ifdef HIBERNATION
if nothing else needs that value.
This value can be checked by hibernate[1] as:
    sis->start_offset == first_se(sis)->start_block

Another possible solution might be to add a new swap flag like SWP_SUSP
or SWP_HIBERNATE and set it only when we don't have this rounding up
issue.

Since we will boot the kernel normally first and later switch to our
pre-hibernate kernel after image load from swap, the value cannot be
set inside the kernel memory.
We pass the start block address in kernel commandline parameter
(resume_offset) for next boot.

[1]: The hibernate swapfile checking code is the function
    swap_type_of() in mm/swapfile.c

--
Sukrit

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ