Re: chmod of active swap file blocks

From: Paul Jakma
Date: Mon Dec 29 2003 - 12:27:02 EST


On Mon, 29 Dec 2003, Andrew Morton wrote:

> The kernel holds the swapfile's i_sem while it is in use. This is
> to prevent the filesystem destruction which would result if some
> silly person were to truncate a swapfile while it was in active
> use.

Ah, ok. /sort/ of makes sense..

> It is not a particularly important safety feature ("don't do that")
> and it can be taken out if it is causing serious side-effects.

though i'd err more on the side of "dont do that" :)

> Is chmod of an in-use swapfile an important thing to be able to do?

Had a box under memory pressure and had to add a swapfile to relieve
said pressure. Noticed afterwards that it had been created under
umask 0022 - not good, and the chmod to remove read rights for all
blocked. Thankfully, it was my desktop, not a multiple user server :)

I dont know, I think I'd prefer ability to change attributes of the
swap file while its still swapped - there are many other, and far
more catastrophic, ways for root to kill the box, does it make sense
to guard against this one if it interferes with normal operations?

regards,
--
Paul Jakma paul@xxxxxxxx paul@xxxxxxxxx Key ID: 64A2FF6A
warning: do not ever send email to spam@xxxxxxxxxx
Fortune:
"...and scantily clad females, of course. Who cares if it's below zero
outside"
(By Linus Torvalds)
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/