10 Aug, 2020

2 commits

  • Pull Kbuild updates from Masahiro Yamada:

    - run the checker (e.g. sparse) after the compiler

    - remove unneeded cc-option tests for old compiler flags

    - fix tar-pkg to install dtbs

    - introduce ccflags-remove-y and asflags-remove-y syntax

    - allow to trace functions in sub-directories of lib/

    - introduce hostprogs-always-y and userprogs-always-y syntax

    - various Makefile cleanups

    * tag 'kbuild-v5.9' of git://git.kernel.org/pub/scm/linux/kernel/git/masahiroy/linux-kbuild:
    kbuild: stop filtering out $(GCC_PLUGINS_CFLAGS) from cc-option base
    kbuild: include scripts/Makefile.* only when relevant CONFIG is enabled
    kbuild: introduce hostprogs-always-y and userprogs-always-y
    kbuild: sort hostprogs before passing it to ifneq
    kbuild: move host .so build rules to scripts/gcc-plugins/Makefile
    kbuild: Replace HTTP links with HTTPS ones
    kbuild: trace functions in subdirectories of lib/
    kbuild: introduce ccflags-remove-y and asflags-remove-y
    kbuild: do not export LDFLAGS_vmlinux
    kbuild: always create directories of targets
    powerpc/boot: add DTB to 'targets'
    kbuild: buildtar: add dtbs support
    kbuild: remove cc-option test of -ffreestanding
    kbuild: remove cc-option test of -fno-stack-protector
    Revert "kbuild: Create directory for target DTB"
    kbuild: run the checker after the compiler

    Linus Torvalds
     
  • 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
     

06 Aug, 2020

1 commit

  • Pull char/misc driver updates from Greg KH:
    "Here is the large set of char and misc and other driver subsystem
    patches for 5.9-rc1. Lots of new driver submissions in here, and
    cleanups and features for existing drivers.

    Highlights are:
    - habanalabs driver updates
    - coresight driver updates
    - nvmem driver updates
    - huge number of "W=1" build warning cleanups from Lee Jones
    - dyndbg updates
    - virtbox driver fixes and updates
    - soundwire driver updates
    - mei driver updates
    - phy driver updates
    - fpga driver updates
    - lots of smaller individual misc/char driver cleanups and fixes

    Full details are in the shortlog.

    All of these have been in linux-next with no reported issues"

    * tag 'char-misc-5.9-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/char-misc: (322 commits)
    habanalabs: remove unused but set variable 'ctx_asid'
    nvmem: qcom-spmi-sdam: Enable multiple devices
    dt-bindings: nvmem: SID: add binding for A100's SID controller
    nvmem: update Kconfig description
    nvmem: qfprom: Add fuse blowing support
    dt-bindings: nvmem: Add properties needed for blowing fuses
    dt-bindings: nvmem: qfprom: Convert to yaml
    nvmem: qfprom: use NVMEM_DEVID_AUTO for multiple instances
    nvmem: core: add support to auto devid
    nvmem: core: Add nvmem_cell_read_u8()
    nvmem: core: Grammar fixes for help text
    nvmem: sc27xx: add sc2730 efuse support
    nvmem: Enforce nvmem stride in the sysfs interface
    MAINTAINERS: Add git tree for NVMEM FRAMEWORK
    nvmem: sprd: Fix return value of sprd_efuse_probe()
    drivers: android: Fix the SPDX comment style
    drivers: android: Fix a variable declaration coding style issue
    drivers: android: Remove braces for a single statement if-else block
    drivers: android: Remove the use of else after return
    drivers: android: Fix a variable declaration coding style issue
    ...

    Linus Torvalds
     

27 Jul, 2020

2 commits


07 Jul, 2020

