02 Feb, 2022

2 commits

  • commit 10756dc5b02bff370ddd351d7744bc99ada659c2 upstream.

    As linux/nfc.h userspace compilation was finally fixed by commits
    79b69a83705e ("nfc: uapi: use kernel size_t to fix user-space builds")
    and 7175f02c4e5f ("uapi: fix linux/nfc.h userspace compilation errors"),
    there is no need to keep the compile-test exception for it in
    usr/include/Makefile.

    Signed-off-by: Dmitry V. Levin
    Signed-off-by: Masahiro Yamada
    Signed-off-by: Greg Kroah-Hartman

    Dmitry V. Levin
     
  • commit d1ad2721b1eb05d54e81393a7ebc332d4a35c68f upstream.

    The file now rightfully throws up a big warning that it should never be
    included, so remove it from the header_check test.

    Fixes: f23653fe6447 ("tty: Partially revert the removal of the Cyclades public API")
    Cc: stable
    Cc: Masahiro Yamada
    Cc: "Maciej W. Rozycki"
    Reported-by: Stephen Rothwell
    Reported-by: kernel test robot
    Link: https://lore.kernel.org/r/20220127073304.42399-1-gregkh@linuxfoundation.org
    Signed-off-by: Greg Kroah-Hartman

    Greg Kroah-Hartman
     

01 May, 2021

3 commits

  • The pattern prefixed with '/' matches files in the same directory,
    but not ones in sub-directories.

    Signed-off-by: Masahiro Yamada
    Acked-by: Miguel Ojeda
    Acked-by: Rob Herring
    Acked-by: Andra Paraschiv
    Acked-by: Greg Kroah-Hartman
    Acked-by: Gabriel Krisman Bertazi

    Masahiro Yamada
     
  • LANG gives a weak default to each LC_* in case it is not explicitly
    defined. LC_ALL, if set, overrides all other LC_* variables.

    LANG < LC_CTYPE, LC_COLLATE, LC_MONETARY, LC_NUMERIC, ... < LC_ALL

    This is why documentation such as [1] suggests to set LC_ALL in build
    scripts to get the deterministic result.

    LANG=C is not strong enough to override LC_* that may be set by end
    users.

    [1]: https://reproducible-builds.org/docs/locales/

    Signed-off-by: Masahiro Yamada
    Acked-by: Michael Ellerman (powerpc)
    Reviewed-by: Matthias Maennich
    Acked-by: Matthieu Baerts (mptcp)
    Reviewed-by: Greg Kroah-Hartman

    Masahiro Yamada
     
  • The current .gitignore intends to ignore everything under usr/include/
    except .gitignore and Makefile.

    A cleaner solution is to use a pattern suffixed with '/', which matches
    only directories. It works well here because all the exported headers
    are located in sub-directories, like , .

    Signed-off-by: Masahiro Yamada

    Masahiro Yamada
     

26 Feb, 2021

1 commit

  • Pull Kbuild updates from Masahiro Yamada:

    - Fix false-positive build warnings for ARCH=ia64 builds

    - Optimize dictionary size for module compression with xz

    - Check the compiler and linker versions in Kconfig

    - Fix misuse of extra-y

    - Support DWARF v5 debug info

    - Clamp SUBLEVEL to 255 because stable releases 4.4.x and 4.9.x
    exceeded the limit

    - Add generic syscall{tbl,hdr}.sh for cleanups across arches

    - Minor cleanups of genksyms

    - Minor cleanups of Kconfig

    * tag 'kbuild-v5.12' of git://git.kernel.org/pub/scm/linux/kernel/git/masahiroy/linux-kbuild: (38 commits)
    initramfs: Remove redundant dependency of RD_ZSTD on BLK_DEV_INITRD
    kbuild: remove deprecated 'always' and 'hostprogs-y/m'
    kbuild: parse C= and M= before changing the working directory
    kbuild: reuse this-makefile to define abs_srctree
    kconfig: unify rule of config, menuconfig, nconfig, gconfig, xconfig
    kconfig: omit --oldaskconfig option for 'make config'
    kconfig: fix 'invalid option' for help option
    kconfig: remove dead code in conf_askvalue()
    kconfig: clean up nested if-conditionals in check_conf()
    kconfig: Remove duplicate call to sym_get_string_value()
    Makefile: Remove # characters from compiler string
    Makefile: reuse CC_VERSION_TEXT
    kbuild: check the minimum linker version in Kconfig
    kbuild: remove ld-version macro
    scripts: add generic syscallhdr.sh
    scripts: add generic syscalltbl.sh
    arch: syscalls: remove $(srctree)/ prefix from syscall tables
    arch: syscalls: add missing FORCE and fix 'targets' to make if_changed work
    gen_compile_commands: prune some directories
    kbuild: simplify access to the kernel's version
    ...

    Linus Torvalds
     

