17 Dec, 2018

1 commit

  • [ Upstream commit 7c0950d455d6ab610d2990a13120f935b75abf2c ]

    sys_link() can fail due to the new path already existing. This case
    ofen occurs when we use a concated initrd, for example:

    1) prepare a basic rootfs, it contains a regular files rc.local
    lizhijian@:~/yocto-tiny-i386-2016-04-22$ cat etc/rc.local
    #!/bin/sh
    echo "Running /etc/rc.local..."
    yocto-tiny-i386-2016-04-22$ find . | sed 's,^\./,,' | cpio -o -H newc | gzip -n -9 >../rootfs.cgz

    2) create a extra initrd which also includes a etc/rc.local
    lizhijian@:~/lkp-x86_64/etc$ echo "append initrd" >rc.local
    lizhijian@:~/lkp/lkp-x86_64/etc$ cat rc.local
    append initrd
    lizhijian@:~/lkp/lkp-x86_64/etc$ ln rc.local rc.local.hardlink
    append initrd
    lizhijian@:~/lkp/lkp-x86_64/etc$ stat rc.local rc.local.hardlink
    File: 'rc.local'
    Size: 14 Blocks: 8 IO Block: 4096 regular file
    Device: 801h/2049d Inode: 11296086 Links: 2
    Access: (0664/-rw-rw-r--) Uid: ( 1002/lizhijian) Gid: ( 1002/lizhijian)
    Access: 2018-11-15 16:08:28.654464815 +0800
    Modify: 2018-11-15 16:07:57.514903210 +0800
    Change: 2018-11-15 16:08:24.180228872 +0800
    Birth: -
    File: 'rc.local.hardlink'
    Size: 14 Blocks: 8 IO Block: 4096 regular file
    Device: 801h/2049d Inode: 11296086 Links: 2
    Access: (0664/-rw-rw-r--) Uid: ( 1002/lizhijian) Gid: ( 1002/lizhijian)
    Access: 2018-11-15 16:08:28.654464815 +0800
    Modify: 2018-11-15 16:07:57.514903210 +0800
    Change: 2018-11-15 16:08:24.180228872 +0800
    Birth: -

    lizhijian@:~/lkp/lkp-x86_64$ find . | sed 's,^\./,,' | cpio -o -H newc | gzip -n -9 >../rc-local.cgz
    lizhijian@:~/lkp/lkp-x86_64$ gzip -dc ../rc-local.cgz | cpio -t
    .
    etc
    etc/rc.local.hardlink <<< it will be extracted first at this initrd
    etc/rc.local

    3) concate 2 initrds and boot
    lizhijian@:~/lkp$ cat rootfs.cgz rc-local.cgz >concate-initrd.cgz
    lizhijian@:~/lkp$ qemu-system-x86_64 -nographic -enable-kvm -cpu host -smp 1 -m 1024 -kernel ~/lkp/linux/arch/x86/boot/bzImage -append "console=ttyS0 earlyprint=ttyS0 ignore_loglevel" -initrd ./concate-initr.cgz -serial stdio -nodefaults

    In this case, sys_link(2) will fail and return -EEXIST, so we can only get
    the rc.local at rootfs.cgz instead of rc-local.cgz

    [akpm@linux-foundation.org: move code to avoid forward declaration]
    Link: http://lkml.kernel.org/r/1542352368-13299-1-git-send-email-lizhijian@cn.fujitsu.com
    Signed-off-by: Li Zhijian
    Cc: Philip Li
    Cc: Dominik Brodowski
    Cc: Li Zhijian
    Cc: Al Viro
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds
    Signed-off-by: Sasha Levin

    Li Zhijian
     

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

