Re: Swap Questions (includes possible bug) - swapfile.c / swap.c

Manfred Spraul
1999-05-12T10:30:51Z

>On Tue, 11 May 1999, Joseph Pranevich wrote:
> case 2:
> error = -EINVAL;
> if (swap_header->info.nr_badpages > MAX_SWAP_BADPAGES)
> goto bad_swap;

MAX_SWAP_BADPAGES is a limitation of the swap format 2,
it's not a kernel limitation. (check include/linux/swap.h)

Rik wrote:
>On Tue, 11 May 1999, Joseph Pranevich wrote:
>> set_blocksize(p->swap_device, PAGE_SIZE);
>
>Hmm, haven't we seen this one before? Stephen?

There is another problem with this line:
set_blocksize() also means that the previous block size
doesn't work anymore:
if you accidentially enter 'swapon /dev/hda1' (my root drive)
instead of 'swapon /dev/hda3', then you have to fsck:
sys_swapon sets the blocksize, then it rejects the call
because there is no swap signature, but now ext2
can't access the partition (blocksize 4096, ext2 needs 1024).

I've posted a patch a few weeks ago, but I received no reply.

Are such problems ignored? (The super user can crash the
machine at will, one more crash doesn't matter)

Regards,
Manfred