1 commit

  • strsep() is neither standard C nor POSIX and used outside
    the kernel code here. Using it here requires that the
    build host supports it out of the box which is e.g.
    not true for a Darwin build host and using a cross-compiler.
    This leads to:

    scripts/mod/modpost.c:145:2: warning: implicit declaration of function 'strsep' [-Wimplicit-function-declaration]
    return strsep(stringp, "\n");
    ^

    and a segfault when running MODPOST.

    See also: https://stackoverflow.com/a/7219504

    So let's replace this by strchr() instead of using strsep().
    It does not hurt kernel size or speed since this code is run
    on the build host.

    Fixes: ac5100f5432967 ("modpost: add read_text_file() and get_line() helpers")
    Co-developed-by: Masahiro Yamada
    Signed-off-by: H. Nikolaus Schaller
    Signed-off-by: Masahiro Yamada

    H. Nikolaus Schaller
     

30 Jun, 2020

1 commit

  • The SoundWire 1.2 specification adds new capabilities that were not
    present in previous version, such as the class ID.

    To enable support for class drivers, and well as drivers that address
    a specific version, all fields of the sdw_device_id structure need to
    be exposed. For SoundWire 1.0 and 1.1 devices, a wildcard is used so
    class and version information are ignored.

    Signed-off-by: Pierre-Louis Bossart
    Reviewed-by: Rander Wang
    Reviewed-by: Guennadi Liakhovetski
    Signed-off-by: Bard Liao
    Link: https://lore.kernel.org/r/20200608205436.2402-4-yung-chuan.liao@linux.intel.com
    Signed-off-by: Vinod Koul

    Pierre-Louis Bossart
     

07 Jun, 2020

2 commits

  • 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
     
  • Pull dmi update from Jean Delvare.

    * 'dmi-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/jdelvare/staging:
    firmware/dmi: Report DMI Bios & EC firmware release

    Linus Torvalds
     

06 Jun, 2020