13 commits

  • Using this helper allows us to avoid the in-kernel calls to the
    sys_getdents64() 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_getdents64().

    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 ksys_ftruncate() wrapper allows us to get rid of in-kernel
    calls to the sys_ftruncate() 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_ftruncate().

    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-interal do_fchownat() wrapper allows us to get rid of
    fs-internal calls to the sys_fchownat() syscall.

    Introducing the ksys_fchown() helper and the ksys_{,}chown() wrappers
    allows us to avoid the in-kernel calls to the sys_{,l,f}chown() 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_{,l,f}chown().

    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
     
  • … in-kernel calls to syscall

    Using the fs-internal do_fchmodat() helper allows us to get rid of
    fs-internal calls to the sys_fchmodat() syscall.

    Introducing the ksys_fchmod() helper and the ksys_chmod() wrapper allows
    us to avoid the in-kernel calls to the sys_fchmod() and sys_chmod()
    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_fchmod() and sys_chmod().

    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 <viro@zeniv.linux.org.uk>
    Cc: Andrew Morton <akpm@linux-foundation.org>
    Signed-off-by: Dominik Brodowski <linux@dominikbrodowski.net>

    Dominik Brodowski
     
  • Using the fs-internal do_linkat() helper allows us to get rid of
    fs-internal calls to the sys_linkat() syscall.

    Introducing the ksys_link() wrapper allows us to avoid the in-kernel
    calls to sys_link() 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_link().

    In the near future, the only fs-external user of ksys_link() should be
    converted to use vfs_link() instead.

    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_mknodat() helper allows us to get rid of
    fs-internal calls to the sys_mknodat() syscall.

    Introducing the ksys_mknod() wrapper allows us to avoid the in-kernel
    calls to sys_mknod() 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_mknod().

    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_symlinkat() helper allows us to get rid of
    fs-internal calls to the sys_symlinkat() syscall.

    Introducing the ksys_symlink() wrapper allows us to avoid the in-kernel
    calls to the sys_symlink() 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_symlink().

    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_rmdir() 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_rmdir().

    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_write()
    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_write().

    In the near future, the do_mounts / initramfs callers of ksys_write()
    should be converted to use filp_open() and vfs_write() instead.

    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
    Cc: linux-s390@vger.kernel.org
    Signed-off-by: Dominik Brodowski

    Dominik Brodowski
     

18 Nov, 2017

1 commit

  • The cpio format uses a 32-bit number to encode file timestamps, which
    breaks initramfs support in 2038. This reinterprets the timestamp as
    unsigned, to give us another 68 years and avoids breaking until 2106.

    Link: http://lkml.kernel.org/r/20171019095536.801199-1-arnd@arndb.de
    Signed-off-by: Arnd Bergmann
    Cc: Al Viro
    Cc: Deepa Dinamani
    Cc: Arnd Bergmann
    Cc: Daniel Thompson
    Cc: Lokesh Vutla
    Cc: Stafford Horne
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Arnd Bergmann
     

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
     

04 Sep, 2017

1 commit

  • struct timespec is not y2038 safe on 32 bit machines.
    Replace timespec with y2038 safe struct timespec64.

    Note that the patch only changes the internals without
    modifying the syscall interfaces. This will be part
    of a separate series.

    Signed-off-by: Deepa Dinamani
    Reviewed-by: Arnd Bergmann
    Signed-off-by: Al Viro

    Deepa Dinamani
     

09 May, 2017

2 commits

  • sys_newlstat is a system call implementation that is meant for user
    space, and that copies kernel-internal data structure to the user
    format, which is not needed for in-kernel users.

    Further, as we rearrange the system call implementation so we can extend
    it with 64-bit time_t, the prototype for sys_newlstat changes.

    This changes the initramfs code to use vfs_lstat directly, to get it out
    of the way of the time_t changes, and make it slightly more efficient in
    the process. Along the same lines we also replace sys_stat and
    sys_stat64 with vfs_stat.

    Link: http://lkml.kernel.org/r/20170314214932.4052842-1-arnd@arndb.de
    Signed-off-by: Arnd Bergmann
    Cc: Alexander Viro
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Arnd Bergmann
     
  • Many "embedded" architectures provide CMDLINE_FORCE to allow the kernel
    to override the command line provided by an inflexible bootloader.
    However there is currrently no way for the kernel to override the
    initramfs image provided by the bootloader meaning there are still ways
    for bootloaders to make things difficult for us.

    Fix this by introducing INITRAMFS_FORCE which can prevent the kernel
    from loading the bootloader supplied image.

    We use CMDLINE_FORCE (and its friend CMDLINE_EXTEND) to imply that the
    system has an inflexible bootloader. This allow us to avoid presenting
    this config option to users of systems where inflexible bootloaders
    aren't usually a problem.

    Link: http://lkml.kernel.org/r/20170217121940.30126-1-daniel.thompson@linaro.org
    Signed-off-by: Daniel Thompson
    Cc: Al Viro
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Daniel Thompson
     

