13 Dec, 2019

1 commit


12 Dec, 2019

1 commit

  • All three calls to ksys_mount() in initrd-related kernel code can
    be switched over to do_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
     

06 Jan, 2019

1 commit

  • Pull vfs mount API prep from Al Viro:
    "Mount API prereqs.

    Mostly that's LSM mount options cleanups. There are several minor
    fixes in there, but nothing earth-shattering (leaks on failure exits,
    mostly)"

    * 'mount.part1' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs: (27 commits)
    mount_fs: suppress MAC on MS_SUBMOUNT as well as MS_KERNMOUNT
    smack: rewrite smack_sb_eat_lsm_opts()
    smack: get rid of match_token()
    smack: take the guts of smack_parse_opts_str() into a new helper
    LSM: new method: ->sb_add_mnt_opt()
    selinux: rewrite selinux_sb_eat_lsm_opts()
    selinux: regularize Opt_... names a bit
    selinux: switch away from match_token()
    selinux: new helper - selinux_add_opt()
    LSM: bury struct security_mnt_opts
    smack: switch to private smack_mnt_opts
    selinux: switch to private struct selinux_mnt_opts
    LSM: hide struct security_mnt_opts from any generic code
    selinux: kill selinux_sb_get_mnt_opts()
    LSM: turn sb_eat_lsm_opts() into a method
    nfs_remount(): don't leak, don't ignore LSM options quietly
    btrfs: sanitize security_mnt_opts use
    selinux; don't open-code a loop in sb_finish_set_opts()
    LSM: split ->sb_set_mnt_opts() out of ->sb_kern_mount()
    new helper: security_sb_eat_lsm_opts()
    ...

    Linus Torvalds
     

29 Dec, 2018

1 commit

  • Pull Devicetree updates from Rob Herring:
    "The biggest highlight here is the start of using json-schema for DT
    bindings. Being able to validate bindings has been discussed for years
    with little progress.

    - Initial support for DT bindings using json-schema language. This is
    the start of converting DT bindings from free-form text to a
    structured format.

    - Reworking of initrd address initialization. This moves to using the
    phys address instead of virt addr in the DT parsing code. This
    rework was motivated by CONFIG_DEV_BLK_INITRD causing unnecessary
    rebuilding of lots of files.

    - Fix stale phandle entries in phandle cache

    - DT overlay validation improvements. This exposed several memory
    leak bugs which have been fixed.

    - Use node name and device_type helper functions in DT code

    - Last remaining conversions to using %pOFn printk specifier instead
    of device_node.name directly

    - Create new common RTC binding doc and move all trivial RTC devices
    out of trivial-devices.txt.

    - New bindings for Freescale MAG3110 magnetometer, Cadence Sierra
    PHY, and Xen shared memory

    - Update dtc to upstream version v1.4.7-57-gf267e674d145"

    * tag 'devicetree-for-4.21' of git://git.kernel.org/pub/scm/linux/kernel/git/robh/linux: (68 commits)
    of: __of_detach_node() - remove node from phandle cache
    of: of_node_get()/of_node_put() nodes held in phandle cache
    gpio-omap.txt: add reg and interrupts properties
    dt-bindings: mrvl,intc: fix a trivial typo
    dt-bindings: iio: magnetometer: add dt-bindings for freescale mag3110
    dt-bindings: Convert trivial-devices.txt to json-schema
    dt-bindings: arm: mrvl: amend Browstone compatible string
    dt-bindings: arm: Convert Tegra board/soc bindings to json-schema
    dt-bindings: arm: Convert ZTE board/soc bindings to json-schema
    dt-bindings: arm: Add missing Xilinx boards
    dt-bindings: arm: Convert Xilinx board/soc bindings to json-schema
    dt-bindings: arm: Convert VIA board/soc bindings to json-schema
    dt-bindings: arm: Convert ST STi board/soc bindings to json-schema
    dt-bindings: arm: Convert SPEAr board/soc bindings to json-schema
    dt-bindings: arm: Convert CSR SiRF board/soc bindings to json-schema
    dt-bindings: arm: Convert QCom board/soc bindings to json-schema
    dt-bindings: arm: Convert TI nspire board/soc bindings to json-schema
    dt-bindings: arm: Convert TI davinci board/soc bindings to json-schema
    dt-bindings: arm: Convert Calxeda board/soc bindings to json-schema
    dt-bindings: arm: Convert Altera board/soc bindings to json-schema
    ...

    Linus Torvalds
     

21 Dec, 2018

1 commit


27 Nov, 2018

