Re: [PATCH] switch_root: verify initramfs by f_type, not devno

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

 



Am 03.04.2014 03:38, schrieb Dave Reisner:
> On Wed, Apr 02, 2014 at 10:41:30AM -0400, Dave Reisner wrote:
>> As of linux 3.14, the initramfs device will have both major and
>> minor 0, causing our paranoia check to fail. Make this version agnostic
>> by checking the filesystem type, rather than a device number.
>>
>> Signed-off-by: Dave Reisner <dreisner@xxxxxxxxxxxxx>
>> ---
>> This is essentially what busybox's switch_root does. I don't think there's much
>> value in checking the devno at all, as it seems to be a needless restriction.
>> Let's just allow deleting anything that looks like non-persistent storage.
> 
> A bisect of the kernel reveals that 9e30cc9595303 is the responsible
> change. It seems the kernel maintains its own mounts which are never
> exposed to userspace (which also would explain the FSID gaps in
> /proc/self/mountinfo). An instance of sysfs used to be one of these
> kernel only mounts but, for some time now, has not needed to be. The
> mentioned commit removes this kern_mount() call for sysfs, making the
> initramfs the first entry in the mount table -- FSID 0 instead of 1.
> 
> I guess FSIDs are about as reliable as the numbering on block devices,
> and this comparison in switch_root was never really the right
> approach...

Thanks for getting to the bottom of this Dave. I guess going the way of
busybox (checking for RAMFS or TMPFS) is the right thing to do, as your
patch suggests.


Attachment: signature.asc
Description: OpenPGP digital signature


[Index of Archives]     [Netdev]     [Ethernet Bridging]     [Linux Wireless]     [Kernel Newbies]     [Security]     [Linux for Hams]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux Admin]     [Samba]

  Powered by Linux