01 Feb, 2020

1 commit

  • commit 87c9366e17259040a9118e06b6dc8de986e5d3d1 upstream.

    This reverts commit 786b2384bf1c ("um: Enable CONFIG_CONSTRUCTORS").

    There are two issues with this commit, uncovered by Anton in tests
    on some (Debian) systems:

    1) I completely forgot to call any constructors if CONFIG_CONSTRUCTORS
    isn't set. Don't recall now if it just wasn't needed on my system, or
    if I never tested this case.

    2) With that fixed, it works - with CONFIG_CONSTRUCTORS *unset*. If I
    set CONFIG_CONSTRUCTORS, it fails again, which isn't totally
    unexpected since whatever wanted to run is likely to have to run
    before the kernel init etc. that calls the constructors in this case.

    Basically, some constructors that gcc emits (libc has?) need to run
    very early during init; the failure mode otherwise was that the ptrace
    fork test already failed:

    ----------------------
    $ ./linux mem=512M
    Core dump limits :
    soft - 0
    hard - NONE
    Checking that ptrace can change system call numbers...check_ptrace : child exited with exitcode 6, while expecting 0; status 0x67f
    Aborted
    ----------------------

    Thinking more about this, it's clear that we simply cannot support
    CONFIG_CONSTRUCTORS in UML. All the cases we need now (gcov, kasan)
    involve not use of the __attribute__((constructor)), but instead
    some constructor code/entry generated by gcc. Therefore, we cannot
    distinguish between kernel constructors and system constructors.

    Thus, revert this commit.

    Cc: stable@vger.kernel.org [5.4+]
    Fixes: 786b2384bf1c ("um: Enable CONFIG_CONSTRUCTORS")
    Reported-by: Anton Ivanov
    Signed-off-by: Johannes Berg
    Acked-by: Anton Ivanov
    Signed-off-by: Greg Kroah-Hartman

    Signed-off-by: Richard Weinberger

    Johannes Berg
     

23 Jan, 2020

2 commits

  • commit bf9f80cf0ccab5f346f7d3cdc445da8fcfe6ce34 upstream.

    This driver *can* be a module, but then its parameters (socket path)
    are untrusted data from inside the VM, and that isn't allowed. Allow
    the code to only be built-in to avoid that.

    Fixes: 5d38f324993f ("um: drivers: Add virtio vhost-user driver")
    Signed-off-by: Johannes Berg
    Acked-by: Anton Ivanov
    Signed-off-by: Richard Weinberger
    Signed-off-by: Greg Kroah-Hartman

    Johannes Berg
     
  • commit 5c1f33e2a03c0b8710b5d910a46f1e1fb0607679 upstream.

    In the main() code, we eventually enable signals just before
    exec() or exit(), in order to to not have signals pending and
    delivered *after* the exec().

    I've observed SIGSEGV loops at this point, and the reason seems
    to be the irqflags tracing; this makes sense as the kernel is
    no longer really functional at this point. Since there's really
    no reason to use unblock_signals_trace() here (I had just done
    a global search & replace), use the plain unblock_signals() in
    this case to avoid going into the no longer functional kernel.

    Fixes: 0dafcbe128d2 ("um: Implement TRACE_IRQFLAGS_SUPPORT")
    Signed-off-by: Johannes Berg
    Signed-off-by: Richard Weinberger
    Signed-off-by: Greg Kroah-Hartman

    Johannes Berg
     

15 Jan, 2020

1 commit

  • commit 457677c70c7672a4586b0b8abc396cc1ecdd376d upstream.

    This is required for clone3 which passes the TLS value through a
    struct rather than a register.

    Signed-off-by: Amanieu d'Antras
    Cc: linux-um@lists.infradead.org
    Cc: # 5.3.x
    Link: https://lore.kernel.org/r/20200104123928.1048822-1-amanieu@gmail.com
    Signed-off-by: Christian Brauner
    Signed-off-by: Greg Kroah-Hartman

    Amanieu d'Antras
     

05 Jan, 2020

1 commit

  • [ Upstream commit 7e60746005573a06149cdee7acedf428906f3a59 ]

    When we get an interrupt from the socket getting readable,
    and start reading, there's a possibility for a race. This
    depends on the implementation of the device, but e.g. with
    qemu's libvhost-user, we can see:

    device virtio_uml
    ---------------------------------------
    write header
    get interrupt
    read header
    read body -> returns -EAGAIN
    write body

    The -EAGAIN return is because the socket is non-blocking,
    and then this leads us to abandon this message.

    In fact, we've already read the header, so when the get
    another signal/interrupt for the body, we again read it
    as though it's a new message header, and also abandon it
    for the same reason (wrong size etc.)

    This essentially breaks things, and if that message was
    one that required a response, it leads to a deadlock as
    the device is waiting for the response but we'll never
    reply.

    Fix this by spinning on -EAGAIN as well when we read the
    message body. We need to handle -EAGAIN as "no message"
    while reading the header, since we share an interrupt.

    Note that this situation is highly unlikely to occur in
    normal usage, since there will be very few messages and
    only in the startup phase. With the inband call feature
    this does tend to happen (eventually) though.

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

    Johannes Berg
     

