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]
Date:	Sun, 28 Sep 2008 16:18:35 +0100 (BST)
From:	Hugh Dickins <hugh@...itas.com>
To:	Vegard Nossum <vegard.nossum@...il.com>
cc:	linux-kernel@...r.kernel.org
Subject: Re: Swap on loop device on tmpfs locks up machine

On Fri, 26 Sep 2008, Vegard Nossum wrote:
> 
> It turns out that swap over loop device on tmpfs will lock up the
> machine. That is, all programs become blocked, but I can still do
> things like switch VT consoles.
> 
> To reproduce (as root):
> 
>     mount -t tmpfs tmpfs /mnt
>     dd if=/dev/zero of=/mnt/disk
>     swapoff -a
>     losetup -f /mnt/disk
>     mkswap /dev/loop0 # replace loop0 with actual loop device
>     swapon /dev/loop0
>     <memory hog, like continuous malloc()>
> 
> I'm not sure it's really a very good idea to do this in the first
> place, but should something give a warning or prevent a user from
> doing it?

It's just a "don't do that" in my opinion, and it doesn't seem
to have caused much trouble for sysadmins down the years.

It's good to have a loop driver that can make regular files look
like block devices, and it's good to have that working on tmpfs;
and I'm glad that trying to swapon a tmpfs file directly just
happens to fail because tmpfs doesn't support bmap().

But I don't think it's worth adding in some "valid for swap" call
to block devices, and saying no when loop or when loop over tmpfs.
Trying to swap to loop over tmpfs is a particularly clear example
of something that will end badly - unless the tmpfs file is locked
in memory? haven't tried that - but I wouldn't recommend swapping
to loop over anything (it interposes levels between swap and device
which just increase the likelihood of hang).

Just don't do that.

Hugh
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