23 commits

  • Align with the mmap / munmap APIs.

    Signed-off-by: Masahiro Yamada

    Masahiro Yamada
     
  • Now that is_vmlinux() is called only in new_module(), we can inline
    the function call.

    modname is the basename with '.o' is stripped. No need to compare it
    with 'vmlinux.o'.

    vmlinux is always located at the current working directory. No need
    to strip the directory path.

    Signed-off-by: Masahiro Yamada

    Masahiro Yamada
     
  • new_module() conditionally strips the .o because the modname has .o
    suffix when it is called from read_symbols(), but no .o when it is
    called from read_dump().

    It is clearer to strip .o in read_symbols().

    I also used flexible-array for mod->name.

    Signed-off-by: Masahiro Yamada

    Masahiro Yamada
     
  • Set have_vmlinux flag in a single place.

    Signed-off-by: Masahiro Yamada

    Masahiro Yamada
     
  • The meaning of 'skip' is obscure since it does not explain
    "what to skip".

    mod->skip is set when it is vmlinux or the module info came from
    a dump file.

    So, mod->skip is equivalent to (mod->is_vmlinux || mod->from_dump).

    For the check in write_namespace_deps_files(), mod->is_vmlinux is
    unneeded because the -d option is not passed in the first pass of
    modpost.

    Signed-off-by: Masahiro Yamada

    Masahiro Yamada
     
  • is_vmlinux() is called in several places to check whether the current
    module is vmlinux or not.

    It is faster and clearer to check mod->is_vmlinux flag.

    Signed-off-by: Masahiro Yamada

    Masahiro Yamada
     
  • check_exports() is never called for vmlinux because mod->skip is set
    for vmlinux.

    Hence, check_for_gpl_usage() and check_for_unused() are not called
    for vmlinux, either. is_vmlinux() is always false here.

    Remove the is_vmlinux() calls, and hard-code the ".ko" suffix.

    Signed-off-by: Masahiro Yamada

    Masahiro Yamada
     
  • Previously, there were two cases where mod->is_dot_o is unset:

    [1] the executable 'vmlinux' in the second pass of modpost
    [2] modules loaded by read_dump()

    I think [1] was intended usage to distinguish 'vmlinux.o' and 'vmlinux'.
    Now that modpost does not parse the executable 'vmlinux', this case
    does not happen.

    [2] is obscure, maybe a bug. Module.symver stores module paths without
    extension. So, none of modules loaded by read_dump() has the .o suffix,
    and new_module() unsets ->is_dot_o. Anyway, it is not a big deal because
    handle_symbol() is not called for the case.

    To sum up, all the parsed ELF files are .o files.

    mod->is_dot_o is unneeded.

    Signed-off-by: Masahiro Yamada

    Masahiro Yamada
     
  • The -s option was added by commit 8d8d8289df65 ("kbuild: do not do
    section mismatch checks on vmlinux in 2nd pass").

    Now that the second pass does not parse vmlinux, this option is
    unneeded.

    Signed-off-by: Masahiro Yamada

    Masahiro Yamada
     
  • get_next_line() is no longer used. Remove.

    grab_file() and release_file() are only used in modpost.c. Make them
    static.

    Signed-off-by: Masahiro Yamada

    Masahiro Yamada
     
  • grab_file() mmaps a file, but it is not so efficient here because
    get_next_line() copies every line to the temporary buffer anyway.

    read_text_file() and get_line() are simpler. get_line() exploits the
    library function strchr().

    Going forward, the missing *.symvers or *.cmd is a fatal error.
    This should not happen because scripts/Makefile.modpost guards the
    -i option files with $(wildcard $(input-symdump)).

    Signed-off-by: Masahiro Yamada

    Masahiro Yamada
     
  • One problem of grab_file() is that it cannot distinguish the following
    two cases:

    - It cannot read the file (the file does not exist, or read permission
    is not set)

    - It can read the file, but the file size is zero

    This is because grab_file() calls mmap(), which requires the mapped
    length is greater than 0. Hence, grab_file() fails for both cases.

    If an empty header file were included for checksum calculation, the
    following warning would be printed:

    WARNING: modpost: could not open ...: Invalid argument

    An empty file is a valid source file, so it should not fail.

    Use read_text_file() instead. It can read a zero-length file.
    Then, parse_file() will succeed with doing nothing.

    Going forward, the first case (it cannot read the file) is a fatal
    error. If the source file from which an object was compiled is missing,
    something went wrong.

    Signed-off-by: Masahiro Yamada

    Masahiro Yamada
     
  • I do not know how reliably this function works, but it looks dangerous
    to me.

    strchr(sources, '\n');

    ... continues searching until it finds '\n' or it reaches the '\0'
    terminator. In other words, 'sources' should be a null-terminated
    string.

    However, grab_file() just mmaps a file, so 'sources' is not terminated
    with null byte. If the file does not contain '\n' at all, strchr() will
    go beyond the mmap'ed memory.

    Use read_text_file(), which loads the file content into a malloc'ed
    buffer, appending null byte.

    Here we are interested only in the first line of *.mod files. Use
    get_line() helper to get the first line.

    This also makes missing *.mod file a fatal error.

    Commit 4be40e22233c ("kbuild: do not emit src version warning for
    non-modules") ignored missing *.mod files.

    I do not fully understand what that commit addressed, but commit
    91341d4b2c19 ("kbuild: introduce new option to enhance section mismatch
    analysis") introduced partial section checks by using modpost. built-in.o
    was parsed by modpost. Even modules had a problem because *.mod files
    were created after the modpost check.

    Commit b7dca6dd1e59 ("kbuild: create *.mod with full directory path and
    remove MODVERDIR") stopped doing that. Now that modpost is only invoked
    after the directory descend, *.mod files should always exist at the
    modpost stage.

    Signed-off-by: Masahiro Yamada

    Masahiro Yamada
     
  • modpost uses grab_file() to open a file, but it is not suitable for
    a text file because the mmap'ed file is not terminated by null byte.
    Actually, I see some issues for the use of grab_file().

    The new helper, read_text_file() loads the whole file content into a
    malloc'ed buffer, and appends a null byte. Then, get_line() reads
    each line.

    To handle text files, I intend to replace as follows:

    grab_file() -> read_text_file()
    get_new_line() -> get_line()

    Signed-off-by: Masahiro Yamada

    Masahiro Yamada
     
  • The three calls of get_modinfo() ("license", "import_ns", "version")
    always return NULL for vmlinux(.o) because the built-in module info is
    prefixed with __MODULE_INFO_PREFIX.

    It is harmless to call get_modinfo(), but there is no point to search
    for what apparently does not exist.

    Signed-off-by: Masahiro Yamada

    Masahiro Yamada
     
  • As far as I understood, this code gets rid of '$Revision$' or '$Revision:'
    of CVS, RCS or whatever in MODULE_VERSION() tags.

    Remove the primeval code.

    Signed-off-by: Masahiro Yamada

    Masahiro Yamada
     
  • check_exports() does not print warnings about unresolved symbols if
    vmlinux is missing because there would be too many.

    This situation happens when you do 'make modules' from the clean
    tree, or compile external modules against a kernel tree that has
    not been completely built.

    It is dangerous to not check unresolved symbols because you might be
    building useless modules. At least it should be warned.

    Signed-off-by: Masahiro Yamada

    Masahiro Yamada
     
  • Currently, the second pass of modpost is always invoked when you run
    'make' or 'make modules' even if none of modules is changed.

    Use if_changed to invoke it only when it is necessary.

    Signed-off-by: Masahiro Yamada

    Masahiro Yamada
     
  • Previously, the -i option had two functions; load a symbol dump file,
    and set the external_module flag.

    I want to assign a dedicate option for each of them.

    Going forward, the -i is used to load a symbol dump file, and the -e
    to set the external_module flag.

    With this, we will be able to use -i for loading in-kernel symbols.

    Signed-off-by: Masahiro Yamada

    Masahiro Yamada
     
  • The -i option is used to include Modules.symver as well as files from
    $(KBUILD_EXTRA_SYMBOLS).

    Make the struct and variable names more generic.

    Signed-off-by: Masahiro Yamada

    Masahiro Yamada
     
  • Now that there is no difference between -i and -e, they can be unified.

    Make modpost accept the -i option multiple times, then remove -e.

    I will reuse -e for a different purpose.

    Signed-off-by: Masahiro Yamada

    Masahiro Yamada
     
  • The meaning of sym->kernel is obscure; it is set for in-kernel symbols
    loaded from Modules.symvers. This happens only when we are building
    external modules, and it is used to determine whether to dump symbols
    to $(KBUILD_EXTMOD)/Modules.symvers

    It is clearer to remember whether the symbol or module came from a dump
    file or ELF object.

    This changes the KBUILD_EXTRA_SYMBOLS behavior. Previously, symbols
    loaded from KBUILD_EXTRA_SYMBOLS are accumulated into the current
    $(KBUILD_EXTMOD)/Modules.symvers

    Going forward, they will be only used to check symbol references, but
    not dumped into the current $(KBUILD_EXTMOD)/Modules.symvers. I believe
    this makes more sense.

    sym->vmlinux will have no user. Remove it too.

    Signed-off-by: Masahiro Yamada

    Masahiro Yamada
     
  • Some vendors like HPe or Dell, encode the release version of their BIOS
    in the "System BIOS {Major|Minor} Release" fields of Type 0.

    This information is used to know which bios release actually runs.
    It could be used for some quirks, debugging sessions or inventory tasks.

    A typical output for a Dell system running the 65.27 bios is :
    [root@t1700 ~]# cat /sys/devices/virtual/dmi/id/bios_release
    65.27
    [root@t1700 ~]#

    Servers that have a BMC encode the release version of their firmware in the
    "Embedded Controller Firmware {Major|Minor} Release" fields of Type 0.

    This information is used to know which BMC release actually runs.
    It could be used for some quirks, debugging sessions or inventory tasks.

    A typical output for a Dell system running the 3.75 bmc release is :
    [root@t1700 ~]# cat /sys/devices/virtual/dmi/id/ec_firmware_release
    3.75
    [root@t1700 ~]#

    Signed-off-by: Erwan Velu
    Signed-off-by: Jean Delvare

    Erwan Velu
     

04 Jun, 2020

1 commit

  • Pull networking updates from David Miller:

    1) Allow setting bluetooth L2CAP modes via socket option, from Luiz
    Augusto von Dentz.

    2) Add GSO partial support to igc, from Sasha Neftin.

    3) Several cleanups and improvements to r8169 from Heiner Kallweit.

    4) Add IF_OPER_TESTING link state and use it when ethtool triggers a
    device self-test. From Andrew Lunn.

    5) Start moving away from custom driver versions, use the globally
    defined kernel version instead, from Leon Romanovsky.

    6) Support GRO vis gro_cells in DSA layer, from Alexander Lobakin.

    7) Allow hard IRQ deferral during NAPI, from Eric Dumazet.

    8) Add sriov and vf support to hinic, from Luo bin.

    9) Support Media Redundancy Protocol (MRP) in the bridging code, from
    Horatiu Vultur.

    10) Support netmap in the nft_nat code, from Pablo Neira Ayuso.

    11) Allow UDPv6 encapsulation of ESP in the ipsec code, from Sabrina
    Dubroca. Also add ipv6 support for espintcp.

    12) Lots of ReST conversions of the networking documentation, from Mauro
    Carvalho Chehab.

    13) Support configuration of ethtool rxnfc flows in bcmgenet driver,
    from Doug Berger.

    14) Allow to dump cgroup id and filter by it in inet_diag code, from
    Dmitry Yakunin.

    15) Add infrastructure to export netlink attribute policies to
    userspace, from Johannes Berg.

    16) Several optimizations to sch_fq scheduler, from Eric Dumazet.

    17) Fallback to the default qdisc if qdisc init fails because otherwise
    a packet scheduler init failure will make a device inoperative. From
    Jesper Dangaard Brouer.

    18) Several RISCV bpf jit optimizations, from Luke Nelson.

    19) Correct the return type of the ->ndo_start_xmit() method in several
    drivers, it's netdev_tx_t but many drivers were using
    'int'. From Yunjian Wang.

    20) Add an ethtool interface for PHY master/slave config, from Oleksij
    Rempel.

    21) Add BPF iterators, from Yonghang Song.

    22) Add cable test infrastructure, including ethool interfaces, from
    Andrew Lunn. Marvell PHY driver is the first to support this
    facility.

    23) Remove zero-length arrays all over, from Gustavo A. R. Silva.

    24) Calculate and maintain an explicit frame size in XDP, from Jesper
    Dangaard Brouer.

    25) Add CAP_BPF, from Alexei Starovoitov.

    26) Support terse dumps in the packet scheduler, from Vlad Buslov.

    27) Support XDP_TX bulking in dpaa2 driver, from Ioana Ciornei.

    28) Add devm_register_netdev(), from Bartosz Golaszewski.

    29) Minimize qdisc resets, from Cong Wang.

    30) Get rid of kernel_getsockopt and kernel_setsockopt in order to
    eliminate set_fs/get_fs calls. From Christoph Hellwig.

    * git://git.kernel.org/pub/scm/linux/kernel/git/netdev/net-next: (2517 commits)
    selftests: net: ip_defrag: ignore EPERM
    net_failover: fixed rollback in net_failover_open()
    Revert "tipc: Fix potential tipc_aead refcnt leak in tipc_crypto_rcv"
    Revert "tipc: Fix potential tipc_node refcnt leak in tipc_rcv"
    vmxnet3: allow rx flow hash ops only when rss is enabled
    hinic: add set_channels ethtool_ops support
    selftests/bpf: Add a default $(CXX) value
    tools/bpf: Don't use $(COMPILE.c)
    bpf, selftests: Use bpf_probe_read_kernel
    s390/bpf: Use bcr 0,%0 as tail call nop filler
    s390/bpf: Maintain 8-byte stack alignment
    selftests/bpf: Fix verifier test
    selftests/bpf: Fix sample_cnt shared between two threads
    bpf, selftests: Adapt cls_redirect to call csum_level helper
    bpf: Add csum_level helper for fixing up csum levels
    bpf: Fix up bpf_skb_adjust_room helper's skb csum setting
    sfc: add missing annotation for efx_ef10_try_update_nic_stats_vf()
    crypto/chtls: IPv6 support for inline TLS
    Crypto/chcr: Fixes a coccinile check error
    Crypto/chcr: Fixes compilations warnings
    ...

    Linus Torvalds
     