30 Oct, 2019

1 commit

  • Fixes crashes due to ubd requeue logic conflicting with the block-mq
    logic. Crash is reproducible in 5.0 - 5.3.

    Fixes: 53766defb8c8 ("um: Clean-up command processing in UML UBD driver")
    Cc: stable@vger.kernel.org # v5.0+
    Signed-off-by: Anton Ivanov
    Signed-off-by: Jens Axboe

    Anton Ivanov
     

27 Sep, 2019

1 commit

  • The naming of pgtable_page_{ctor,dtor}() seems to have confused a few
    people, and until recently arm64 used these erroneously/pointlessly for
    other levels of page table.

    To make it incredibly clear that these only apply to the PTE level, and to
    align with the naming of pgtable_pmd_page_{ctor,dtor}(), let's rename them
    to pgtable_pte_page_{ctor,dtor}().

    These changes were generated with the following shell script:

    ----
    git grep -lw 'pgtable_page_.tor' | while read FILE; do
    sed -i '{s/pgtable_page_ctor/pgtable_pte_page_ctor/}' $FILE;
    sed -i '{s/pgtable_page_dtor/pgtable_pte_page_dtor/}' $FILE;
    done
    ----

    ... with the documentation re-flowed to remain under 80 columns, and
    whitespace fixed up in macros to keep backslashes aligned.

    There should be no functional change as a result of this patch.

    Link: http://lkml.kernel.org/r/20190722141133.3116-1-mark.rutland@arm.com
    Signed-off-by: Mark Rutland
    Reviewed-by: Mike Rapoport
    Acked-by: Geert Uytterhoeven [m68k]
    Cc: Anshuman Khandual
    Cc: Matthew Wilcox
    Cc: Michal Hocko
    Cc: Yu Zhao
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Mark Rutland
     

25 Sep, 2019

2 commits

  • Both pgtable_cache_init() and pgd_cache_init() are used to initialize kmem
    cache for page table allocations on several architectures that do not use
    PAGE_SIZE tables for one or more levels of the page table hierarchy.

    Most architectures do not implement these functions and use __weak default
    NOP implementation of pgd_cache_init(). Since there is no such default
    for pgtable_cache_init(), its empty stub is duplicated among most
    architectures.

    Rename the definitions of pgd_cache_init() to pgtable_cache_init() and
    drop empty stubs of pgtable_cache_init().

    Link: http://lkml.kernel.org/r/1566457046-22637-1-git-send-email-rppt@linux.ibm.com
    Signed-off-by: Mike Rapoport
    Acked-by: Will Deacon [arm64]
    Acked-by: Thomas Gleixner [x86]
    Cc: Catalin Marinas
    Cc: Ingo Molnar
    Cc: Borislav Petkov
    Cc: Matthew Wilcox
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Mike Rapoport
     
  • Patch series "mm: remove quicklist page table caches".

    A while ago Nicholas proposed to remove quicklist page table caches [1].

    I've rebased his patch on the curren upstream and switched ia64 and sh to
    use generic versions of PTE allocation.

    [1] https://lore.kernel.org/linux-mm/20190711030339.20892-1-npiggin@gmail.com

    This patch (of 3):

    Remove page table allocator "quicklists". These have been around for a
    long time, but have not got much traction in the last decade and are only
    used on ia64 and sh architectures.

    The numbers in the initial commit look interesting but probably don't
    apply anymore. If anybody wants to resurrect this it's in the git
    history, but it's unhelpful to have this code and divergent allocator
    behaviour for minor archs.

    Also it might be better to instead make more general improvements to page
    allocator if this is still so slow.

    Link: http://lkml.kernel.org/r/1565250728-21721-2-git-send-email-rppt@linux.ibm.com
    Signed-off-by: Nicholas Piggin
    Signed-off-by: Mike Rapoport
    Cc: Tony Luck
    Cc: Yoshinori Sato
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Nicholas Piggin
     

22 Sep, 2019