24 Feb, 2021

1 commit


22 Jan, 2021

1 commit

  • Perfmon support (used by oprofile earlier) was removed by commit
    ecf5b72d5f66 ("ia64: Remove perfmon") earlier, but it missed few files
    to remove/update.

    Clean it up.

    Suggested-by: Arnd Bergmann
    Signed-off-by: Viresh Kumar
    Acked-by: Robert Richter
    Acked-by: William Cohen
    Acked-by: Al Viro
    Acked-by: Thomas Gleixner

    Viresh Kumar
     

08 Aug, 2020

1 commit

  • Pull fdpick coredump update from Al Viro:
    "Switches fdpic coredumps away from original aout dumping primitives to
    the same kind of regset use as regular elf coredumps do"

    * 'work.fdpic' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs:
    [elf-fdpic] switch coredump to regsets
    [elf-fdpic] use elf_dump_thread_status() for the dumper thread as well
    [elf-fdpic] move allocation of elf_thread_status into elf_dump_thread_status()
    [elf-fdpic] coredump: don't bother with cyclic list for per-thread objects
    kill elf_fpxregs_t
    take fdpic-related parts of elf_prstatus out
    unexport linux/elfcore.h

    Linus Torvalds
     

31 Jul, 2020

1 commit

  • - Add support for a zstd compressed initramfs.

    - Add compression for compressing built-in initramfs with zstd.

    I have tested this patch by boot testing with buildroot and QEMU.
    Specifically, I booted the kernel with both a zstd and gzip compressed
    initramfs, both built into the kernel and separate. I ensured that the
    correct compression algorithm was used. I tested on arm, aarch64, i386,
    and x86_64.

    This patch has been tested in production on aarch64 and x86_64 devices.

    Additionally, I have performance measurements from internal use in
    production. On an aarch64 device we saw 19 second boot time improvement
    from switching from lzma to zstd (27 seconds to 8 seconds). On an x86_64
    device we saw a 9 second boot time reduction from switching from xz to
    zstd.

    Signed-off-by: Nick Terrell
    Signed-off-by: Ingo Molnar
    Tested-by: Sedat Dilek
    Reviewed-by: Kees Cook
    Link: https://lore.kernel.org/r/20200730190841.2071656-5-nickrterrell@gmail.com

    Nick Terrell
     

28 Jul, 2020

1 commit

  • It's unusable from userland - it uses elf_gregset_t, which is not
    provided by exported headers. glibc has it in sys/procfs.h, but
    the same file defines struct elf_prstatus, so linux/elfcore.h can't
    be included once sys/procfs.h has been pulled. Same goes for uclibc
    and dietlibc simply doesn't have elf_gregset_t defined anywhere.

    IOW, no userland source is including that thing.

    Signed-off-by: Al Viro

    Al Viro
     

17 May, 2020

1 commit

  • bpfilter_umh is built for the default machine bit of the compiler,
    which may not match to the bit size of the kernel.

    This happens in the scenario below:

    You can use biarch GCC that defaults to 64-bit for building the 32-bit
    kernel. In this case, Kbuild passes -m32 to teach the compiler to
    produce 32-bit kernel space objects. However, it is missing when
    building bpfilter_umh. It is built as a 64-bit ELF, and then embedded
    into the 32-bit kernel.

    The 32-bit kernel and 64-bit umh is a bad combination.

    In theory, we can have 32-bit umh running on 64-bit kernel, but we do
    not have a good reason to support such a usecase.

    The best is to match the bit size between them.

    Pass -m32 or -m64 to the umh build command if it is found in
    $(KBUILD_CFLAGS). Evaluate CC_CAN_LINK against the kernel bit-size.

    Signed-off-by: Masahiro Yamada

    Masahiro Yamada
     

12 May, 2020