03 Jun, 2020

1 commit


29 May, 2020

2 commits

  • Use sym_get_data_by_offset() helper to get access to the .shstrtab
    section data. No functional change is intended because
    elf->sechdrs[elf->secindex_strings].sh_addr is 0 for both ET_REL
    and ET_EXEC object types.

    Signed-off-by: Masahiro Yamada

    Masahiro Yamada
     
  • This may not be a practical problem, but the second pass of ARCH=i386
    modpost causes segmentation fault if the -s option is not passed.

    MODPOST 12 modules
    Segmentation fault (core dumped)
    make[2]: *** [scripts/Makefile.modpost:94: __modpost] Error 139
    make[1]: *** [Makefile:1339: modules] Error 2
    make[1]: *** Waiting for unfinished jobs....

    The segmentation fault occurs when section_rel() is called for vmlinux,
    which is untested in regular builds. The cause of the problem is
    reloc_location() returning a wrong pointer for ET_EXEC object type.
    In this case, you need to subtract sechdr->sh_addr, otherwise it would
    get access beyond the mmap'ed memory.

    Add sym_get_data_by_offset() helper to avoid code duplication.

    Signed-off-by: Masahiro Yamada

    Masahiro Yamada
     

25 May, 2020

1 commit

  • The current codebase makes use of the zero-length array language
    extension to the C90 standard, but the preferred mechanism to declare
    variable-length types such as these ones is a flexible array member[1][2],
    introduced in C99:

    struct foo {
    int stuff;
    struct boo array[];
    };

    By making use of the mechanism above, we will get a compiler warning
    in case the flexible array does not occur last in the structure, which
    will help us prevent some kind of undefined behavior bugs from being
    inadvertently introduced[3] to the codebase from now on.

    Also, notice that, dynamic memory allocations won't be affected by
    this change:

    "Flexible array members have incomplete type, and so the sizeof operator
    may not be applied. As a quirk of the original implementation of
    zero-length arrays, sizeof evaluates to zero."[1]

    sizeof(flexible-array-member) triggers a warning because flexible array
    members have incomplete type[1]. There are some instances of code in
    which the sizeof operator is being incorrectly/erroneously applied to
    zero-length arrays and the result is zero. Such instances may be hiding
    some bugs. So, this work (flexible-array member conversions) will also
    help to get completely rid of those sorts of issues.

    This issue was found with the help of Coccinelle.

    [1] https://gcc.gnu.org/onlinedocs/gcc/Zero-Length.html
    [2] https://github.com/KSPP/linux/issues/21
    [3] commit 76497732932f ("cxgb3/l2t: Fix undefined behaviour")

    Signed-off-by: Gustavo A. R. Silva
    Signed-off-by: Masahiro Yamada

    Gustavo A. R. Silva
     

