NetBSD-Bugs archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: bin/57921: swapon: Do not overwrite Linux swap header



The following reply was made to PR bin/57921; it has been noted by GNATS.

From: Ricardo Branco <rbranco%suse.de@localhost>
To: gnats-bugs%netbsd.org@localhost, gnats-admin%netbsd.org@localhost, netbsd-bugs%netbsd.org@localhost
Cc: 
Subject: Re: bin/57921: swapon: Do not overwrite Linux swap header
Date: Sat, 10 Feb 2024 21:54:43 +0100

 You're right.
 
 Closing PR.
 
 Thanks!
 
 On 2/10/24 21:40, matthew green wrote:
 > The following reply was made to PR bin/57921; it has been noted by GNATS.
 >
 > From: matthew green <mrg%eterna23.net@localhost>
 > To: gnats-bugs%netbsd.org@localhost
 > Cc: gnats-admin%netbsd.org@localhost, netbsd-bugs%netbsd.org@localhost
 > Subject: re: bin/57921: swapon: Do not overwrite Linux swap header
 > Date: Sun, 11 Feb 2024 07:36:47 +1100
 >
 >   i'm confused.  we skip the first PAGE_SIZE bytes on block devices,
 >   ie, any mbr or gpt accessed for this would be a block device.
 >   
 >   so netbsd shouldn't overwrite the first 4096 bytes if it sees
 >   this as a partition, not a file.  *files* are used from the first
 >   moment.  see uvm_swap.c:
 >   
 >            * for block special files, we want to make sure that leave
 >            * the disklabel and bootblocks alone, so we arrange to skip
 >            * over them (arbitrarily choosing to skip PAGE_SIZE bytes).
 >            * note that because of this the "size" can be less than the
 >            * actual number of blocks on the device.
 >            */
 >           if (vp->v_type == VBLK) {
 >                   /* we use pages 1 to (size - 1) [inclusive] */
 >                   size = npages - 1;
 >                   addr = 1;
 >           } else {
 >                   /* we use pages 0 to (size - 1) [inclusive] */
 >                   size = npages;
 >                   addr = 0;
 >   
 >   if that's failing some how, we should fix that problem.
 >   
 >   i'm OK with better support for linux swap, but it shouldn't need to
 >   create a random wedge to do this.  it should be just workable easily.
 >   
 >   
 >   .mrg.
 >   
 


Home | Main Index | Thread Index | Old Index