31 Jul, 2020

3 commits


30 Jul, 2020

1 commit


16 Jul, 2020

1 commit


24 Mar, 2020

1 commit

  • There is no good reason for __bdevname to exist. Just open code
    printing the string in the callers. For three of them the format
    string can be trivially merged into existing printk statements,
    and in init/do_mounts.c we can at least do the scnprintf once at
    the start of the function, and unconditional of CONFIG_BLOCK to
    make the output for tiny configfs a little more helpful.

    Acked-by: Theodore Ts'o # for ext4
    Signed-off-by: Christoph Hellwig
    Signed-off-by: Jens Axboe

    Christoph Hellwig
     

17 Dec, 2019

1 commit

  • The "trivial conversion" in commit cccaa5e33525 ("init: use do_mount()
    instead of ksys_mount()") was totally broken, since it didn't handle the
    case of a NULL mount data pointer. And while I had "tested" it (and
    presumably Dominik had too) that bug was hidden by me having options.

    Cc: Dominik Brodowski
    Cc: Arnd Bergmann
    Reported-by: Ondřej Jirman
    Reported-by: Guenter Roeck
    Reported-by: Naresh Kamboju
    Reported-and-tested-by: Borislav Petkov
    Tested-by: Chris Clayton
    Tested-by: Eric Biggers
    Tested-by: Geert Uytterhoeven
    Tested-by: Guido Günther
    Signed-off-by: Linus Torvalds

    Linus Torvalds
     

12 Dec, 2019

2 commits

  • In prepare_namespace(), do_mount() can be used instead of ksys_mount()
    as the first and third argument are const strings in the kernel, the
    second and fourth argument are passed through anyway, and the fifth
    argument is NULL.

    In do_mount_root(), ksys_mount() is called with the first and third
    argument being already kernelspace strings, which do not need to be
    copied over from userspace to kernelspace (again). The second and
    fourth arguments are passed through to do_mount() anyway. The fifth
    argument, while already residing in kernelspace, needs to be put into
    a page of its own. Then, do_mount() can be used instead of
    ksys_mount().

    Once this is done, there are no in-kernel users to ksys_mount() left,
    which can therefore be removed.

    Signed-off-by: Dominik Brodowski

    Dominik Brodowski
     
  • In devtmpfs, do_mount() can be called directly instead of complex wrapping
    by ksys_mount():
    - the first and third arguments are const strings in the kernel,
    and do not need to be copied over from userspace;
    - the fifth argument is NULL, and therefore no page needs to be
    copied over from userspace;
    - the second and fourth argument are passed through anyway.

    Signed-off-by: Dominik Brodowski

    Dominik Brodowski
     

03 Oct, 2019

1 commit

  • Add a new virtual device named /dev/cifs (0xfe) to tell the kernel to
    mount the root file system over the network by using SMB protocol.

    cifs_root_data() will be responsible to retrieve the parsed
    information of the new command-line option (cifsroot=) and then call
    do_mount_root() with the appropriate mount options for cifs.ko.

    Signed-off-by: Paulo Alcantara (SUSE)
    Signed-off-by: David S. Miller

    Paulo Alcantara (SUSE)
     

13 Sep, 2019

1 commit

  • Convert the ramfs, shmem, tmpfs, devtmpfs and rootfs filesystems to the new
    internal mount API as the old one will be obsoleted and removed. This
    allows greater flexibility in communication of mount parameters between
    userspace, the VFS and the filesystem.

    See Documentation/filesystems/mount_api.txt for more information.

    Note that tmpfs is slightly tricky as it can contain embedded commas, so it
    can't be trivially split up using strsep() to break on commas in
    generic_parse_monolithic(). Instead, tmpfs has to supply its own generic
    parser.

    However, if tmpfs changes, then devtmpfs and rootfs, which are wrappers
    around tmpfs or ramfs, must change too - and thus so must ramfs, so these
    had to be converted also.

    [AV: rewritten]

    Signed-off-by: David Howells
    cc: Hugh Dickins
    cc: linux-mm@kvack.org
    Signed-off-by: Al Viro

    David Howells
     

06 Sep, 2019

2 commits


20 Jul, 2019

1 commit

  • Pull vfs mount updates from Al Viro:
    "The first part of mount updates.

    Convert filesystems to use the new mount API"

    * 'work.mount0' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs: (63 commits)
    mnt_init(): call shmem_init() unconditionally
    constify ksys_mount() string arguments
    don't bother with registering rootfs
    init_rootfs(): don't bother with init_ramfs_fs()
    vfs: Convert smackfs to use the new mount API
    vfs: Convert selinuxfs to use the new mount API
    vfs: Convert securityfs to use the new mount API
    vfs: Convert apparmorfs to use the new mount API
    vfs: Convert openpromfs to use the new mount API
    vfs: Convert xenfs to use the new mount API
    vfs: Convert gadgetfs to use the new mount API
    vfs: Convert oprofilefs to use the new mount API
    vfs: Convert ibmasmfs to use the new mount API
    vfs: Convert qib_fs/ipathfs to use the new mount API
    vfs: Convert efivarfs to use the new mount API
    vfs: Convert configfs to use the new mount API
    vfs: Convert binfmt_misc to use the new mount API
    convenience helper: get_tree_single()
    convenience helper get_tree_nodev()
    vfs: Kill sget_userns()
    ...

    Linus Torvalds
     

05 Jul, 2019

3 commits

  • No point having two call sites (earlier in init_rootfs() from
    mnt_init() in case we are going to use shmem-style rootfs,
    later from do_basic_setup() unconditionally), along with the
    logics in shmem_init() itself to make the second call a no-op...

    Signed-off-by: Al Viro

    Al Viro
     
  • init_mount_tree() can get to rootfs_fs_type directly and that simplifies
    a lot of things. We don't need to register it, we don't need to look
    it up *and* we don't need to bother with preventing subsequent userland
    mounts. That's the way we should've done that from the very beginning.

    There is a user-visible change, namely the disappearance of "rootfs"
    from /proc/filesystems. Note that it's been unmountable all along
    and it didn't show up in /proc/mounts; however, it *is* a user-visible
    change and theoretically some script might've been using its presence
    in /proc/filesystems to tell 2.4.11+ from earlier kernels.

    *IF* any complaints about behaviour change do show up, we could fake
    it in /proc/filesystems. I very much doubt we'll have to, though.

    Signed-off-by: Al Viro

    Al Viro
     
  • the only thing done by the latter is making ramfs visible
    to mount(2); we don't need it there - rootfs is separate
    and, in fact, made visible to mount(2) in the same init_rootfs().

    Signed-off-by: Al Viro

    Al Viro
     

21 May, 2019

1 commit

  • Add SPDX license identifiers to all files which:

    - Have no license information of any form

    - Have EXPORT_.*_SYMBOL_GPL inside which was used in the
    initial scan/conversion to ignore the file

    These files fall under the project license, GPL v2 only. The resulting SPDX
    license identifier is:

    GPL-2.0-only

    Signed-off-by: Thomas Gleixner
    Signed-off-by: Greg Kroah-Hartman

    Thomas Gleixner
     

21 Dec, 2018

1 commit


31 Oct, 2018

1 commit

  • Support referencing the root partition label from GPT as argument
    to the root= option on the kernel command line in analogy to
    referencing the partition uuid as root=PARTUUID=.

    Specifying the partition label instead of the uuid is often much
    easier, e.g. in embedded environments when there is an
    A/B rootfs partition scheme for interruptible firmware updates
    (i.e. rootfsA/ rootfsB).

    The partition label can be queried with the blkid command.

    Link: http://lkml.kernel.org/r/20180822060904.828E510665E@pc-niv.weinmann.com
    Signed-off-by: Nikolaus Voss
    Reviewed-by: Andrew Morton
    Cc: Dominik Brodowski
    Cc: Sasha Levin
    Cc: Al Viro
    Cc: Jens Axboe
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Nikolaus Voss
     

23 Aug, 2018

1 commit

  • Sparse checking used to be disabled on init/do_mounts.c and a few related
    files because "Many of the syscalls used in this file expect some of the
    arguments to be __user pointers not __kernel pointers".

    However since 28128c61e ("kconfig.h: Include compiler types to avoid
    missed struct attributes") the checks are, in fact, not disabled anymore
    because of the more early include of "linux/compiler_types.h"

    So remove the now ineffective #undefery that was done to disable these
    warnings, as well as the associated comment.

    Link: http://lkml.kernel.org/r/20180617115355.53799-1-luc.vanoostenryck@gmail.com
    Signed-off-by: Luc Van Oostenryck
    Cc: Dominik Brodowski
    Cc: Al Viro
    Cc: Kees Cook
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Luc Van Oostenryck
     

03 Apr, 2018

7 commits

  • Using this helper allows us to avoid the in-kernel calls to the
    sys_read() syscall. The ksys_ prefix denotes that this function
    is meant as a drop-in replacement for the syscall. In particular, it
    uses the same calling convention as sys_read().

    This patch is part of a series which removes in-kernel calls to syscalls.
    On this basis, the syscall entry path can be streamlined. For details, see
    http://lkml.kernel.org/r/20180325162527.GA17492@light.dominikbrodowski.net

    Cc: Alexander Viro
    Signed-off-by: Dominik Brodowski

    Dominik Brodowski
     
  • Using this helper allows us to avoid the in-kernel calls to the
    sys_ioctl() syscall. The ksys_ prefix denotes that this function
    is meant as a drop-in replacement for the syscall. In particular, it
    uses the same calling convention as sys_ioctl().

    After careful review, at least some of these calls could be converted
    to do_vfs_ioctl() in future.

    This patch is part of a series which removes in-kernel calls to syscalls.
    On this basis, the syscall entry path can be streamlined. For details, see
    http://lkml.kernel.org/r/20180325162527.GA17492@light.dominikbrodowski.net

    Cc: Alexander Viro
    Signed-off-by: Dominik Brodowski

    Dominik Brodowski
     
  • Using this wrapper allows us to avoid the in-kernel calls to the
    sys_open() syscall. The ksys_ prefix denotes that this function is meant
    as a drop-in replacement for the syscall. In particular, it uses the
    same calling convention as sys_open().

    This patch is part of a series which removes in-kernel calls to syscalls.
    On this basis, the syscall entry path can be streamlined. For details, see
    http://lkml.kernel.org/r/20180325162527.GA17492@light.dominikbrodowski.net

    Cc: Al Viro
    Cc: Andrew Morton
    Signed-off-by: Dominik Brodowski

    Dominik Brodowski
     
  • Using the ksys_close() wrapper allows us to get rid of in-kernel calls
    to the sys_close() syscall. The ksys_ prefix denotes that this function
    is meant as a drop-in replacement for the syscall. In particular, it
    uses the same calling convention as sys_close(), with one subtle
    difference:

    The few places which checked the return value did not care about the return
    value re-writing in sys_close(), so simply use a wrapper around
    __close_fd().

    This patch is part of a series which removes in-kernel calls to syscalls.
    On this basis, the syscall entry path can be streamlined. For details, see
    http://lkml.kernel.org/r/20180325162527.GA17492@light.dominikbrodowski.net

    Cc: Al Viro
    Cc: Andrew Morton
    Signed-off-by: Dominik Brodowski

    Dominik Brodowski
     
  • Using this helper allows us to avoid the in-kernel calls to the sys_chdir()
    syscall. The ksys_ prefix denotes that this function is meant as a drop-in
    replacement for the syscall. In particular, it uses the same calling
    convention as sys_chdir().

    This patch is part of a series which removes in-kernel calls to syscalls.
    On this basis, the syscall entry path can be streamlined. For details, see
    http://lkml.kernel.org/r/20180325162527.GA17492@light.dominikbrodowski.net

    Cc: Al Viro
    Cc: Andrew Morton
    Signed-off-by: Dominik Brodowski

    Dominik Brodowski
     
  • Using this helper allows us to avoid the in-kernel calls to the
    sys_chroot() syscall. The ksys_ prefix denotes that this function is
    meant as a drop-in replacement for the syscall. In particular, it uses the
    same calling convention as sys_chroot().

    In the near future, the fs-external callers of ksys_chroot() should be
    converted to use kern_path()/set_fs_root() directly. Then ksys_chroot()
    can be moved within sys_chroot() again.

    This patch is part of a series which removes in-kernel calls to syscalls.
    On this basis, the syscall entry path can be streamlined. For details, see
    http://lkml.kernel.org/r/20180325162527.GA17492@light.dominikbrodowski.net

    Cc: Alexander Viro
    Signed-off-by: Dominik Brodowski

    Dominik Brodowski
     
  • Using this helper allows us to avoid the in-kernel calls to the sys_mount()
    syscall. The ksys_ prefix denotes that this function is meant as a drop-in
    replacement for the syscall. In particular, it uses the same calling
    convention as sys_mount().

    In the near future, all callers of ksys_mount() should be converted to call
    do_mount() directly.

    This patch is part of a series which removes in-kernel calls to syscalls.
    On this basis, the syscall entry path can be streamlined. For details, see
    http://lkml.kernel.org/r/20180325162527.GA17492@light.dominikbrodowski.net

    Cc: Alexander Viro
    Signed-off-by: Dominik Brodowski

    Dominik Brodowski
     

16 Nov, 2017

1 commit

  • Convert all allocations that used a NOTRACK flag to stop using it.

    Link: http://lkml.kernel.org/r/20171007030159.22241-3-alexander.levin@verizon.com
    Signed-off-by: Sasha Levin
    Cc: Alexander Potapenko
    Cc: Eric W. Biederman
    Cc: Michal Hocko
    Cc: Pekka Enberg
    Cc: Steven Rostedt
    Cc: Tim Hansen
    Cc: Vegard Nossum
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Levin, Alexander (Sasha Levin)
     

17 Jul, 2017

2 commits

  • Differentiate the MS_* flags passed to mount(2) from the internal flags set
    in the super_block's s_flags. s_flags are now called SB_*, with the names
    and the values for the moment mirroring the MS_* flags that they're
    equivalent to.

    In this patch, just the headers are altered and some kernel code where
    blind automated conversion isn't necessarily correct.

    Note that this shows up some interesting issues:

    (1) Some MS_* flags get translated to MNT_* flags (such as MS_NODEV ->
    MNT_NODEV) without passing this on to the filesystem, but some
    filesystems set such flags anyway.

    (2) The ->remount_fs() methods of some filesystems adjust the *flags
    argument by setting MS_* flags in it, such as MS_NOATIME - but these
    flags are then scrubbed by do_remount_sb() (only the occupants of
    MS_RMT_MASK are permitted: MS_RDONLY, MS_SYNCHRONOUS, MS_MANDLOCK,
    MS_I_VERSION and MS_LAZYTIME)

    I'm not sure what's the best way to solve all these cases.

    Suggested-by: Al Viro
    Signed-off-by: David Howells

    David Howells
     
  • Firstly by applying the following with coccinelle's spatch:

    @@ expression SB; @@
    -SB->s_flags & MS_RDONLY
    +sb_rdonly(SB)

    to effect the conversion to sb_rdonly(sb), then by applying:

    @@ expression A, SB; @@
    (
    -(!sb_rdonly(SB)) && A
    +!sb_rdonly(SB) && A
    |
    -A != (sb_rdonly(SB))
    +A != sb_rdonly(SB)
    |
    -A == (sb_rdonly(SB))
    +A == sb_rdonly(SB)
    |
    -!(sb_rdonly(SB))
    +!sb_rdonly(SB)
    |
    -A && (sb_rdonly(SB))
    +A && sb_rdonly(SB)
    |
    -A || (sb_rdonly(SB))
    +A || sb_rdonly(SB)
    |
    -(sb_rdonly(SB)) != A
    +sb_rdonly(SB) != A
    |
    -(sb_rdonly(SB)) == A
    +sb_rdonly(SB) == A
    |
    -(sb_rdonly(SB)) && A
    +sb_rdonly(SB) && A
    |
    -(sb_rdonly(SB)) || A
    +sb_rdonly(SB) || A
    )

    @@ expression A, B, SB; @@
    (
    -(sb_rdonly(SB)) ? 1 : 0
    +sb_rdonly(SB)
    |
    -(sb_rdonly(SB)) ? A : B
    +sb_rdonly(SB) ? A : B
    )

    to remove left over excess bracketage and finally by applying:

    @@ expression A, SB; @@
    (
    -(A & MS_RDONLY) != sb_rdonly(SB)
    +(bool)(A & MS_RDONLY) != sb_rdonly(SB)
    |
    -(A & MS_RDONLY) == sb_rdonly(SB)
    +(bool)(A & MS_RDONLY) == sb_rdonly(SB)
    )

    to make comparisons against the result of sb_rdonly() (which is a bool)
    work correctly.

    Signed-off-by: David Howells

    David Howells
     

13 Dec, 2016

1 commit

  • For several devices, the rootwait time is sensitive because it directly
    affects booting time. The polling interval of rootwait is currently
    100ms. To save unnessesary waiting time, reduce the polling interval to
    5 ms.

    [akpm@linux-foundation.org: remove used-once #define]
    Link: http://lkml.kernel.org/r/20161207060743.1728-1-js07.lee@samsung.com
    Signed-off-by: Jungseung Lee
    Cc: Al Viro
    Cc: Christoph Hellwig
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Jungseung Lee
     

26 Jun, 2015

1 commit

  • If create_dev() function fails to create the root mount device
    (/dev/root), then it goes to panic as root device not found but there is
    no printk in this case. So I have added the log in case it fails to
    create the root device. It will help in debugging.

    [akpm@linux-foundation.org: simplify printk(), use pr_emerg(), display errno]
    Signed-off-by: Vishnu Pratap Singh
    Acked-by: Pavel Machek
    Cc: Paul Gortmaker
    Cc: Mike Snitzer
    Cc: Dan Ehrenberg
    Cc: Miklos Szeredi
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Vishnu Pratap Singh
     

06 May, 2015

1 commit

  • Commit 283e7ad02 ("init: stricter checking of major:minor root=
    values") was so strict that it exposed the fact that a previously
    unknown device format was being used.

    Distributions like Ubuntu uses klibc (rather than uswsusp) to resume
    system from hibernation. klibc expressed the swap partition/file in
    the form of major:minor:offset. For example, 8:3:0 represents a swap
    partition in klibc, and klibc's resume process in initrd will finally
    echo 8:3:0 to /sys/power/resume for manually resuming. However, due
    to commit 283e7ad02's stricter checking, 8:3:0 will be treated as an
    invalid device format, and manual resuming from hibernation will fail.

    Fix this by adding support for devices with major:minor:offset format
    when resuming from hibernation.

    Reported-by: Prigent, Christophe
    Signed-off-by: Chen Yu
    Acked-by: Rafael J. Wysocki
    Signed-off-by: Mike Snitzer

    Chen Yu
     

16 Apr, 2015

2 commits

  • In the kernel command-line, previously, root=1:2jakshflaksjdhfa would
    be accepted and interpreted just like root=1:2. This patch adds
    stricter checking so that additional characters after major:minor are
    rejected by root=.

    The goal of this change is to help in unifying DM's interpretation of
    its block device argument by using existing kernel code (name_to_dev_t).
    But DM rejects malformed major:minor pairs, it seems reasonable for
    root= to reject them as well.

    Signed-off-by: Dan Ehrenberg
    Signed-off-by: Mike Snitzer

    Dan Ehrenberg
     
  • DM will switch its device lookup code to using name_to_dev_t() so it
    must be exported. Also, the @name argument should be marked const.

    Signed-off-by: Dan Ehrenberg
    Signed-off-by: Mike Snitzer

    Dan Ehrenberg
     

17 Dec, 2014

1 commit

  • If mount flags don't have MS_RDONLY, iso9660 returns EACCES without actually
    checking if it's an iso image.

    This tricks mount_block_root() into retrying with MS_RDONLY. This results
    in a read-only root despite the "rw" boot parameter if the actual
    filesystem was checked after iso9660.

    I believe the behavior of iso9660 is okay, while that of mount_block_root()
    is not. It should rather try all types without MS_RDONLY and only then
    retry with MS_RDONLY.

    This change also makes the code more robust against the case when EACCES is
    returned despite MS_RDONLY, which would've resulted in a lockup.

    Signed-off-by: Miklos Szeredi
    Signed-off-by: Al Viro

    Miklos Szeredi
     

28 Aug, 2014

1 commit


04 Apr, 2014

1 commit


13 Nov, 2013

1 commit