2 commits

  • ARC, ARM, ARM64 and Unicore32 are all capable of parsing the "initrd="
    command line parameter to allow specifying the physical address and size
    of an initrd. Move that parsing into init/do_mounts_initrd.c such that
    we no longer duplicate that logic.

    Signed-off-by: Florian Fainelli
    Reviewed-by: Mike Rapoport
    Signed-off-by: Rob Herring

    Florian Fainelli
     
  • Make phys_initrd_start and phys_initrd_size global variables declared in
    init/do_mounts_initrd.c such that we can later have generic code in
    drivers/of/fdt.c populate those variables for us.

    This requires both the ARM and unicore32 implementations to be properly
    guarded against CONFIG_BLK_DEV_INITRD, and also initialize the variables
    to the expected default values (unicore32).

    Signed-off-by: Florian Fainelli
    Reviewed-by: Mike Rapoport
    Signed-off-by: Rob Herring

    Florian Fainelli
     

08 Nov, 2018

1 commit

  • This removes a bunch of core and elevator related code. On the core
    front, we remove anything related to queue running, draining,
    initialization, plugging, and congestions. We also kill anything
    related to request allocation, merging, retrieval, and completion.

    Remove any checking for single queue IO schedulers, as they no
    longer exist. This means we can also delete a bunch of code related
    to request issue, adding, completion, etc - and all the SQ related
    ops and helpers.

    Also kill the load_default_modules(), as all that did was provide
    for a way to load the default single queue elevator.

    Tested-by: Ming Lei
    Reviewed-by: Omar Sandoval
    Signed-off-by: Jens Axboe

    Jens Axboe
     

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

12 commits

  • Using this helper allows us to avoid the in-kernel call to the
    sys_setsid() 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_setsid().

    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
    Signed-off-by: Dominik Brodowski

    Dominik Brodowski
     
  • Using this helper allows us to avoid the in-kernel calls to the
    sys_unshare() 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_unshare().

    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
    Cc: Ingo Molnar
    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 the fs-internal do_mkdirat() helper allows us to get rid of
    fs-internal calls to the sys_mkdirat() syscall.

    Introducing the ksys_mkdir() wrapper allows us to avoid the in-kernel calls
    to the sys_mkdir() 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_mkdir().

    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 wrapper allows us to avoid the in-kernel calls to the
    sys_unlink() syscall. The ksys_ prefix denotes that this function is meant
    s a drop-in replacement for the syscall. In particular, it uses the same
    calling convention as sys_unlink().

    In the near future, all callers of ksys_unlink() should be converted to
    call do_unlinkat() directly or, at least, to operate on regular kernel
    pointers.

    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 ksys_dup() and ksys_dup3() as helper functions allows us to
    avoid the in-kernel calls to the sys_dup() and sys_dup3() syscalls.
    The ksys_ prefix denotes that these functions are meant as a drop-in
    replacement for the syscalls. In particular, they use the same
    calling convention as sys_dup{,3}().

    In the near future, the fs-external callers of ksys_dup{,3}() should be
    converted to call do_dup2() directly. Then, ksys_dup{,3}() can be moved
    within sys_dup{,3}() 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 call to the sys_umount()
    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 ksys_umount().

    In the near future, the only fs-external caller of ksys_umount() should be
    converted to call do_umount() directly. Then, ksys_umount() can be moved
    within sys_umount() 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
     

02 Nov, 2017