19 May, 2020

1 commit

  • Some code pathes, especially the low level entry code, must be protected
    against instrumentation for various reasons:

    - Low level entry code can be a fragile beast, especially on x86.

    - With NO_HZ_FULL RCU state needs to be established before using it.

    Having a dedicated section for such code allows to validate with tooling
    that no unsafe functions are invoked.

    Add the .noinstr.text section and the noinstr attribute to mark
    functions. noinstr implies notrace. Kprobes will gain a section check
    later.

    Provide also a set of markers: instrumentation_begin()/end()

    These are used to mark code inside a noinstr function which calls
    into regular instrumentable text section as safe.

    The instrumentation markers are only active when CONFIG_DEBUG_ENTRY is
    enabled as the end marker emits a NOP to prevent the compiler from merging
    the annotation points. This means the objtool verification requires a
    kernel compiled with this option.

    Signed-off-by: Thomas Gleixner
    Reviewed-by: Alexandre Chartre
    Acked-by: Peter Zijlstra
    Link: https://lkml.kernel.org/r/20200505134100.075416272@linutronix.de

    Thomas Gleixner
     

22 Apr, 2020

1 commit

  • VERMAGIC* definitions are not supposed to be used by the drivers,
    see this [1] bug report, so introduce special define to guard inclusion
    of this header file and define it in kernel/modules.h and in internal
    script that generates *.mod.c files.

    In-tree module build:
    ➜ kernel git:(vermagic) ✗ make clean
    ➜ kernel git:(vermagic) ✗ make M=drivers/infiniband/hw/mlx5
    ➜ kernel git:(vermagic) ✗ modinfo drivers/infiniband/hw/mlx5/mlx5_ib.ko
    filename: /images/leonro/src/kernel/drivers/infiniband/hw/mlx5/mlx5_ib.ko

    vermagic: 5.6.0+ SMP mod_unload modversions

    Out-of-tree module build:
    ➜ mlx5 make -C /images/leonro/src/kernel clean M=/tmp/mlx5
    ➜ mlx5 make -C /images/leonro/src/kernel M=/tmp/mlx5
    ➜ mlx5 modinfo /tmp/mlx5/mlx5_ib.ko
    filename: /tmp/mlx5/mlx5_ib.ko

    vermagic: 5.6.0+ SMP mod_unload modversions

    [1] https://lore.kernel.org/lkml/20200411155623.GA22175@zn.tnic
    Reported-by: Borislav Petkov
    Acked-by: Borislav Petkov
    Acked-by: Jessica Yu
    Co-developed-by: Masahiro Yamada
    Signed-off-by: Masahiro Yamada
    Signed-off-by: Leon Romanovsky
    Signed-off-by: David S. Miller

    Leon Romanovsky
     