07 May, 2017

1 commit

  • Commit 17a9be317475 ("initramfs: Always do fput() and load modules after
    rootfs populate") introduced an error for the

    CONFIG_BLK_DEV_RAM=y

    case, because even though the code looks fine, the compiler really wants
    a statement after a label, or you'll get complaints:

    init/initramfs.c: In function 'populate_rootfs':
    init/initramfs.c:644:2: error: label at end of compound statement

    That commit moved the subsequent statements to outside the compound
    statement, leaving the label without any associated statements.

    Reported-by: Jörg Otte
    Fixes: 17a9be317475 ("initramfs: Always do fput() and load modules after rootfs populate")
    Cc: Al Viro
    Cc: Stafford Horne
    Cc: stable@vger.kernel.org # if 17a9be317475 gets backported
    Signed-off-by: Linus Torvalds

    Linus Torvalds
     

05 May, 2017

1 commit

  • In OpenRISC we do not have a bootloader passed initrd, but the built in
    initramfs does contain the /init and other binaries, including modules.
    The previous commit 08865514805d2 ("initramfs: finish fput() before
    accessing any binary from initramfs") made a change to only call fput()
    if the bootloader initrd was available, this caused intermittent crashes
    for OpenRISC.

    This patch changes the fput() to happen unconditionally if any rootfs is
    loaded. Also, I added some comments to make it a bit more clear why we
    call unpack_to_rootfs() multiple times.

    Fixes: 08865514805d2 ("initramfs: finish fput() before accessing any binary from initramfs")
    Cc: stable@vger.kernel.org
    Cc: Lokesh Vutla
    Cc: Al Viro
    Acked-by: Al Viro
    Signed-off-by: Stafford Horne

    Stafford Horne
     

28 Feb, 2017

1 commit

  • Commit 4a9d4b024a31 ("switch fput to task_work_add") implements a
    schedule_work() for completing fput(), but did not guarantee calling
    __fput() after unpacking initramfs. Because of this, there is a
    possibility that during boot a driver can see ETXTBSY when it tries to
    load a binary from initramfs as fput() is still pending on that binary.

    This patch makes sure that fput() is completed after unpacking initramfs
    and removes the call to flush_delayed_fput() in kernel_init() which
    happens very late after unpacking initramfs.

    Link: http://lkml.kernel.org/r/20170201140540.22051-1-lokeshvutla@ti.com
    Signed-off-by: Lokesh Vutla
    Reported-by: Murali Karicheri
    Cc: Al Viro
    Cc: Tero Kristo
    Cc: Sekhar Nori
    Cc: Nishanth Menon
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Lokesh Vutla
     

11 Sep, 2015

1 commit

  • There are two kexec load syscalls, kexec_load another and kexec_file_load.
    kexec_file_load has been splited as kernel/kexec_file.c. In this patch I
    split kexec_load syscall code to kernel/kexec.c.

    And add a new kconfig option KEXEC_CORE, so we can disable kexec_load and
    use kexec_file_load only, or vice verse.

    The original requirement is from Ted Ts'o, he want kexec kernel signature
    being checked with CONFIG_KEXEC_VERIFY_SIG enabled. But kexec-tools use
    kexec_load syscall can bypass the checking.

    Vivek Goyal proposed to create a common kconfig option so user can compile
    in only one syscall for loading kexec kernel. KEXEC/KEXEC_FILE selects
    KEXEC_CORE so that old config files still work.

    Because there's general code need CONFIG_KEXEC_CORE, so I updated all the
    architecture Kconfig with a new option KEXEC_CORE, and let KEXEC selects
    KEXEC_CORE in arch Kconfig. Also updated general kernel code with to
    kexec_load syscall.

    [akpm@linux-foundation.org: coding-style fixes]
    Signed-off-by: Dave Young
    Cc: Eric W. Biederman
    Cc: Vivek Goyal
    Cc: Petr Tesarik
    Cc: Theodore Ts'o
    Cc: Josh Boyer
    Cc: David Howells
    Cc: Geert Uytterhoeven
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Dave Young
     

14 Oct, 2014

1 commit

  • Resolve shadow warnings that are produced in W=2 builds by renaming a
    global with a too-generic name and renaming a formal parameter.

    [akpm@linux-foundation.org: coding-style fixes]
    Signed-off-by: Mark Rustad
    Signed-off-by: Jeff Kirsher
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Mark Rustad
     

09 Aug, 2014

3 commits

  • On a system with low memory extracting the initramfs may fail. If this
    happens the user gets "Failed to execute /init" instead of an initramfs
    error.

    Check return value of sys_write and call error() when the write was
    incomplete or failed.

    Signed-off-by: David Engraf
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    David Engraf
     
  • Now with 64bit bzImage and kexec tools, we support ramdisk that size is
    bigger than 2g, as we could put it above 4G.

    Found compressed initramfs image could not be decompressed properly. It
    turns out that image length is int during decompress detection, and it
    will become < 0 when length is more than 2G. Furthermore, during
    decompressing len as int is used for inbuf count, that has problem too.

    Change len to long, that should be ok as on 32 bit platform long is
    32bits.

    Tested with following compressed initramfs image as root with kexec.
    gzip, bzip2, xz, lzma, lzop, lz4.
    run time for populate_rootfs():
    size name Nehalem-EX Westmere-EX Ivybridge-EX
    9034400256 root_img : 26s 24s 30s
    3561095057 root_img.lz4 : 28s 27s 27s
    3459554629 root_img.lzo : 29s 29s 28s
    3219399480 root_img.gz : 64s 62s 49s
    2251594592 root_img.xz : 262s 260s 183s
    2226366598 root_img.lzma: 386s 376s 277s
    2901482513 root_img.bz2 : 635s 599s

    Signed-off-by: Yinghai Lu
    Cc: "H. Peter Anvin"
    Cc: Ingo Molnar
    Cc: Rashika Kheria
    Cc: Josh Triplett
    Cc: Kyungsik Lee
    Cc: P J P
    Cc: Al Viro
    Cc: Tetsuo Handa
    Cc: "Daniel M. Weeks"
    Cc: Alexandre Courbot
    Cc: Jan Beulich
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Yinghai Lu
     
  • When initrd (compressed or not) is used, kernel report data corrupted with
    /dev/ram0.

    The root cause:
    During initramfs checking, if it is initrd, it will be transferred to
    /initrd.image with sys_write.
    sys_write only support 2G-4K write, so if the initrd ram is more than
    that, /initrd.image will not complete at all.

    Add local xwrite to loop calling sys_write to workaround the problem.

    Also need to use xwrite in write_buffer() to handle:
    image is uncompressed cpio and there is one big file (>2G) in it.
    unpack_to_rootfs ===> write_buffer ===> actions[]/do_copy

    At the same time, we don't need to worry about sys_read/sys_write in
    do_mounts_rd.c::crd_load. As decompressor will have fill/flush and local
    buffer that is smaller than 2G.

    Test with uncompressed initrd, and compressed ones with gz, bz2, lzma,xz,
    lzop.

    Signed-off-by: Yinghai Lu
    Acked-by: H. Peter Anvin
    Cc: Ingo Molnar
    Cc: Geert Uytterhoeven
    Cc: Tetsuo Handa
    Cc: "Daniel M. Weeks"
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Yinghai Lu
     

08 Apr, 2014

1 commit

  • This can greatly aid in narrowing down the real source of initramfs
    problems such as failures related to the compression of the in-kernel
    initramfs when an external initramfs is in use as well. Existing errors
    are ambiguous as to which initramfs is a problem and why.

    [akpm@linux-foundation.org: use pr_debug()]
    Signed-off-by: Daniel M. Weeks
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Daniel M. Weeks
     

24 Jan, 2014

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
     

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
     

04 Jan, 2012

1 commit


29 Oct, 2010

1 commit

  • * 'kbuild' of git://git.kernel.org/pub/scm/linux/kernel/git/mmarek/kbuild-2.6:
    initramfs: Fix build break on symbol-prefixed archs
    initramfs: fix initramfs size calculation
    initramfs: generalize initramfs_data.xxx.S variants
    scripts/kallsyms: Enable error messages while hush up unnecessary warnings
    scripts/setlocalversion: update comment
    kbuild: Use a single clean rule for kernel and external modules
    kbuild: Do not run make clean in $(srctree)
    scripts/mod/modpost.c: fix commentary accordingly to last changes
    kbuild: Really don't clean bounds.h and asm-offsets.h

    Linus Torvalds
     

27 Oct, 2010

1 commit

  • When calling syscall service routines in kernel, some of arguments should
    be user pointers but were missing __user markup on string literals. Add
    it. Removes some sparse warnings.

    Signed-off-by: Namhyung Kim
    Cc: Phillip Lougher
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Namhyung Kim
     

29 Sep, 2010

1 commit

  • The size of a built-in initramfs is calculated in init/initramfs.c by
    "__initramfs_end - __initramfs_start". Those symbols are defined in the
    linker script include/asm-generic/vmlinux.lds.h:

    #define INIT_RAM_FS \
    . = ALIGN(PAGE_SIZE); \
    VMLINUX_SYMBOL(__initramfs_start) = .; \
    *(.init.ramfs) \
    VMLINUX_SYMBOL(__initramfs_end) = .;

    If the initramfs file has an odd number of bytes, the "__initramfs_end"
    symbol points to an odd address, for example, the symbols in the
    System.map might look like:

    0000000000572000 T __initramfs_start
    00000000005bcd05 T __initramfs_end :
    540a9c: eb cf f0 78 00 24 stmg %r12,%r15,120(%r15),
    540aa2: c0 10 00 01 8a af larl %r1,572000
    540aa8: c0 c0 00 03 e1 2e larl %r12,5bcd04
    (Instead of 5bcd05)
    ...
    540abe: 1b c1 sr %r12,%r1

    To fix the problem, this patch introduces the global variable
    __initramfs_size, which is calculated in the "usr/initramfs_data.S" file.
    The populate_rootfs() function can then use the start marker of the
    .init.ramfs section and the value of __initramfs_size for loading the
    initramfs. Because the start marker and size is sufficient, the
    __initramfs_end symbol is no longer needed and is removed.

    Signed-off-by: Michael Holzheu
    Signed-off-by: Hendrik Brueckner
    Reviewed-by: WANG Cong
    Acked-by: Michal Marek
    Acked-by: "H. Peter Anvin"
    Cc: Heiko Carstens
    Cc: Martin Schwidefsky
    Signed-off-by: Andrew Morton
    Signed-off-by: Michal Marek

    Hendrik Brueckner
     

25 Apr, 2010

1 commit

  • The unpack routine fails to handle the decompress_method() returning
    unrecognised decompressor (compress_name == NULL). This results in the
    routine looping eventually oopsing on an out of bounds memory access.

    Note this bug is usually hidden, only triggering on trailing junk after
    one or more correct compressed blocks. The case of the compressed archive
    being complete junk is (by accident?) caught by the if (state != Reset)
    check because state is initialised to Start, but not updated due to the
    decompressor not having been called. Obviously if the junk is trailing a
    correctly decompressed buffer, state == Reset from the previous call to
    the decompressor.

    Signed-off-by: Phillip Lougher
    Reported-by: Aaro Koskinen
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Phillip Lougher
     

07 Mar, 2010

1 commit


16 Dec, 2009

1 commit

  • The decompressors return error by calling a supplied error function, and/or
    by returning an error return value. The initramfs code, however, fails to
    check the exit code returned by the decompressor, and only checks the error
    status set by calling the error function.

    This patch adds a return code check and calls the error function.

    Signed-off-by: Phillip Lougher
    LKML-Reference:
    Signed-off-by: H. Peter Anvin

    Phillip Lougher
     

07 May, 2009

1 commit

  • With the removal of duplicate unpack_to_rootfs() (commit
    df52092f3c97788592ef72501a43fb7ac6a3cfe0) the messages displayed do not
    actually correspond to what the kernel is doing. In addition, depending
    if ramdisks are supported or not, the messages are not at all the same.

    So keep the messages more in sync with what is really doing the kernel,
    and only display a second message in case of failure. This also ensure
    that the printk message cannot be split by other printk's.

    Signed-off-by: Eric Piel
    Acked-by: H. Peter Anvin
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Eric Piel