1 commit

  • Many source files in the tree are missing licensing information, which
    makes it harder for compliance tools to determine the correct license.

    By default all files without license information are under the default
    license of the kernel, which is GPL version 2.

    Update the files which contain no license information with the 'GPL-2.0'
    SPDX license identifier. The SPDX identifier is a legally binding
    shorthand, which can be used instead of the full boiler plate text.

    This patch is based on work done by Thomas Gleixner and Kate Stewart and
    Philippe Ombredanne.

    How this work was done:

    Patches were generated and checked against linux-4.14-rc6 for a subset of
    the use cases:
    - file had no licensing information it it.
    - file was a */uapi/* one with no licensing information in it,
    - file was a */uapi/* one with existing licensing information,

    Further patches will be generated in subsequent months to fix up cases
    where non-standard license headers were used, and references to license
    had to be inferred by heuristics based on keywords.

    The analysis to determine which SPDX License Identifier to be applied to
    a file was done in a spreadsheet of side by side results from of the
    output of two independent scanners (ScanCode & Windriver) producing SPDX
    tag:value files created by Philippe Ombredanne. Philippe prepared the
    base worksheet, and did an initial spot review of a few 1000 files.

    The 4.13 kernel was the starting point of the analysis with 60,537 files
    assessed. Kate Stewart did a file by file comparison of the scanner
    results in the spreadsheet to determine which SPDX license identifier(s)
    to be applied to the file. She confirmed any determination that was not
    immediately clear with lawyers working with the Linux Foundation.

    Criteria used to select files for SPDX license identifier tagging was:
    - Files considered eligible had to be source code files.
    - Make and config files were included as candidates if they contained >5
    lines of source
    - File already had some variant of a license header in it (even if
    Reviewed-by: Philippe Ombredanne
    Reviewed-by: Thomas Gleixner
    Signed-off-by: Greg Kroah-Hartman

    Greg Kroah-Hartman
     

21 Jan, 2016

1 commit


01 May, 2013

1 commit

  • These are the only users of call_usermodehelper_fns(). This function
    suffers from not being able to determine if the cleanup is called. Even
    if in this places the cleanup pointer is NULL, convert them to use the
    separate call_usermodehelper_setup() + call_usermodehelper_exec()
    functions so we can remove the _fns variant.

    Signed-off-by: Lucas De Marchi
    Cc: Oleg Nesterov
    Cc: David Howells
    Cc: James Morris
    Cc: Al Viro
    Cc: Tejun Heo
    Cc: "Rafael J. Wysocki"
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Lucas De Marchi
     

24 Jan, 2013

1 commit


20 Jan, 2013

1 commit


19 Jan, 2013

1 commit

  • This patch adds default module loading and uses it to load the default
    block elevator. During boot, it's called right after initramfs or
    initrd is made available and right before control is passed to
    userland. This ensures that as long as the modules are available in
    the usual places in initramfs, initrd or the root filesystem, the
    default modules are loaded as soon as possible.

    This will replace the on-demand elevator module loading from elevator
    init path.

    v2: Fixed build breakage when !CONFIG_BLOCK. Reported by kbuild test
    robot.

    Signed-off-by: Tejun Heo
    Cc: Jens Axboe
    Cc: Arjan van de Ven
    Cc: Linus Torvalds
    Cc: Alex Riesen
    Cc: Fengguang We

    Tejun Heo
     

12 Oct, 2012

1 commit


01 Jun, 2012

1 commit

  • The init/mount.o source files produce a number of sparse warnings of the
    type:

    warning: incorrect type in argument 1 (different address spaces)
    expected char [noderef] *dev_name
    got char *name

    This is due to the syscalls expecting some of the arguments to be user
    pointers but they are being passed as kernel pointers. This is harmless
    but adds a lot of noise to a sparse build.

    To limit the noise just disable the sparse checking in the relevant source
    files, but still display a warning so that the user knows this has been
    done.

    Since the sparse checking has been disabled we can also remove the __user
    __force casts that are scattered thru the source.

    Signed-off-by: H Hartley Sweeten
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    H Hartley Sweeten
     

01 Apr, 2012

1 commit


18 Aug, 2010

1 commit

  • Make do_execve() take a const filename pointer so that kernel_execve() compiles
    correctly on ARM:

    arch/arm/kernel/sys_arm.c:88: warning: passing argument 1 of 'do_execve' discards qualifiers from pointer target type

    This also requires the argv and envp arguments to be consted twice, once for
    the pointer array and once for the strings the array points to. This is
    because do_execve() passes a pointer to the filename (now const) to
    copy_strings_kernel(). A simpler alternative would be to cast the filename
    pointer in do_execve() when it's passed to copy_strings_kernel().

    do_execve() may not change any of the strings it is passed as part of the argv
    or envp lists as they are some of them in .rodata, so marking these strings as
    const should be fine.

    Further kernel_execve() and sys_execve() need to be changed to match.

    This has been test built on x86_64, frv, arm and mips.

    Signed-off-by: David Howells
    Tested-by: Ralf Baechle
    Acked-by: Russell King
    Signed-off-by: Linus Torvalds

    David Howells
     

04 Mar, 2010

1 commit

  • To avoid potential problems with an empty /dev open /dev/console
    from rootfs instead of waiting to mount our root filesystem and
    mounting it there. This effectively guarantees that there will
    be a device node, and it won't be on a filesystem that we will
    ever unmount, so there are no issues with leaving /dev/console
    open and pinning the filesystem.

    This is actually more effective than automatically mounting
    devtmpfs on /dev because it removes removes the occasionally
    problematic assumption that /dev/console exists from the boot
    code.

    With this patch I was able to throw busybox on my /boot partition
    (which has no /dev directory) and boot into userspace without
    problems.

    The only possible negative consequence I can think of is that
    someone out there deliberately used did not use a character device
    that is major 5 minor 2 for /dev/console. Does anyone know of a
    situation in which that could make sense?

    Signed-off-by: Eric W. Biederman
    Signed-off-by: Al Viro

    Eric W. Biederman