04 Apr, 2020

1 commit

  • Pull char/misc driver updates from Greg KH:
    "Here is the big set of char/misc/other driver patches for 5.7-rc1.

    Lots of things in here, and it's later than expected due to some
    reverts to resolve some reported issues. All is now clean with no
    reported problems in linux-next.

    Included in here is:
    - interconnect updates
    - mei driver updates
    - uio updates
    - nvmem driver updates
    - soundwire updates
    - binderfs updates
    - coresight updates
    - habanalabs updates
    - mhi new bus type and core
    - extcon driver updates
    - some Kconfig cleanups
    - other small misc driver cleanups and updates

    As mentioned, all have been in linux-next for a while, and with the
    last two reverts, all is calm and good"

    * tag 'char-misc-5.7-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/char-misc: (174 commits)
    Revert "driver core: platform: Initialize dma_parms for platform devices"
    Revert "amba: Initialize dma_parms for amba devices"
    amba: Initialize dma_parms for amba devices
    driver core: platform: Initialize dma_parms for platform devices
    bus: mhi: core: Drop the references to mhi_dev in mhi_destroy_device()
    bus: mhi: core: Initialize bhie field in mhi_cntrl for RDDM capture
    bus: mhi: core: Add support for reading MHI info from device
    misc: rtsx: set correct pcr_ops for rts522A
    speakup: misc: Use dynamic minor numbers for speakup devices
    mei: me: add cedar fork device ids
    coresight: do not use the BIT() macro in the UAPI header
    Documentation: provide IBM contacts for embargoed hardware
    nvmem: core: remove nvmem_sysfs_get_groups()
    nvmem: core: use is_bin_visible for permissions
    nvmem: core: use device_register and device_unregister
    nvmem: core: add root_only member to nvmem device struct
    extcon: axp288: Add wakeup support
    extcon: Mark extcon_get_edev_name() function as exported symbol
    extcon: palmas: Hide error messages if gpio returns -EPROBE_DEFER
    dt-bindings: extcon: usbc-cros-ec: convert extcon-usbc-cros-ec.txt to yaml format
    ...

    Linus Torvalds