1 commit

  • Pull UML updates from Richard Weinberger:

    - virtio support

    - fixes for our new time travel mode

    - various improvements to make lockdep and kasan work better

    - SPDX header updates

    * tag 'for-linus-5.4-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/rw/uml: (25 commits)
    um: irq: Fix LAST_IRQ usage in init_IRQ()
    um: Add SPDX headers for files in arch/um/include
    um: Add SPDX headers for files in arch/um/os-Linux
    um: Add SPDX headers to files in arch/um/kernel/
    um: Add SPDX headers for files in arch/um/drivers
    um: virtio: Implement VHOST_USER_PROTOCOL_F_REPLY_ACK
    um: virtio: Implement VHOST_USER_PROTOCOL_F_SLAVE_REQ
    um: drivers: Add virtio vhost-user driver
    um: Use real DMA barriers
    um: Don't use generic barrier.h
    um: time-travel: Restrict time update in IRQ handler
    um: time-travel: Fix periodic timers
    um: Enable CONFIG_CONSTRUCTORS
    um: Place (soft)irq text with macros
    um: Fix VDSO compiler warning
    um: Implement TRACE_IRQFLAGS_SUPPORT
    um: Remove misleading #define ARCh_IRQ_ENABLED
    um: Avoid using uninitialized regs
    um: Remove sig_info[SIGALRM]
    um: Error handling fixes in vector drivers
    ...

    Linus Torvalds
     

20 Sep, 2019

1 commit

  • Pull Kbuild updates from Masahiro Yamada:

    - add modpost warn exported symbols marked as 'static' because 'static'
    and EXPORT_SYMBOL is an odd combination

    - break the build early if gold linker is used

    - optimize the Bison rule to produce .c and .h files by a single
    pattern rule

    - handle PREEMPT_RT in the module vermagic and UTS_VERSION

    - warn CONFIG options leaked to the user-space except existing ones

    - make single targets work properly

    - rebuild modules when module linker scripts are updated

    - split the module final link stage into scripts/Makefile.modfinal

    - fix the missed error code in merge_config.sh

    - improve the error message displayed on the attempt of the O= build in
    unclean source tree

    - remove 'clean-dirs' syntax

    - disable -Wimplicit-fallthrough warning for Clang

    - add CONFIG_CC_OPTIMIZE_FOR_SIZE_O3 for ARC

    - remove ARCH_{CPP,A,C}FLAGS variables

    - add $(BASH) to run bash scripts

    - change *CFLAGS_.o to take the relative path to $(obj)
    instead of the basename

    - stop suppressing Clang's -Wunused-function warnings when W=1

    - fix linux/export.h to avoid genksyms calculating CRC of trimmed
    exported symbols

    - misc cleanups

    * tag 'kbuild-v5.4' of git://git.kernel.org/pub/scm/linux/kernel/git/masahiroy/linux-kbuild: (63 commits)
    genksyms: convert to SPDX License Identifier for lex.l and parse.y
    modpost: use __section in the output to *.mod.c
    modpost: use MODULE_INFO() for __module_depends
    export.h, genksyms: do not make genksyms calculate CRC of trimmed symbols
    export.h: remove defined(__KERNEL__), which is no longer needed
    kbuild: allow Clang to find unused static inline functions for W=1 build
    kbuild: rename KBUILD_ENABLE_EXTRA_GCC_CHECKS to KBUILD_EXTRA_WARN
    kbuild: refactor scripts/Makefile.extrawarn
    merge_config.sh: ignore unwanted grep errors
    kbuild: change *FLAGS_.o to take the path relative to $(obj)
    modpost: add NOFAIL to strndup
    modpost: add guid_t type definition
    kbuild: add $(BASH) to run scripts with bash-extension
    kbuild: remove ARCH_{CPP,A,C}FLAGS
    kbuild,arc: add CONFIG_CC_OPTIMIZE_FOR_PERFORMANCE_O3 for ARC
    kbuild: Do not enable -Wimplicit-fallthrough for clang for now
    kbuild: clean up subdir-ymn calculation in Makefile.clean
    kbuild: remove unneeded '+' marker from cmd_clean
    kbuild: remove clean-dirs syntax
    kbuild: check clean srctree even earlier
    ...

    Linus Torvalds
     

16 Sep, 2019

23 commits


23 Aug, 2019

1 commit

  • Unfortunately, my build fix for when time travel mode isn't
    enabled broke time travel mode, because I forgot that we need
    to use the timer time after the timer has been marked disabled,
    and thus need to leave the time stored instead of zeroing it.

    Fix that by splitting the inline into two, so we can call only
    the _mode() one in the relevant code path.

    Fixes: b482e48d29f1 ("um: fix build without CONFIG_UML_TIME_TRAVEL_SUPPORT")
    Signed-off-by: Johannes Berg
    Signed-off-by: Richard Weinberger

    Johannes Berg
     

22 Aug, 2019

1 commit

  • Add CONFIG_ASM_MODVERSIONS. This allows to remove one if-conditional
    nesting in scripts/Makefile.build.

    scripts/Makefile.build is run every time Kbuild descends into a
    sub-directory. So, I want to avoid $(wildcard ...) evaluation
    where possible although computing $(wildcard ...) is so cheap that
    it may not make measurable performance difference.

    Signed-off-by: Masahiro Yamada
    Acked-by: Geert Uytterhoeven

    Masahiro Yamada
     

