10 Aug, 2020

1 commit

  • To build host programs, you need to add the program names to 'hostprogs'
    to use the necessary build rule, but it is not enough to build them
    because there is no dependency.

    There are two types of host programs: built as the prerequisite of
    another (e.g. gen_crc32table in lib/Makefile), or always built when
    Kbuild visits the Makefile (e.g. genksyms in scripts/genksyms/Makefile).

    The latter is typical in Makefiles under scripts/, which contains host
    programs globally used during the kernel build. To build them, you need
    to add them to both 'hostprogs' and 'always-y'.

    This commit adds hostprogs-always-y as a shorthand.

    The same applies to user programs. net/bpfilter/Makefile builds
    bpfilter_umh on demand, hence always-y is unneeded. In contrast,
    programs under samples/ are added to both 'userprogs' and 'always-y'
    so they are always built when Kbuild visits the Makefiles.

    userprogs-always-y works as a shorthand.

    Signed-off-by: Masahiro Yamada
    Acked-by: Miguel Ojeda

    Masahiro Yamada
     

04 Jul, 2020

1 commit

  • Something changed recently to uncover this warning:

    samples/vfs/test-statx.c:24:15: warning: `struct foo' declared inside parameter list will not be visible outside of this definition or declaration
    24 | #define statx foo
    | ^~~

    Which is due the use of "struct statx" (here, "struct foo") in a function
    prototype argument list before it has been defined:

    int
    # 56 "/usr/include/x86_64-linux-gnu/bits/statx-generic.h"
    foo
    # 56 "/usr/include/x86_64-linux-gnu/bits/statx-generic.h" 3 4
    (int __dirfd, const char *__restrict __path, int __flags,
    unsigned int __mask, struct
    # 57 "/usr/include/x86_64-linux-gnu/bits/statx-generic.h"
    foo
    # 57 "/usr/include/x86_64-linux-gnu/bits/statx-generic.h" 3 4
    *__restrict __buf)
    __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (2, 5)));

    Add explicit struct before #include to avoid warning.

    Fixes: f1b5618e013a ("vfs: Add a sample program for the new mount API")
    Signed-off-by: Kees Cook
    Signed-off-by: Andrew Morton
    Cc: Miklos Szeredi
    Cc: Al Viro
    Cc: David Howells
    Link: http://lkml.kernel.org/r/202006282213.C516EA6@keescook
    Signed-off-by: Linus Torvalds

    Kees Cook
     

07 Jun, 2020

1 commit

  • Pull Kbuild updates from Masahiro Yamada:

    - fix warnings in 'make clean' for ARCH=um, hexagon, h8300, unicore32

    - ensure to rebuild all objects when the compiler is upgraded

    - exclude system headers from dependency tracking and fixdep processing

    - fix potential bit-size mismatch between the kernel and BPF user-mode
    helper

    - add the new syntax 'userprogs' to build user-space programs for the
    target architecture (the same arch as the kernel)

    - compile user-space sample code under samples/ for the target arch
    instead of the host arch

    - make headers_install fail if a CONFIG option is leaked to user-space

    - sanitize the output format of scripts/checkstack.pl

    - handle ARM 'push' instruction in scripts/checkstack.pl

    - error out before modpost if a module name conflict is found

    - error out when multiple directories are passed to M= because this
    feature is broken for a long time

    - add CONFIG_DEBUG_INFO_COMPRESSED to support compressed debug info

    - a lot of cleanups of modpost

    - dump vmlinux symbols out into vmlinux.symvers, and reuse it in the
    second pass of modpost

    - do not run the second pass of modpost if nothing in modules is
    updated

    - install modules.builtin(.modinfo) by 'make install' as well as by
    'make modules_install' because it is useful even when
    CONFIG_MODULES=n

    - add new command line variables, GZIP, BZIP2, LZOP, LZMA, LZ4, and XZ
    to allow users to use alternatives such as pigz, pbzip2, etc.

    * tag 'kbuild-v5.8' of git://git.kernel.org/pub/scm/linux/kernel/git/masahiroy/linux-kbuild: (96 commits)
    kbuild: add variables for compression tools
    Makefile: install modules.builtin even if CONFIG_MODULES=n
    mksysmap: Fix the mismatch of '.L' symbols in System.map
    kbuild: doc: rename LDFLAGS to KBUILD_LDFLAGS
    modpost: change elf_info->size to size_t
    modpost: remove is_vmlinux() helper
    modpost: strip .o from modname before calling new_module()
    modpost: set have_vmlinux in new_module()
    modpost: remove mod->skip struct member
    modpost: add mod->is_vmlinux struct member
    modpost: remove is_vmlinux() call in check_for_{gpl_usage,unused}()
    modpost: remove mod->is_dot_o struct member
    modpost: move -d option in scripts/Makefile.modpost
    modpost: remove -s option
    modpost: remove get_next_text() and make {grab,release_}file static
    modpost: use read_text_file() and get_line() for reading text files
    modpost: avoid false-positive file open error
    modpost: fix potential mmap'ed file overrun in get_src_version()
    modpost: add read_text_file() and get_line() helpers
    modpost: do not call get_modinfo() for vmlinux(.o)
    ...

    Linus Torvalds
     

17 May, 2020

1 commit

  • These userspace programs include UAPI headers exported to usr/include/.
    'make headers' always works for the target architecture (i.e. the same
    architecture as the kernel), so the sample programs should be built for
    the target as well. Kbuild now supports 'userprogs' for that.

    I also guarded the CONFIG option by 'depends on CC_CAN_LINK' because
    $(CC) may not provide libc.

    Signed-off-by: Masahiro Yamada
    Acked-by: Sam Ravnborg

    Masahiro Yamada
     

14 May, 2020

1 commit

  • Constants of the *_ALL type can be actively harmful due to the fact that
    developers will usually fail to consider the possible effects of future
    changes to the definition.

    Deprecate STATX_ALL in the uapi, while no damage has been done yet.

    We could keep something like this around in the kernel, but there's
    actually no point, since all filesystems should be explicitly checking
    flags that they support and not rely on the VFS masking unknown ones out: a
    flag could be known to the VFS, yet not known to the filesystem.

    Cc: David Howells
    Cc: linux-api@vger.kernel.org
    Cc: linux-man@vger.kernel.org
    Signed-off-by: Miklos Szeredi
    Reviewed-by: Christoph Hellwig

    Miklos Szeredi
     

25 Mar, 2020

1 commit


04 Feb, 2020

1 commit

  • 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
     

24 May, 2019

1 commit

  • Based on 1 normalized pattern(s):

    this program is free software you can redistribute it and or modify
    it under the terms of the gnu general public licence as published by
    the free software foundation either version 2 of the licence or at
    your option any later version

    extracted by the scancode license scanner the SPDX license identifier

    GPL-2.0-or-later

    has been chosen to replace the boilerplate/reference in 114 file(s).

    Signed-off-by: Thomas Gleixner
    Reviewed-by: Allison Randal
    Reviewed-by: Kate Stewart
    Cc: linux-spdx@vger.kernel.org
    Link: https://lkml.kernel.org/r/20190520170857.552531963@linutronix.de
    Signed-off-by: Greg Kroah-Hartman

    Thomas Gleixner
     

21 May, 2019

1 commit


18 May, 2019

1 commit


15 May, 2019

1 commit

  • Commit f1b5618e013a ("vfs: Add a sample program for the new mount API")
    added sample programs that get built during the kernel build, but then
    cause 'git status' to worry about whether the resulting binaries should
    be managed by git.

    Tell git not to worry, and to ignore the sample binaries.

    Signed-off-by: Linus Torvalds

    Linus Torvalds
     

21 Mar, 2019

1 commit

  • Add a sample program to demonstrate fsopen/fsmount/move_mount to mount
    something.

    To make it compile on all arches, irrespective of whether or not syscall
    numbers are assigned, define the syscall number to -1 if it isn't to cause
    the kernel to return -ENOSYS.

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

    David Howells