Re: [PATCH] ext2: Don't export ext2_mask_flags() to user space

From: Mike Frysinger
Date: Sat Mar 24 2012 - 02:51:43 EST


On Thu, Mar 22, 2012 at 13:31, Al Viro wrote:
> On Thu, Mar 22, 2012 at 12:28:25PM -0400, Ted Ts'o wrote:
>> On Thu, Mar 22, 2012 at 08:00:41AM +0200, Artem Bityutskiy wrote:
>> > On Thu, 2012-03-22 at 06:53 +0100, Thierry Reding wrote:
>> > > What's the recommended fix for packages that cannot or will not use
>> > > libext2fs, like busybox? Copy the required parts into a private header
>> > > and use that instead?
>> >
>> > The normal way is to just keep a private copy of the whole header file.
>> > Because the on-disk format stays compatible, those programs do not have
>> > to update the header very often - only rarely if they want to support
>> > some new feature.
>>
>> Even if they're not iwlling to use libext2fs (for space reasons, I
>> would assume? ÂIt can't be because of license compatibility issues
>> since they are both GPLv2), they could just simply grab the ext2_fs.h
>> from e2fsprogs. ÂThat has all of the file system definitions for ext2,
>> ext3, and ext4.
>
> Ho-hum... ÂThen we could kill a lot of lines in include/linux/ext2_fs.h.
> I wonder how much of what remains has any business being outside of
> fs/ext2, actually - AFAICS, there are very few places that might possibly
> care:
>
> arch/blackfin/kernel/setup.c:595: Â Â Â if (*((unsigned short *)(mtd_phys + 0x438)) == EXT2_SUPER_MAGIC)
> fs/nfsd/nfs3proc.c:599: Â Â Â Â case EXT2_SUPER_MAGIC:
> fs/nfsd/nfs3proc.c:600: Â Â Â Â Â Â Â Â resp->p_link_max = EXT2_LINK_MAX;
> fs/nfsd/nfs3proc.c:601: Â Â Â Â Â Â Â Â resp->p_name_max = EXT2_NAME_LEN;
> init/do_mounts_rd.c:57: struct ext2_super_block *ext2sb;
> init/do_mounts_rd.c:70: ext2sb = (struct ext2_super_block *) buf;
> init/do_mounts_rd.c:153: Â Â Â Âif (ext2sb->s_magic == cpu_to_le16(EXT2_SUPER_MAGIC)) {
> init/do_mounts_rd.c:155: Â Â Â Â Â Â Â Â Â Â Â "RAMDISK: ext2 filesystem found at block %d\n",
> init/do_mounts_rd.c:157: Â Â Â Â Â Â Â Ânblocks = le32_to_cpu(ext2sb->s_blocks_count) <<
> init/do_mounts_rd.c:158: Â Â Â Â Â Â Â Â Â Â Â Âle32_to_cpu(ext2sb->s_log_block_size);
> security/selinux/hooks.c:2974: Âcase EXT2_IOC_GETFLAGS:
> security/selinux/hooks.c:2976: Âcase EXT2_IOC_GETVERSION:
> security/selinux/hooks.c:2980: Âcase EXT2_IOC_SETFLAGS:
> security/selinux/hooks.c:2982: Âcase EXT2_IOC_SETVERSION:
>
> and that's it. Âblackfin and do_mounts_rd are doing the same thing (blackfin -
> buggy, AFAICS).

buggy how ? they're not exactly the same as the Blackfin code is
setting things up for the uClinux MTD map. it isn't parsing the
filesystem itself (ignoring the size extraction from the superblock).

>ÂLooks like both are Âasking for something along the lines of
> sector_t detect_ext2(void *image), returning 0 if it's not one and size in
> kilobytes if it is...

yes, that would be fine
-mike
--
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/