15 Jul, 2019

1 commit

  • Pull UML updates from Richard Weinberger:

    - A new timer mode, time travel, for testing with UML

    - Many bugixes/improvements for the serial line driver

    - Various bugfixes

    * tag 'for-linus-5.3-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/rw/uml:
    um: fix build without CONFIG_UML_TIME_TRAVEL_SUPPORT
    um: Fix kcov crash during startup
    um: configs: Remove useless UEVENT_HELPER_PATH
    um: Support time travel mode
    um: Pass nsecs to os timer functions
    um: Remove drivers/ssl.h
    um: Don't garbage collect in deactivate_all_fds()
    um: Silence lockdep complaint about mmap_sem
    um: Remove locking in deactivate_all_fds()
    um: Timer code cleanup
    um: fix os_timer_one_shot()
    um: Fix IRQ controller regression on console read

    Linus Torvalds
     

13 Jul, 2019

2 commits

  • Pull Kbuild updates from Masahiro Yamada:

    - remove headers_{install,check}_all targets

    - remove unreasonable 'depends on !UML' from CONFIG_SAMPLES

    - re-implement 'make headers_install' more cleanly

    - add new header-test-y syntax to compile-test headers

    - compile-test exported headers to ensure they are compilable in
    user-space

    - compile-test headers under include/ to ensure they are self-contained

    - remove -Waggregate-return, -Wno-uninitialized, -Wno-unused-value
    flags

    - add -Werror=unknown-warning-option for Clang

    - add 128-bit built-in types support to genksyms

    - fix missed rebuild of modules.builtin

    - propagate 'No space left on device' error in fixdep to Make

    - allow Clang to use its integrated assembler

    - improve some coccinelle scripts

    - add a new flag KBUILD_ABS_SRCTREE to request Kbuild to use absolute
    path for $(srctree).

    - do not ignore errors when compression utility is missing

    - misc cleanups

    * tag 'kbuild-v5.3' of git://git.kernel.org/pub/scm/linux/kernel/git/masahiroy/linux-kbuild: (49 commits)
    kbuild: use -- separater intead of $(filter-out ...) for cc-cross-prefix
    kbuild: Inform user to pass ARCH= for make mrproper
    kbuild: fix compression errors getting ignored
    kbuild: add a flag to force absolute path for srctree
    kbuild: replace KBUILD_SRCTREE with boolean building_out_of_srctree
    kbuild: remove src and obj from the top Makefile
    scripts/tags.sh: remove unused environment variables from comments
    scripts/tags.sh: drop SUBARCH support for ARM
    kbuild: compile-test kernel headers to ensure they are self-contained
    kheaders: include only headers into kheaders_data.tar.xz
    kheaders: remove meaningless -R option of 'ls'
    kbuild: support header-test-pattern-y
    kbuild: do not create wrappers for header-test-y
    kbuild: compile-test exported headers to ensure they are self-contained
    init/Kconfig: add CONFIG_CC_CAN_LINK
    kallsyms: exclude kasan local symbols on s390
    kbuild: add more hints about SUBDIRS replacement
    coccinelle: api/stream_open: treat all wait_.*() calls as blocking
    coccinelle: put_device: Add a cast to an expression for an assignment
    coccinelle: put_device: Adjust a message construction
    ...

    Linus Torvalds
     
  • um allocates PTE pages with __get_free_page() and uses
    GFP_KERNEL | __GFP_ZERO for the allocations.

    Switch it to the generic version that does exactly the same thing for the
    kernel page tables and adds __GFP_ACCOUNT for the user PTEs.

    The pte_free() and pte_free_kernel() versions are identical to the generic
    ones and can be simply dropped.

    Link: http://lkml.kernel.org/r/1557296232-15361-14-git-send-email-rppt@linux.ibm.com
    Signed-off-by: Mike Rapoport
    Reviewed-by: Anton Ivanov
    Acked-by: Anton Ivanov
    Cc: Albert Ou
    Cc: Anshuman Khandual
    Cc: Arnd Bergmann
    Cc: Catalin Marinas
    Cc: Geert Uytterhoeven
    Cc: Greentime Hu
    Cc: Guan Xuetao
    Cc: Guo Ren
    Cc: Guo Ren
    Cc: Helge Deller
    Cc: Ley Foon Tan
    Cc: Matthew Wilcox
    Cc: Matt Turner
    Cc: Michael Ellerman
    Cc: Michal Hocko
    Cc: Palmer Dabbelt
    Cc: Paul Burton
    Cc: Ralf Baechle
    Cc: Richard Kuo
    Cc: Richard Weinberger
    Cc: Russell King
    Cc: Sam Creasey
    Cc: Vincent Chen
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Mike Rapoport
     

10 Jul, 2019

1 commit