13 Feb, 2019

1 commit

  • [ Upstream commit 8892d8545f2d0342b9c550defbfb165db237044b ]

    Changing protection is a very high cost operation in UML
    because in addition to an extra syscall it also interrupts
    mmap merge sequences generated by the tlb.

    While the condition is not particularly common it is worth
    avoiding.

    Signed-off-by: Anton Ivanov
    Signed-off-by: Richard Weinberger
    Signed-off-by: Sasha Levin

    Anton Ivanov
     

27 Nov, 2018

1 commit

  • [ Upstream commit 7ff1e34bbdc15acab823b1ee4240e94623d50ee8 ]

    Fixes:
    arch/um/os-Linux/skas/process.c:613:1: warning: control reaches end of
    non-void function [-Wreturn-type]

    longjmp() never returns but gcc still warns that the end of the function
    can be reached.
    Add a return code and debug aid to detect this impossible case.

    Signed-off-by: Richard Weinberger
    Signed-off-by: Sasha Levin

    Richard Weinberger
     

24 Aug, 2018

1 commit

  • Commit a0f97e06a43c ("kbuild: enable 'make CFLAGS=...' to add
    additional options to CC") renamed CFLAGS to KBUILD_CFLAGS.

    Commit 222d394d30e7 ("kbuild: enable 'make AFLAGS=...' to add
    additional options to AS") renamed AFLAGS to KBUILD_AFLAGS.

    Commit 06c5040cdb13 ("kbuild: enable 'make CPPFLAGS=...' to add
    additional options to CPP") renamed CPPFLAGS to KBUILD_CPPFLAGS.

    For some reason, LDFLAGS was not renamed.

    Using a well-known variable like LDFLAGS may result in accidental
    override of the variable.

    Kbuild generally uses KBUILD_ prefixed variables for the internally
    appended options, so here is one more conversion to sanitize the
    naming convention.

    I did not touch Makefiles under tools/ since the tools build system
    is a different world.

    Signed-off-by: Masahiro Yamada
    Acked-by: Kirill A. Shutemov
    Reviewed-by: Palmer Dabbelt

    Masahiro Yamada
     

18 Aug, 2018

1 commit

  • Use new return type vm_fault_t for fault handler. For now, this is just
    documenting that the function returns a VM_FAULT value rather than an
    errno. Once all instances are converted, vm_fault_t will become a
    distinct type.

    Ref-> commit 1c8f422059ae ("mm: change return type to vm_fault_t")

    In this patch all the caller of handle_mm_fault() are changed to return
    vm_fault_t type.

    Link: http://lkml.kernel.org/r/20180617084810.GA6730@jordon-HP-15-Notebook-PC
    Signed-off-by: Souptick Joarder
    Cc: Matthew Wilcox
    Cc: Richard Henderson
    Cc: Tony Luck
    Cc: Matt Turner
    Cc: Vineet Gupta
    Cc: Russell King
    Cc: Catalin Marinas
    Cc: Will Deacon
    Cc: Richard Kuo
    Cc: Geert Uytterhoeven
    Cc: Michal Simek
    Cc: James Hogan
    Cc: Ley Foon Tan
    Cc: Jonas Bonn
    Cc: James E.J. Bottomley
    Cc: Benjamin Herrenschmidt
    Cc: Palmer Dabbelt
    Cc: Yoshinori Sato
    Cc: David S. Miller
    Cc: Richard Weinberger
    Cc: Guan Xuetao
    Cc: Thomas Gleixner
    Cc: "H. Peter Anvin"
    Cc: "Levin, Alexander (Sasha Levin)"
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Souptick Joarder
     

16 Aug, 2018

1 commit

  • Pull Kconfig consolidation from Masahiro Yamada:
    "Consolidation of Kconfig files by Christoph Hellwig.

    Move the source statements of arch-independent Kconfig files instead
    of duplicating the includes in every arch/$(SRCARCH)/Kconfig"

    * tag 'kconfig-v4.19-2' of git://git.kernel.org/pub/scm/linux/kernel/git/masahiroy/linux-kbuild:
    kconfig: add a Memory Management options" menu
    kconfig: move the "Executable file formats" menu to fs/Kconfig.binfmt
    kconfig: use a menu in arch/Kconfig to reduce clutter
    kconfig: include kernel/Kconfig.preempt from init/Kconfig
    Kconfig: consolidate the "Kernel hacking" menu
    kconfig: include common Kconfig files from top-level Kconfig
    kconfig: remove duplicate SWAP symbol defintions
    um: create a proper drivers Kconfig
    um: cleanup Kconfig files
    um: stop abusing KBUILD_KCONFIG

    Linus Torvalds
     

07 Aug, 2018

2 commits

  • Now that '%asm-generic' is added to no-dot-config-targets,
    'make asm-generic' does not include the kernel configuration.

    You can simply do 'make asm-generic' in the recursed top Makefile
    without bothering syncconfig.

    Signed-off-by: Masahiro Yamada
    Tested-by: Randy Dunlap
    Acked-by: Richard Weinberger

    Masahiro Yamada
     
  • Randy Dunlap reports UML occasionally fails to build with -j and
    O= options.

    make[1]: Entering directory '/home/rdunlap/mmotm-2018-0802-1529/UM64'
    UPD include/generated/uapi/linux/version.h
    WRAP arch/x86/include/generated/asm/dma-contiguous.h
    WRAP arch/x86/include/generated/asm/export.h
    WRAP arch/x86/include/generated/asm/early_ioremap.h
    WRAP arch/x86/include/generated/asm/mcs_spinlock.h
    WRAP arch/x86/include/generated/asm/mm-arch-hooks.h
    WRAP arch/x86/include/generated/uapi/asm/bpf_perf_event.h
    WRAP arch/x86/include/generated/uapi/asm/poll.h
    GEN ./Makefile
    make[2]: *** No rule to make target 'archheaders'. Stop.
    arch/um/Makefile:119: recipe for target 'archheaders' failed
    make[1]: *** [archheaders] Error 2
    make[1]: *** Waiting for unfinished jobs....
    UPD include/config/kernel.release
    make[1]: *** wait: No child processes. Stop.
    Makefile:146: recipe for target 'sub-make' failed
    make: *** [sub-make] Error 2

    The cause of the problem is the use of '$(MAKE) KBUILD_SRC=',
    which recurses to the top Makefile via the $(objtree)/Makefile
    generated by scripts/mkmakefile.

    When you run "make -j O= ARCH=um", Make can execute
    'archheaders' and 'outputmakefile' targets simultaneously because
    there is no dependency between them.

    If it happens,

    $(Q)$(MAKE) KBUILD_SRC= ARCH=$(HEADER_ARCH) archheaders

    ... tries to run $(objtree)/Makefile that is being updated.

    The correct way for the recursion is

    $(Q)$(MAKE) -f $(srctree)/Makefile ARCH=$(HEADER_ARCH) archheaders

    ..., which does not rely on the generated Makefile.

    Reported-by: Randy Dunlap
    Signed-off-by: Masahiro Yamada
    Tested-by: Randy Dunlap
    Acked-by: Richard Weinberger

    Masahiro Yamada
     

02 Aug, 2018

6 commits

  • Almost all architectures include it. Add a ARCH_NO_PREEMPT symbol to
    disable preempt support for alpha, hexagon, non-coldfire m68k and
    user mode Linux.

    Signed-off-by: Christoph Hellwig
    Signed-off-by: Masahiro Yamada

    Christoph Hellwig
     
  • Move the source of lib/Kconfig.debug and arch/$(ARCH)/Kconfig.debug to
    the top-level Kconfig. For two architectures that means moving their
    arch-specific symbols in that menu into a new arch Kconfig.debug file,
    and for a few more creating a dummy file so that we can include it
    unconditionally.

    Also move the actual 'Kernel hacking' menu to lib/Kconfig.debug, where
    it belongs.

    Signed-off-by: Christoph Hellwig
    Signed-off-by: Masahiro Yamada

    Christoph Hellwig
     
  • Instead of duplicating the source statements in every architecture just
    do it once in the toplevel Kconfig file.

    Note that with this the inclusion of arch/$(SRCARCH/Kconfig moves out of
    the top-level Kconfig into arch/Kconfig so that don't violate ordering
    constraits while keeping a sensible menu structure.

    Signed-off-by: Christoph Hellwig
    Signed-off-by: Masahiro Yamada

    Christoph Hellwig
     
  • Merge arch/um/Kconfig.char and arch/um/Kconfig.net into a new
    arch/um/drivers/Kconfig. This fits the way Kconfig files are placed
    elsewhere in the kernel tree.

    Signed-off-by: Christoph Hellwig
    Acked-by: Richard Weinberger
    Signed-off-by: Masahiro Yamada

    Christoph Hellwig
     
  • We can handle all not architecture specific UM configuration directly in
    the newly added arch/um/Kconfig. Do so by merging the Kconfig.common,
    Kconfig.rest and Kconfig.um files into arch/um/Kconfig, and move the main
    UML menu as well.

    Signed-off-by: Christoph Hellwig
    Acked-by: Richard Weinberger
    Signed-off-by: Masahiro Yamada

    Christoph Hellwig
     
  • Instead create a arch/um/Kconfig file that just includes the actual
    per-arch Kconfig file. Note that we use HEADER_ARCH to find the
    per-arch Kconfig file as that variable already includes the
    normalization from i386 or x86_64 to x86.

    Signed-off-by: Christoph Hellwig
    Acked-by: Richard Weinberger
    Signed-off-by: Masahiro Yamada

    Christoph Hellwig
     

28 Jul, 2018

1 commit


19 Jul, 2018

1 commit


17 Jun, 2018

1 commit

  • Pull documentation fixes from Mauro Carvalho Chehab:
    "This solves a series of broken links for files under Documentation,
    and improves a script meant to detect such broken links (see
    scripts/documentation-file-ref-check).

    The changes on this series are:

    - can.rst: fix a footnote reference;

    - crypto_engine.rst: Fix two parsing warnings;

    - Fix a lot of broken references to Documentation/*;

    - improve the scripts/documentation-file-ref-check script, in order
    to help detecting/fixing broken references, preventing
    false-positives.

    After this patch series, only 33 broken references to doc files are
    detected by scripts/documentation-file-ref-check"

    * tag 'docs-broken-links' of git://linuxtv.org/mchehab/experimental: (26 commits)
    fix a series of Documentation/ broken file name references
    Documentation: rstFlatTable.py: fix a broken reference
    ABI: sysfs-devices-system-cpu: remove a broken reference
    devicetree: fix a series of wrong file references
    devicetree: fix name of pinctrl-bindings.txt
    devicetree: fix some bindings file names
    MAINTAINERS: fix location of DT npcm files
    MAINTAINERS: fix location of some display DT bindings
    kernel-parameters.txt: fix pointers to sound parameters
    bindings: nvmem/zii: Fix location of nvmem.txt
    docs: Fix more broken references
    scripts/documentation-file-ref-check: check tools/*/Documentation
    scripts/documentation-file-ref-check: get rid of false-positives
    scripts/documentation-file-ref-check: hint: dash or underline
    scripts/documentation-file-ref-check: add a fix logic for DT
    scripts/documentation-file-ref-check: accept more wildcards at filenames
    scripts/documentation-file-ref-check: fix help message
    media: max2175: fix location of driver's companion documentation
    media: v4l: fix broken video4linux docs locations
    media: dvb: point to the location of the old README.dvb-usb file
    ...

    Linus Torvalds
     

16 Jun, 2018

2 commits

  • Pull uml updates from Richard Weinberger:
    "Minor updates for UML:

    - fixes for our new vector network driver by Anton

    - initcall cleanup by Alexander

    - We have a new mailinglist, sourceforge.net sucks"

    * 'for-linus-4.18-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/rw/uml:
    um: Fix raw interface options
    um: Fix initialization of vector queues
    um: remove uml initcalls
    um: Update mailing list address

    Linus Torvalds
     
  • As we move stuff around, some doc references are broken. Fix some of
    them via this script:
    ./scripts/documentation-file-ref-check --fix

    Manually checked if the produced result is valid, removing a few
    false-positives.

    Acked-by: Takashi Iwai
    Acked-by: Masami Hiramatsu
    Acked-by: Stephen Boyd
    Acked-by: Charles Keepax
    Acked-by: Mathieu Poirier
    Reviewed-by: Coly Li
    Signed-off-by: Mauro Carvalho Chehab
    Acked-by: Jonathan Corbet

    Mauro Carvalho Chehab
     

13 Jun, 2018

1 commit

  • The kmalloc() function has a 2-factor argument form, kmalloc_array(). This
    patch replaces cases of:

    kmalloc(a * b, gfp)

    with:
    kmalloc_array(a * b, gfp)

    as well as handling cases of:

    kmalloc(a * b * c, gfp)

    with:

    kmalloc(array3_size(a, b, c), gfp)

    as it's slightly less ugly than:

    kmalloc_array(array_size(a, b), c, gfp)

    This does, however, attempt to ignore constant size factors like:

    kmalloc(4 * 1024, gfp)

    though any constants defined via macros get caught up in the conversion.

    Any factors with a sizeof() of "unsigned char", "char", and "u8" were
    dropped, since they're redundant.

    The tools/ directory was manually excluded, since it has its own
    implementation of kmalloc().

    The Coccinelle script used for this was:

    // Fix redundant parens around sizeof().
    @@
    type TYPE;
    expression THING, E;
    @@

    (
    kmalloc(
    - (sizeof(TYPE)) * E
    + sizeof(TYPE) * E
    , ...)
    |
    kmalloc(
    - (sizeof(THING)) * E
    + sizeof(THING) * E
    , ...)
    )

    // Drop single-byte sizes and redundant parens.
    @@
    expression COUNT;
    typedef u8;
    typedef __u8;
    @@

    (
    kmalloc(
    - sizeof(u8) * (COUNT)
    + COUNT
    , ...)
    |
    kmalloc(
    - sizeof(__u8) * (COUNT)
    + COUNT
    , ...)
    |
    kmalloc(
    - sizeof(char) * (COUNT)
    + COUNT
    , ...)
    |
    kmalloc(
    - sizeof(unsigned char) * (COUNT)
    + COUNT
    , ...)
    |
    kmalloc(
    - sizeof(u8) * COUNT
    + COUNT
    , ...)
    |
    kmalloc(
    - sizeof(__u8) * COUNT
    + COUNT
    , ...)
    |
    kmalloc(
    - sizeof(char) * COUNT
    + COUNT
    , ...)
    |
    kmalloc(
    - sizeof(unsigned char) * COUNT
    + COUNT
    , ...)
    )

    // 2-factor product with sizeof(type/expression) and identifier or constant.
    @@
    type TYPE;
    expression THING;
    identifier COUNT_ID;
    constant COUNT_CONST;
    @@

    (
    - kmalloc
    + kmalloc_array
    (
    - sizeof(TYPE) * (COUNT_ID)
    + COUNT_ID, sizeof(TYPE)
    , ...)
    |
    - kmalloc
    + kmalloc_array
    (
    - sizeof(TYPE) * COUNT_ID
    + COUNT_ID, sizeof(TYPE)
    , ...)
    |
    - kmalloc
    + kmalloc_array
    (
    - sizeof(TYPE) * (COUNT_CONST)
    + COUNT_CONST, sizeof(TYPE)
    , ...)
    |
    - kmalloc
    + kmalloc_array
    (
    - sizeof(TYPE) * COUNT_CONST
    + COUNT_CONST, sizeof(TYPE)
    , ...)
    |
    - kmalloc
    + kmalloc_array
    (
    - sizeof(THING) * (COUNT_ID)
    + COUNT_ID, sizeof(THING)
    , ...)
    |
    - kmalloc
    + kmalloc_array
    (
    - sizeof(THING) * COUNT_ID
    + COUNT_ID, sizeof(THING)
    , ...)
    |
    - kmalloc
    + kmalloc_array
    (
    - sizeof(THING) * (COUNT_CONST)
    + COUNT_CONST, sizeof(THING)
    , ...)
    |
    - kmalloc
    + kmalloc_array
    (
    - sizeof(THING) * COUNT_CONST
    + COUNT_CONST, sizeof(THING)
    , ...)
    )

    // 2-factor product, only identifiers.
    @@
    identifier SIZE, COUNT;
    @@

    - kmalloc
    + kmalloc_array
    (
    - SIZE * COUNT
    + COUNT, SIZE
    , ...)

    // 3-factor product with 1 sizeof(type) or sizeof(expression), with
    // redundant parens removed.
    @@
    expression THING;
    identifier STRIDE, COUNT;
    type TYPE;
    @@

    (
    kmalloc(
    - sizeof(TYPE) * (COUNT) * (STRIDE)
    + array3_size(COUNT, STRIDE, sizeof(TYPE))
    , ...)
    |
    kmalloc(
    - sizeof(TYPE) * (COUNT) * STRIDE
    + array3_size(COUNT, STRIDE, sizeof(TYPE))
    , ...)
    |
    kmalloc(
    - sizeof(TYPE) * COUNT * (STRIDE)
    + array3_size(COUNT, STRIDE, sizeof(TYPE))
    , ...)
    |
    kmalloc(
    - sizeof(TYPE) * COUNT * STRIDE
    + array3_size(COUNT, STRIDE, sizeof(TYPE))
    , ...)
    |
    kmalloc(
    - sizeof(THING) * (COUNT) * (STRIDE)
    + array3_size(COUNT, STRIDE, sizeof(THING))
    , ...)
    |
    kmalloc(
    - sizeof(THING) * (COUNT) * STRIDE
    + array3_size(COUNT, STRIDE, sizeof(THING))
    , ...)
    |
    kmalloc(
    - sizeof(THING) * COUNT * (STRIDE)
    + array3_size(COUNT, STRIDE, sizeof(THING))
    , ...)
    |
    kmalloc(
    - sizeof(THING) * COUNT * STRIDE
    + array3_size(COUNT, STRIDE, sizeof(THING))
    , ...)
    )

    // 3-factor product with 2 sizeof(variable), with redundant parens removed.
    @@
    expression THING1, THING2;
    identifier COUNT;
    type TYPE1, TYPE2;
    @@

    (
    kmalloc(
    - sizeof(TYPE1) * sizeof(TYPE2) * COUNT
    + array3_size(COUNT, sizeof(TYPE1), sizeof(TYPE2))
    , ...)
    |
    kmalloc(
    - sizeof(TYPE1) * sizeof(THING2) * (COUNT)
    + array3_size(COUNT, sizeof(TYPE1), sizeof(TYPE2))
    , ...)
    |
    kmalloc(
    - sizeof(THING1) * sizeof(THING2) * COUNT
    + array3_size(COUNT, sizeof(THING1), sizeof(THING2))
    , ...)
    |
    kmalloc(
    - sizeof(THING1) * sizeof(THING2) * (COUNT)
    + array3_size(COUNT, sizeof(THING1), sizeof(THING2))
    , ...)
    |
    kmalloc(
    - sizeof(TYPE1) * sizeof(THING2) * COUNT
    + array3_size(COUNT, sizeof(TYPE1), sizeof(THING2))
    , ...)
    |
    kmalloc(
    - sizeof(TYPE1) * sizeof(THING2) * (COUNT)
    + array3_size(COUNT, sizeof(TYPE1), sizeof(THING2))
    , ...)
    )

    // 3-factor product, only identifiers, with redundant parens removed.
    @@
    identifier STRIDE, SIZE, COUNT;
    @@

    (
    kmalloc(
    - (COUNT) * STRIDE * SIZE
    + array3_size(COUNT, STRIDE, SIZE)
    , ...)
    |
    kmalloc(
    - COUNT * (STRIDE) * SIZE
    + array3_size(COUNT, STRIDE, SIZE)
    , ...)
    |
    kmalloc(
    - COUNT * STRIDE * (SIZE)
    + array3_size(COUNT, STRIDE, SIZE)
    , ...)
    |
    kmalloc(
    - (COUNT) * (STRIDE) * SIZE
    + array3_size(COUNT, STRIDE, SIZE)
    , ...)
    |
    kmalloc(
    - COUNT * (STRIDE) * (SIZE)
    + array3_size(COUNT, STRIDE, SIZE)
    , ...)
    |
    kmalloc(
    - (COUNT) * STRIDE * (SIZE)
    + array3_size(COUNT, STRIDE, SIZE)
    , ...)
    |
    kmalloc(
    - (COUNT) * (STRIDE) * (SIZE)
    + array3_size(COUNT, STRIDE, SIZE)
    , ...)
    |
    kmalloc(
    - COUNT * STRIDE * SIZE
    + array3_size(COUNT, STRIDE, SIZE)
    , ...)
    )

    // Any remaining multi-factor products, first at least 3-factor products,
    // when they're not all constants...
    @@
    expression E1, E2, E3;
    constant C1, C2, C3;
    @@

    (
    kmalloc(C1 * C2 * C3, ...)
    |
    kmalloc(
    - (E1) * E2 * E3
    + array3_size(E1, E2, E3)
    , ...)
    |
    kmalloc(
    - (E1) * (E2) * E3
    + array3_size(E1, E2, E3)
    , ...)
    |
    kmalloc(
    - (E1) * (E2) * (E3)
    + array3_size(E1, E2, E3)
    , ...)
    |
    kmalloc(
    - E1 * E2 * E3
    + array3_size(E1, E2, E3)
    , ...)
    )

    // And then all remaining 2 factors products when they're not all constants,
    // keeping sizeof() as the second factor argument.
    @@
    expression THING, E1, E2;
    type TYPE;
    constant C1, C2, C3;
    @@

    (
    kmalloc(sizeof(THING) * C2, ...)
    |
    kmalloc(sizeof(TYPE) * C2, ...)
    |
    kmalloc(C1 * C2 * C3, ...)
    |
    kmalloc(C1 * C2, ...)
    |
    - kmalloc
    + kmalloc_array
    (
    - sizeof(TYPE) * (E2)
    + E2, sizeof(TYPE)
    , ...)
    |
    - kmalloc
    + kmalloc_array
    (
    - sizeof(TYPE) * E2
    + E2, sizeof(TYPE)
    , ...)
    |
    - kmalloc
    + kmalloc_array
    (
    - sizeof(THING) * (E2)
    + E2, sizeof(THING)
    , ...)
    |
    - kmalloc
    + kmalloc_array
    (
    - sizeof(THING) * E2
    + E2, sizeof(THING)
    , ...)
    |
    - kmalloc
    + kmalloc_array
    (
    - (E1) * E2
    + E1, E2
    , ...)
    |
    - kmalloc
    + kmalloc_array
    (
    - (E1) * (E2)
    + E1, E2
    , ...)
    |
    - kmalloc
    + kmalloc_array
    (
    - E1 * E2
    + E1, E2
    , ...)
    )

    Signed-off-by: Kees Cook

    Kees Cook
     

11 Jun, 2018

3 commits

  • Raw interface initialization needs QDISC_BYPASS. Otherwise
    it sees its own packets when transmitting.

    Fixes: 49da7e64f33e ("High Performance UML Vector Network Driver")
    Cc:
    Signed-off-by: Anton Ivanov
    Signed-off-by: Richard Weinberger

    Anton Ivanov
     
  • UML vector drivers could derefence uninitialized memory
    when cleaning up after a queue allocation failure.

    Fixes: 49da7e64f33e ("High Performance UML Vector Network Driver")
    Cc:
    Reported-by: Dan Capenter
    Signed-off-by: Anton Ivanov
    Signed-off-by: Richard Weinberger

    Anton Ivanov
     
  • __uml_initcall() is not used and .uml.initcall.init section is empty:

    $ grep -r '__uml_initcall('
    arch/um/include/shared/init.h:#define __uml_initcall(fn) \
    $ readelf -s ../umobj/linux | grep __uml_initcall
    23214: 00000000603b75d8 0 NOTYPE GLOBAL DEFAULT 32 __uml_initcall_start
    25337: 00000000603b75d8 0 NOTYPE GLOBAL DEFAULT 32 __uml_initcall_end

    So it is unnecessary.

    Signed-off-by: Alexander Pateenok
    Signed-off-by: Richard Weinberger

    Alexander Pateenok
     

08 Jun, 2018

1 commit

  • Tun, tap, virtio, packet and uml vector all use struct virtio_net_hdr
    to communicate packet metadata to userspace.

    For skbuffs with vlan, the first two return the packet as it may have
    existed on the wire, inserting the VLAN tag in the user buffer. Then
    virtio_net_hdr.csum_start needs to be adjusted by VLAN_HLEN bytes.

    Commit f09e2249c4f5 ("macvtap: restore vlan header on user read")
    added this feature to macvtap. Commit 3ce9b20f1971 ("macvtap: Fix
    csum_start when VLAN tags are present") then fixed up csum_start.

    Virtio, packet and uml do not insert the vlan header in the user
    buffer.

    When introducing virtio_net_hdr_from_skb to deduplicate filling in
    the virtio_net_hdr, the variant from macvtap which adds VLAN_HLEN was
    applied uniformly, breaking csum offset for packets with vlan on
    virtio and packet.

    Make insertion of VLAN_HLEN optional. Convert the callers to pass it
    when needed.

    Fixes: e858fae2b0b8f4 ("virtio_net: use common code for virtio_net_hdr and skb GSO conversion")
    Fixes: 1276f24eeef2 ("packet: use common code for virtio_net_hdr and skb GSO conversion")
    Signed-off-by: Willem de Bruijn
    Signed-off-by: David S. Miller

    Willem de Bruijn
     

07 Jun, 2018

1 commit

  • Pull Kconfig updates from Masahiro Yamada:
    "Kconfig now supports new functionality to perform textual
    substitution. It has been a while since Linus suggested to move
    compiler option tests from makefiles to Kconfig. Finally, here it is.

    The implementation has been generalized into a Make-like macro
    language.

    Some built-in functions such as 'shell' are provided. Variables and
    user-defined functions are also supported so that 'cc-option',
    'ld-option', etc. are implemented as macros.

    Summary:

    - refactor package checks for building {m,n,q,g}conf

    - remove unused/unmaintained localization support

    - remove Kbuild cache

    - drop CONFIG_CROSS_COMPILE support

    - replace 'option env=' with direct variable expansion

    - add built-in functions such as 'shell'

    - support variables and user-defined functions

    - add helper macros as as 'cc-option'

    - add unit tests and a document of the new macro language

    - add 'testconfig' to help

    - fix warnings from GCC 8.1"

    * tag 'kconfig-v4.18' of git://git.kernel.org/pub/scm/linux/kernel/git/masahiroy/linux-kbuild: (30 commits)
    kconfig: Avoid format overflow warning from GCC 8.1
    kbuild: Move last word of nconfig help to the previous line
    kconfig: Add testconfig into make help output
    kconfig: add basic helper macros to scripts/Kconfig.include
    kconfig: show compiler version text in the top comment
    kconfig: test: add Kconfig macro language tests
    Documentation: kconfig: document a new Kconfig macro language
    kconfig: error out if a recursive variable references itself
    kconfig: add 'filename' and 'lineno' built-in variables
    kconfig: add 'info', 'warning-if', and 'error-if' built-in functions
    kconfig: expand lefthand side of assignment statement
    kconfig: support append assignment operator
    kconfig: support simply expanded variable
    kconfig: support user-defined function and recursively expanded variable
    kconfig: begin PARAM state only when seeing a command keyword
    kconfig: replace $(UNAME_RELEASE) with function call
    kconfig: add 'shell' built-in function
    kconfig: add built-in function support
    kconfig: make default prompt of mainmenu less specific
    kconfig: remove sym_expand_string_value()
    ...

    Linus Torvalds
     

05 Jun, 2018

2 commits

  • Pull timers and timekeeping updates from Thomas Gleixner:

    - Core infrastucture work for Y2038 to address the COMPAT interfaces:

    + Add a new Y2038 safe __kernel_timespec and use it in the core
    code

    + Introduce config switches which allow to control the various
    compat mechanisms

    + Use the new config switch in the posix timer code to control the
    32bit compat syscall implementation.

    - Prevent bogus selection of CPU local clocksources which causes an
    endless reselection loop

    - Remove the extra kthread in the clocksource code which has no value
    and just adds another level of indirection

    - The usual bunch of trivial updates, cleanups and fixlets all over the
    place

    - More SPDX conversions

    * 'timers-core-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip: (24 commits)
    clocksource/drivers/mxs_timer: Switch to SPDX identifier
    clocksource/drivers/timer-imx-tpm: Switch to SPDX identifier
    clocksource/drivers/timer-imx-gpt: Switch to SPDX identifier
    clocksource/drivers/timer-imx-gpt: Remove outdated file path
    clocksource/drivers/arc_timer: Add comments about locking while read GFRC
    clocksource/drivers/mips-gic-timer: Add pr_fmt and reword pr_* messages
    clocksource/drivers/sprd: Fix Kconfig dependency
    clocksource: Move inline keyword to the beginning of function declarations
    timer_list: Remove unused function pointer typedef
    timers: Adjust a kernel-doc comment
    tick: Prefer a lower rating device only if it's CPU local device
    clocksource: Remove kthread
    time: Change nanosleep to safe __kernel_* types
    time: Change types to new y2038 safe __kernel_* types
    time: Fix get_timespec64() for y2038 safe compat interfaces
    time: Add new y2038 safe __kernel_timespec
    posix-timers: Make compat syscalls depend on CONFIG_COMPAT_32BIT_TIME
    time: Introduce CONFIG_COMPAT_32BIT_TIME
    time: Introduce CONFIG_64BIT_TIME in architectures
    compat: Enable compat_get/put_timespec64 always
    ...

    Linus Torvalds
     
  • …iederm/user-namespace

    Pull siginfo updates from Eric Biederman:
    "This set of changes close the known issues with setting si_code to an
    invalid value, and with not fully initializing struct siginfo. There
    remains work to do on nds32, arc, unicore32, powerpc, arm, arm64, ia64
    and x86 to get the code that generates siginfo into a simpler and more
    maintainable state. Most of that work involves refactoring the signal
    handling code and thus careful code review.

    Also not included is the work to shrink the in kernel version of
    struct siginfo. That depends on getting the number of places that
    directly manipulate struct siginfo under control, as it requires the
    introduction of struct kernel_siginfo for the in kernel things.

    Overall this set of changes looks like it is making good progress, and
    with a little luck I will be wrapping up the siginfo work next
    development cycle"

    * 'siginfo-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/ebiederm/user-namespace: (46 commits)
    signal/sh: Stop gcc warning about an impossible case in do_divide_error
    signal/mips: Report FPE_FLTUNK for undiagnosed floating point exceptions
    signal/um: More carefully relay signals in relay_signal.
    signal: Extend siginfo_layout with SIL_FAULT_{MCEERR|BNDERR|PKUERR}
    signal: Remove unncessary #ifdef SEGV_PKUERR in 32bit compat code
    signal/signalfd: Add support for SIGSYS
    signal/signalfd: Remove __put_user from signalfd_copyinfo
    signal/xtensa: Use force_sig_fault where appropriate
    signal/xtensa: Consistenly use SIGBUS in do_unaligned_user
    signal/um: Use force_sig_fault where appropriate
    signal/sparc: Use force_sig_fault where appropriate
    signal/sparc: Use send_sig_fault where appropriate
    signal/sh: Use force_sig_fault where appropriate
    signal/s390: Use force_sig_fault where appropriate
    signal/riscv: Replace do_trap_siginfo with force_sig_fault
    signal/riscv: Use force_sig_fault where appropriate
    signal/parisc: Use force_sig_fault where appropriate
    signal/parisc: Use force_sig_mceerr where appropriate
    signal/openrisc: Use force_sig_fault where appropriate
    signal/nios2: Use force_sig_fault where appropriate
    ...

    Linus Torvalds
     

29 May, 2018

1 commit

  • To get access to environment variables, Kconfig needs to define a
    symbol using "option env=" syntax. It is tedious to add a symbol entry
    for each environment variable given that we need to define much more
    such as 'CC', 'AS', 'srctree' etc. to evaluate the compiler capability
    in Kconfig.

    Adding '$' for symbol references is grammatically inconsistent.
    Looking at the code, the symbols prefixed with 'S' are expanded by:
    - conf_expand_value()
    This is used to expand 'arch/$ARCH/defconfig' and 'defconfig_list'
    - sym_expand_string_value()
    This is used to expand strings in 'source' and 'mainmenu'

    All of them are fixed values independent of user configuration. So,
    they can be changed into the direct expansion instead of symbols.

    This change makes the code much cleaner. The bounce symbols 'SRCARCH',
    'ARCH', 'SUBARCH', 'KERNELVERSION' are gone.

    sym_init() hard-coding 'UNAME_RELEASE' is also gone. 'UNAME_RELEASE'
    should be replaced with an environment variable.

    ARCH_DEFCONFIG is a normal symbol, so it should be simply referenced
    without '$' prefix.

    The new syntax is addicted by Make. The variable reference needs
    parentheses, like $(FOO), but you can omit them for single-letter
    variables, like $F. Yet, in Makefiles, people tend to use the
    parenthetical form for consistency / clarification.

    At this moment, only the environment variable is supported, but I will
    extend the concept of 'variable' later on.

    The variables are expanded in the lexer so we can simplify the token
    handling on the parser side.

    For example, the following code works.

    [Example code]

    config MY_TOOLCHAIN_LIST
    string
    default "My tools: CC=$(CC), AS=$(AS), CPP=$(CPP)"

    [Result]

    $ make -s alldefconfig && tail -n 1 .config
    CONFIG_MY_TOOLCHAIN_LIST="My tools: CC=gcc, AS=as, CPP=gcc -E"

    Signed-off-by: Masahiro Yamada
    Reviewed-by: Kees Cook

    Masahiro Yamada
     

16 May, 2018

1 commit


28 Apr, 2018

1 commit

  • There is a bug in relay signal. It assumes that when a signal is
    relayed the signal never uses a signal independent si_code, such
    as SI_USER, SI_KERNEL, SI_QUEUE, ... SI_SIGIO etc. In practice
    siginfo was assuming it was relaying a signal with the SIL_FAULT
    layout. As that is the common cases for the signals it supported
    that is a reasonable assumption.

    Further user mode linux must be very careful when relaying different
    kinds of signals to prevent an information leak. This means simply
    increasing the kinds of signals that are handled in relay_signal
    is non-trivial.

    Therefore use siginfo_layout and force_sig_fault to simplify
    the signal relaying in relay_signal.

    By taking advantage of the fact that user mode linux only works
    on x86 and x86_64 we can assume that si_trapno can be ignored,
    and that si_errno is always zero.

    For the signals SIGLL, SIGFPE, SIGSEGV, SIGBUS, and SIGTRAP the only
    fault handler I know of that sets si_errno is SIGTRAP TRAP_HWBKPT on a
    few oddball architectures. Those architectures have been modified to
    use force_sig_ptrace_errno_trap.

    Similarly only a few architectures set __ARCH_SI_TRAPNO.

    At the point uml supports those architectures again these additional
    cases can be examined and supported if desired in relay_signal.

    Cc: Jeff Dike
    Cc: Richard Weinberger
    Cc: Anton Ivanov
    Cc: Martin Pärtel
    Cc: user-mode-linux-devel@lists.sourceforge.net
    Cc: linux-um@lists.infradead.org
    Fixes: d3c1cfcdb43e ("um: pass siginfo to guest process")
    Signed-off-by: "Eric W. Biederman"

    Eric W. Biederman
     

25 Apr, 2018

2 commits

  • Filling in struct siginfo before calling force_sig_info a tedious and
    error prone process, where once in a great while the wrong fields
    are filled out, and siginfo has been inconsistently cleared.

    Simplify this process by using the helper force_sig_fault. Which
    takes as a parameters all of the information it needs, ensures
    all of the fiddly bits of filling in struct siginfo are done properly
    and then calls force_sig_info.

    In short about a 5 line reduction in code for every time force_sig_info
    is called, which makes the calling function clearer.

    Cc: Jeff Dike
    Cc: Richard Weinberger
    Cc: user-mode-linux-devel@lists.sourceforge.net
    Cc: linux-um@lists.infradead.org
    Signed-off-by: "Eric W. Biederman"

    Eric W. Biederman
     
  • Call clear_siginfo to ensure every stack allocated siginfo is properly
    initialized before being passed to the signal sending functions.

    Note: It is not safe to depend on C initializers to initialize struct
    siginfo on the stack because C is allowed to skip holes when
    initializing a structure.

    The initialization of struct siginfo in tracehook_report_syscall_exit
    was moved from the helper user_single_step_siginfo into
    tracehook_report_syscall_exit itself, to make it clear that the local
    variable siginfo gets fully initialized.

    In a few cases the scope of struct siginfo has been reduced to make it
    clear that siginfo siginfo is not used on other paths in the function
    in which it is declared.

    Instances of using memset to initialize siginfo have been replaced
    with calls clear_siginfo for clarity.

    Signed-off-by: "Eric W. Biederman"

    Eric W. Biederman
     

19 Apr, 2018

1 commit

  • We have a couple of files that try to include asm/compat.h on
    architectures where this is available. Those should generally use the
    higher-level linux/compat.h file, but that in turn fails to include
    asm/compat.h when CONFIG_COMPAT is disabled, unless we can provide
    that header on all architectures.

    This adds the asm/compat.h for all remaining architectures to
    simplify the dependencies.

    Architectures that are getting removed in linux-4.17 are not changed
    here, to avoid needless conflicts with the removal patches. Those
    architectures are broken by this patch, but we have already shown
    that they have no users.

    Signed-off-by: Arnd Bergmann

    Arnd Bergmann
     

12 Apr, 2018

1 commit

  • Pull UML updates from Richard Weinberger:

    - a new and faster epoll based IRQ controller and NIC driver

    - misc fixes and janitorial updates

    * git://git.kernel.org/pub/scm/linux/kernel/git/rw/uml:
    Fix vector raw inintialization logic
    Migrate vector timers to new timer API
    um: Compile with modern headers
    um: vector: Fix an error handling path in 'vector_parse()'
    um: vector: Fix a memory allocation check
    um: vector: fix missing unlock on error in vector_net_open()
    um: Add missing EXPORT for free_irq_by_fd()
    High Performance UML Vector Network Driver
    Epoll based IRQ controller
    um: Use POSIX ucontext_t instead of struct ucontext
    um: time: Use timespec64 for persistent clock
    um: Restore symbol versions for __memcpy and memcpy

    Linus Torvalds
     

03 Apr, 2018

1 commit

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

    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: Andrew Morton
    Cc: linux-mm@kvack.org
    Signed-off-by: Dominik Brodowski

    Dominik Brodowski
     

30 Mar, 2018

3 commits

  • Vector RAW in UML needs to BPF filter its own MAC only
    if QDISC_BYPASS has failed. If QDISC_BYPASS is successful, the
    frames originated locally are not visible to readers on the
    raw socket.

    Signed-off-by: Anton Ivanov
    Signed-off-by: Richard Weinberger

    Anton Ivanov
     
  • The patches for the UML vector drivers were in-flight when
    the timer changes happened and were not covered by them.

    This change migrates vector_kern.c to use the new timer API.

    Signed-off-by: Anton Ivanov
    Signed-off-by: Richard Weinberger

    Anton Ivanov
     
  • Recent libcs have gotten a bit more strict, so we actually need to
    include the right headers and use the right types. This enables UML to
    compile again.

    Signed-off-by: Jason A. Donenfeld
    Cc: stable@vger.kernel.org
    Signed-off-by: Richard Weinberger

    Jason A. Donenfeld
     

20 Feb, 2018

3 commits

  • If 'find_device()' finds something, we set '*error_out' and we should
    return an error. However, 'err' is known to be 0 at this point.

    Explicitly return -EINVAL instead.

    While at it, remove the initialization of 'err' at the beginning of the
    function and also explicitly return an error code if the first check
    fails.

    Fixes: ad1f62ab2bd4 ("High Performance UML Vector Network Driver")
    Signed-off-by: Christophe JAILLET
    Signed-off-by: Richard Weinberger

    Christophe JAILLET
     
  • Checking the result of the previous 'kstrdup()' call is expected here, so
    we should test 'params' and not 'str' (which is known to be non-NULL at
    this point)

    Fixes: ad1f62ab2bd4 ("High Performance UML Vector Network Driver")
    Signed-off-by: Christophe JAILLET
    Signed-off-by: Richard Weinberger

    Christophe JAILLET
     
  • Add the missing unlock before return from function vector_net_open()
    in the error handling case.

    Fixes: ad1f62ab2bd4 ("High Performance UML Vector Network Driver")
    Signed-off-by: Wei Yongjun
    Signed-off-by: Richard Weinberger

    Wei Yongjun