1 commit

  • This omits system headers from the generated header dependency.

    System headers are not updated unless you upgrade the compiler. Nor do
    they contain CONFIG options, so fixdep does not need to parse them.

    Having said that, the effect of this optimization will be quite small
    because the kernel code generally does not include system headers
    except . Host programs include a lot of system headers,
    but there are not so many in the kernel tree.

    At first, keeping system headers in .*.cmd files might be useful to
    detect the compiler update, but there is no guarantee that
    is included from every file. So, I implemented a more reliable way in
    the previous commit.

    Signed-off-by: Masahiro Yamada

    Masahiro Yamada
     

11 Apr, 2020

1 commit


25 Mar, 2020

1 commit


17 Mar, 2020

1 commit

  • Even though INITRAMFS_SOURCE kconfig option isn't set in most of
    defconfigs it is used (set) extensively by various build systems.
    Commit f26661e12765 ("initramfs: make initramfs compression choice
    non-optional") has changed default compression mode. Previously we
    compress initramfs using available compression algorithm. Now
    we don't use any compression at all by default.
    It significantly increases the image size in case of build system
    chooses embedded initramfs. Initially I faced with this issue while
    using buildroot.

    As of today it's not possible to set preferred compression mode
    in target defconfig as this option depends on INITRAMFS_SOURCE
    being set. Modification of all build systems either doesn't look
    like good option.

    Let's instead rewrite initramfs compression mode choices list
    the way that "INITRAMFS_COMPRESSION_NONE" will be the last option
    in the list. In that case it will be chosen only if all other
    options (which implements any compression) are not available.

    Signed-off-by: Eugeniy Paltsev
    Signed-off-by: Masahiro Yamada

    Eugeniy Paltsev
     

10 Feb, 2020

1 commit

  • Pull more Kbuild updates from Masahiro Yamada:

    - fix randconfig to generate a sane .config

    - rename hostprogs-y / always to hostprogs / always-y, which are more
    natual syntax.

    - optimize scripts/kallsyms

    - fix yes2modconfig and mod2yesconfig

    - make multiple directory targets ('make foo/ bar/') work

    * tag 'kbuild-v5.6-2' of git://git.kernel.org/pub/scm/linux/kernel/git/masahiroy/linux-kbuild:
    kbuild: make multiple directory targets work
    kconfig: Invalidate all symbols after changing to y or m.
    kallsyms: fix type of kallsyms_token_table[]
    scripts/kallsyms: change table to store (strcut sym_entry *)
    scripts/kallsyms: rename local variables in read_symbol()
    kbuild: rename hostprogs-y/always to hostprogs/always-y
    kbuild: fix the document to use extra-y for vmlinux.lds
    kconfig: fix broken dependency in randconfig-generated .config

    Linus Torvalds
     

04 Feb, 2020

2 commits

  • Since commit ddd09bcc899f ("initramfs: make compression options not
    depend on INITRAMFS_SOURCE"), Kconfig asks the compression mode for
    the built-in initramfs regardless of INITRAMFS_SOURCE.

    It is technically simpler, but pointless from a UI perspective,
    Linus says [1].

    When INITRAMFS_SOURCE is empty, usr/Makefile creates a tiny default
    cpio, which is so small that nobody cares about the compression.

    This commit hides the Kconfig choice in that case. The default cpio
    is embedded without compression, which was the original behavior.

    [1]: https://lkml.org/lkml/2020/2/1/160

    Suggested-by: Linus Torvalds
    Signed-off-by: Masahiro Yamada
    Signed-off-by: Linus Torvalds

    Masahiro Yamada
     
  • In old days, the "host-progs" syntax was used for specifying host
    programs. It was renamed to the current "hostprogs-y" in 2004.

    It is typically useful in scripts/Makefile because it allows Kbuild to
    selectively compile host programs based on the kernel configuration.

    This commit renames like follows:

    always -> always-y
    hostprogs-y -> hostprogs

    So, scripts/Makefile will look like this:

    always-$(CONFIG_BUILD_BIN2C) += ...
    always-$(CONFIG_KALLSYMS) += ...
    ...
    hostprogs := $(always-y) $(always-m)

    I think this makes more sense because a host program is always a host
    program, irrespective of the kernel configuration. We want to specify
    which ones to compile by CONFIG options, so always-y will be handier.

    The "always", "hostprogs-y", "hostprogs-m" will be kept for backward
    compatibility for a while.

    Signed-off-by: Masahiro Yamada

    Masahiro Yamada
     

15 Jan, 2020

6 commits


14 Jan, 2020

7 commits


07 Jan, 2020

2 commits


03 Jan, 2020

1 commit

  • Prior to commit 858805b336be ("kbuild: add $(BASH) to run scripts with
    bash-extension"), this shell script was almost always run by bash since
    bash is usually installed on the system by default.

    Now, this script is run by sh, which might be a symlink to dash. On such
    distributions, the following code emits an error:

    local dev=`LC_ALL=C ls -l "${location}"`

    You can reproduce the build error, for example by setting
    CONFIG_INITRAMFS_SOURCE="/dev".

    GEN usr/initramfs_data.cpio.gz
    ./usr/gen_initramfs_list.sh: 131: local: 1: bad variable name
    make[1]: *** [usr/Makefile:61: usr/initramfs_data.cpio.gz] Error 2

    This is because `LC_ALL=C ls -l "${location}"` contains spaces.
    Surrounding it with double-quotes fixes the error.

    Fixes: 858805b336be ("kbuild: add $(BASH) to run scripts with bash-extension")
    Reported-by: Jory A. Pratt
    Signed-off-by: Masahiro Yamada

    Masahiro Yamada
     

09 Dec, 2019

1 commit

  • Since commit fcbb8461fd23 ("kbuild: remove header compile test"),
    'make clean' with O= option in the pristine source tree emits
    'No such file or directory' warning.

    $ git clean -d -f -x
    $ make O=foo clean
    make[1]: Entering directory '/home/masahiro/linux/foo'
    find: ‘usr/include’: No such file or directory
    make[1]: Leaving directory '/home/masahiro/linux/foo'

    Fixes: fcbb8461fd23 ("kbuild: remove header compile test")
    Reported-by: kbuild test robot
    Signed-off-by: Masahiro Yamada

    Masahiro Yamada
     

05 Dec, 2019

4 commits

  • Userspace cannot compile due to some missing type
    definitions. For example, building it for x86 fails as follows:

    CC usr/include/asm/sembuf.h.s
    In file included from :32:0:
    usr/include/asm/sembuf.h:17:20: error: field `sem_perm' has incomplete type
    struct ipc64_perm sem_perm; /* permissions .. see ipc.h */
    ^~~~~~~~
    usr/include/asm/sembuf.h:24:2: error: unknown type name `__kernel_time_t'
    __kernel_time_t sem_otime; /* last semop time */
    ^~~~~~~~~~~~~~~
    usr/include/asm/sembuf.h:25:2: error: unknown type name `__kernel_ulong_t'
    __kernel_ulong_t __unused1;
    ^~~~~~~~~~~~~~~~
    usr/include/asm/sembuf.h:26:2: error: unknown type name `__kernel_time_t'
    __kernel_time_t sem_ctime; /* last change time */
    ^~~~~~~~~~~~~~~
    usr/include/asm/sembuf.h:27:2: error: unknown type name `__kernel_ulong_t'
    __kernel_ulong_t __unused2;
    ^~~~~~~~~~~~~~~~
    usr/include/asm/sembuf.h:29:2: error: unknown type name `__kernel_ulong_t'
    __kernel_ulong_t sem_nsems; /* no. of semaphores in array */
    ^~~~~~~~~~~~~~~~
    usr/include/asm/sembuf.h:30:2: error: unknown type name `__kernel_ulong_t'
    __kernel_ulong_t __unused3;
    ^~~~~~~~~~~~~~~~
    usr/include/asm/sembuf.h:31:2: error: unknown type name `__kernel_ulong_t'
    __kernel_ulong_t __unused4;
    ^~~~~~~~~~~~~~~~

    It is just a matter of missing include directive.

    Include to make it self-contained, and add it to
    the compile-test coverage.

    Link: http://lkml.kernel.org/r/20191030063855.9989-3-yamada.masahiro@socionext.com
    Signed-off-by: Masahiro Yamada
    Cc: Arnd Bergmann
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Masahiro Yamada
     
  • Userspace cannot compile due to some missing type
    definitions. For example, building it for x86 fails as follows:

    CC usr/include/asm/msgbuf.h.s
    In file included from usr/include/asm/msgbuf.h:6:0,
    from :32:
    usr/include/asm-generic/msgbuf.h:25:20: error: field `msg_perm' has incomplete type
    struct ipc64_perm msg_perm;
    ^~~~~~~~
    usr/include/asm-generic/msgbuf.h:27:2: error: unknown type name `__kernel_time_t'
    __kernel_time_t msg_stime; /* last msgsnd time */
    ^~~~~~~~~~~~~~~
    usr/include/asm-generic/msgbuf.h:28:2: error: unknown type name `__kernel_time_t'
    __kernel_time_t msg_rtime; /* last msgrcv time */
    ^~~~~~~~~~~~~~~
    usr/include/asm-generic/msgbuf.h:29:2: error: unknown type name `__kernel_time_t'
    __kernel_time_t msg_ctime; /* last change time */
    ^~~~~~~~~~~~~~~
    usr/include/asm-generic/msgbuf.h:41:2: error: unknown type name `__kernel_pid_t'
    __kernel_pid_t msg_lspid; /* pid of last msgsnd */
    ^~~~~~~~~~~~~~
    usr/include/asm-generic/msgbuf.h:42:2: error: unknown type name `__kernel_pid_t'
    __kernel_pid_t msg_lrpid; /* last receive pid */
    ^~~~~~~~~~~~~~

    It is just a matter of missing include directive.

    Include to make it self-contained, and add it to
    the compile-test coverage.

    Link: http://lkml.kernel.org/r/20191030063855.9989-2-yamada.masahiro@socionext.com
    Signed-off-by: Masahiro Yamada
    Cc: Arnd Bergmann
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Masahiro Yamada
     
  • Userspace cannot compile due to some missing type
    definitions. For example, building it for x86 fails as follows:

    CC usr/include/asm/ipcbuf.h.s
    In file included from usr/include/asm/ipcbuf.h:1:0,
    from :32:
    usr/include/asm-generic/ipcbuf.h:21:2: error: unknown type name `__kernel_key_t'
    __kernel_key_t key;
    ^~~~~~~~~~~~~~
    usr/include/asm-generic/ipcbuf.h:22:2: error: unknown type name `__kernel_uid32_t'
    __kernel_uid32_t uid;
    ^~~~~~~~~~~~~~~~
    usr/include/asm-generic/ipcbuf.h:23:2: error: unknown type name `__kernel_gid32_t'
    __kernel_gid32_t gid;
    ^~~~~~~~~~~~~~~~
    usr/include/asm-generic/ipcbuf.h:24:2: error: unknown type name `__kernel_uid32_t'
    __kernel_uid32_t cuid;
    ^~~~~~~~~~~~~~~~
    usr/include/asm-generic/ipcbuf.h:25:2: error: unknown type name `__kernel_gid32_t'
    __kernel_gid32_t cgid;
    ^~~~~~~~~~~~~~~~
    usr/include/asm-generic/ipcbuf.h:26:2: error: unknown type name `__kernel_mode_t'
    __kernel_mode_t mode;
    ^~~~~~~~~~~~~~~
    usr/include/asm-generic/ipcbuf.h:28:35: error: `__kernel_mode_t' undeclared here (not in a function)
    unsigned char __pad1[4 - sizeof(__kernel_mode_t)];
    ^~~~~~~~~~~~~~~
    usr/include/asm-generic/ipcbuf.h:31:2: error: unknown type name `__kernel_ulong_t'
    __kernel_ulong_t __unused1;
    ^~~~~~~~~~~~~~~~
    usr/include/asm-generic/ipcbuf.h:32:2: error: unknown type name `__kernel_ulong_t'
    __kernel_ulong_t __unused2;
    ^~~~~~~~~~~~~~~~

    It is just a matter of missing include directive.

    Include to make it self-contained, and add it to
    the compile-test coverage.

    Link: http://lkml.kernel.org/r/20191030063855.9989-1-yamada.masahiro@socionext.com
    Signed-off-by: Masahiro Yamada
    Cc: Arnd Bergmann
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Masahiro Yamada
     
  • Userspace cannot compile

    CC usr/include/linux/scc.h.s
    In file included from :32:0:
    usr/include/linux/scc.h:20:20: error: `SIOCDEVPRIVATE' undeclared here (not in a function)
    SIOCSCCRESERVED = SIOCDEVPRIVATE,
    ^~~~~~~~~~~~~~

    Include to make it self-contained, and add it to the
    compile-test coverage.

    Link: http://lkml.kernel.org/r/20191108055809.26969-1-yamada.masahiro@socionext.com
    Signed-off-by: Masahiro Yamada
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Masahiro Yamada