30 Dec, 2020

2 commits

  • commit 97be7ceaf7fea68104824b6aa874cff235333ac1 upstream.

    asprintf is not compatible with the existing uml memory allocation
    mechanism. Its use on the "user" side of UML results in a corrupt slab
    state.

    Fixes: 0d4e5ac7e780 ("um: remove uses of variable length arrays")
    Cc: stable@vger.kernel.org
    Signed-off-by: Anton Ivanov
    Signed-off-by: Richard Weinberger
    Signed-off-by: Greg Kroah-Hartman

    Anton Ivanov
     
  • [ Upstream commit e3a01cbee9c5f2c6fc813dd6af007716e60257e7 ]

    Ensure that file closes, connection closes, etc are propagated
    as interrupts in the interrupt controller.

    Fixes: ff6a17989c08 ("Epoll based IRQ controller")
    Signed-off-by: Anton Ivanov
    Signed-off-by: Richard Weinberger
    Signed-off-by: Sasha Levin

    Anton Ivanov
     

12 Oct, 2020

2 commits


03 Jun, 2020

2 commits

  • We do not need to update the metadata (atime, mtime, etc)
    on the UBD file and/or the COW file until UML exits.

    UBD image mtime is checked in UML only when opening
    the files. After that they are locked and used
    exclusively by a single UML instance, so there is
    no point wasting resources on updating metadata on
    every sync. We can sync data only. The host will
    always update mtime if a file has been modified upon
    closing it.

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

    Anton Ivanov
     
  • These two functions are otherwise unknown to the pedantic compiler.
    Include the correct header to enable the build to succeed.

    Signed-off-by: Zach van Rijn
    Acked-By: Anton Ivanov
    Signed-off-by: Richard Weinberger

    Zach van Rijn
     

30 Mar, 2020

4 commits

  • This implements synchronized time-travel mode which - using a special
    application on a unix socket - lets multiple machines take part in a
    time-travelling simulation together.

    The protocol for the unix domain socket is defined in the new file
    include/uapi/linux/um_timetravel.h.

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

    Johannes Berg
     
  • This file isn't really shared, it's only used on the kernel side,
    not on the user side. Remove the include from the user-side and
    move the file to a better place.

    While at it, rename it to time-internal.h, it's not really just
    timers but all kinds of things related to timekeeping.

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

    Johannes Berg
     
  • When building UML with glibc 2.17 installed, compilation
    of arch/um/os-Linux/file.c fails due to failure to find
    FALLOC_FL_PUNCH_HOLE and FALLOC_FL_KEEP_SIZE definitions.

    It appears that /usr/include/bits/fcntl-linux.h (indirectly
    included by /usr/include/fcntl.h) does not include falloc.h
    with an older glibc, whereas a more up-to-date version
    does.

    Adding the direct include to file.c resolves the issue
    and does not cause problems for more recent glibc.

    Fixes: 50109b5a03b4 ("um: Add support for DISCARD in the UBD Driver")
    Cc: Brendan Higgins
    Signed-off-by: Alan Maguire
    Reviewed-by: Brendan Higgins
    Acked-By: Anton Ivanov
    Signed-off-by: Richard Weinberger

    Alan Maguire
     
  • sizeof gives us the size of the pointer variable, not of the
    area it points to. So the number of bytes copied by umid_file_name()
    is 8.
    We should pass in the correct length of the file buffer.

    Signed-off-by: Wen Yang
    Signed-off-by: Richard Weinberger

    Wen Yang
     

19 Dec, 2019

1 commit

  • The ubd code suffers from a possible y2038 overflow on 32-bit
    architectures, both for the cow header and the os_file_modtime()
    function.

    Replace time_t with time64_t to extend the ubd_kern side as much
    as possible.

    Whether this makes a difference for the user side depends on
    the host libc implementation that may use either 32-bit or 64-bit
    time_t.

    For the cow file format, the header contains an unsigned 32-bit
    timestamp, which is good until y2106, passing this through a
    'long long' gives us a consistent interpretation between 32-bit
    and 64-bit um kernels.

    Signed-off-by: Arnd Bergmann

    Arnd Bergmann
     

26 Nov, 2019

1 commit

  • 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

    Johannes Berg
     

16 Sep, 2019

5 commits

  • Convert files to use SPDX header. All files are licensed under the GPLv2.

    Signed-off-by: Alex Dewar
    Signed-off-by: Richard Weinberger

    Alex Dewar
     
  • This module allows virtio devices to be used over a vhost-user socket.

    Signed-off-by: Erel Geron
    Signed-off-by: Johannes Berg
    Signed-off-by: Richard Weinberger

    Erel Geron
     
  • UML enables TRACE_IRQFLAGS_SUPPORT but doesn't actually implement
    it. It seems to have been added for lockdep support, but that can't
    actually really work well without IRQ flags tracing, as is also
    very noisily reported when enabling CONFIG_DEBUG_LOCKDEP.

    Implement it now.

    Fixes: 711553efa5b8 ("[PATCH] uml: declare in Kconfig our partial LOCKDEP support")
    Signed-off-by: Johannes Berg
    Signed-off-by: Richard Weinberger

    Johannes Berg
     
  • In timer_real_alarm_handler(), regs is only initialized if
    the context argument is non-NULL, also initialize in the
    other case.

    Signed-off-by: Johannes Berg
    Acked-by: Anton Ivanov
    Signed-off-by: Richard Weinberger

    Johannes Berg
     
  • This entry is misleading, the actual signal handler is
    another one that never uses sig_info.

    Also remove the SIGALRM if inside sig_handler() for the
    same reason.

    Signed-off-by: Johannes Berg
    Acked-by: Anton Ivanov
    Signed-off-by: Richard Weinberger

    Johannes Berg
     

03 Jul, 2019

3 commits


08 May, 2019

2 commits

  • While the affected code is run in user-mode, the build still warns
    about it. Convert all uses of VLA to dynamic allocations.

    Signed-off-by: Bartosz Golaszewski
    Signed-off-by: Richard Weinberger

    Bartosz Golaszewski
     
  • Reverts commit b6024b21fec8367ef961a771cc9dde31f1831965 and
    adjusts default stack sizing to cope with larger size of
    floating point save registers on the newer Intel CPUs.

    b6024b21fec8367ef961a771cc9dde31f1831965 replaced storing the
    register state on the stack with kmalloc-ed storage. That has
    a number of issues and a panic if that fails.
    1. kmalloc/ATOMIC can fail. There was a latent hard crash
    in all interrupt and fault handling as a result.
    2. kmalloc in the interrupt path introduces a considerable
    performance penalty for networking ~ 14% on iperf.

    This commit restores uml to a stable state until a better
    solution is found.

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

    Anton Ivanov
     

28 Dec, 2018

1 commit

  • Support for DISCARD and WRITE_ZEROES in the ubd driver using
    fallocate.

    DISCARD is enabled by default and can be disabled using a new
    UBD command line flag.

    If the underlying fs on which the UBD image is stored does not
    support DISCARD the support for both DISCARD and WRITE_ZEROES
    is turned off.

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

    Anton Ivanov
     

30 Oct, 2018

2 commits


11 Jun, 2018

1 commit

  • __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
     

30 Mar, 2018

1 commit

  • 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

2 commits

  • 1. Removes the need to walk the IRQ/Device list to determine
    who triggered the IRQ.
    2. Improves scalability (up to several times performance
    improvement for cases with 10s of devices).
    3. Improves UML baseline IO performance for one disk + one NIC
    use case by up to 10%.
    4. Introduces write poll triggered IRQs.
    5. Prerequisite for introducing high performance mmesg family
    of functions in network IO.
    6. Fixes RNG shutdown which was leaking a file descriptor

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

    Anton Ivanov
     
  • glibc 2.26 removed the 'struct ucontext' to "improve" POSIX compliance
    and break programs, including User Mode Linux. Fix User Mode Linux
    by using POSIX ucontext_t.

    This fixes:

    arch/um/os-Linux/signal.c: In function 'hard_handler':
    arch/um/os-Linux/signal.c:163:22: error: dereferencing pointer to incomplete type 'struct ucontext'
    mcontext_t *mc = &uc->uc_mcontext;
    arch/x86/um/stub_segv.c: In function 'stub_segv_handler':
    arch/x86/um/stub_segv.c:16:13: error: dereferencing pointer to incomplete type 'struct ucontext'
    &uc->uc_mcontext);

    Cc: stable@vger.kernel.org
    Signed-off-by: Krzysztof Mazur
    Signed-off-by: Richard Weinberger

    Krzysztof Mazur
     

02 Nov, 2017

1 commit

  • Many source files in the tree are missing licensing information, which
    makes it harder for compliance tools to determine the correct license.

    By default all files without license information are under the default
    license of the kernel, which is GPL version 2.

    Update the files which contain no license information with the 'GPL-2.0'
    SPDX license identifier. The SPDX identifier is a legally binding
    shorthand, which can be used instead of the full boiler plate text.

    This patch is based on work done by Thomas Gleixner and Kate Stewart and
    Philippe Ombredanne.

    How this work was done:

    Patches were generated and checked against linux-4.14-rc6 for a subset of
    the use cases:
    - file had no licensing information it it.
    - file was a */uapi/* one with no licensing information in it,
    - file was a */uapi/* one with existing licensing information,

    Further patches will be generated in subsequent months to fix up cases
    where non-standard license headers were used, and references to license
    had to be inferred by heuristics based on keywords.

    The analysis to determine which SPDX License Identifier to be applied to
    a file was done in a spreadsheet of side by side results from of the
    output of two independent scanners (ScanCode & Windriver) producing SPDX
    tag:value files created by Philippe Ombredanne. Philippe prepared the
    base worksheet, and did an initial spot review of a few 1000 files.

    The 4.13 kernel was the starting point of the analysis with 60,537 files
    assessed. Kate Stewart did a file by file comparison of the scanner
    results in the spreadsheet to determine which SPDX license identifier(s)
    to be applied to the file. She confirmed any determination that was not
    immediately clear with lawyers working with the Linux Foundation.

    Criteria used to select files for SPDX license identifier tagging was:
    - Files considered eligible had to be source code files.
    - Make and config files were included as candidates if they contained >5
    lines of source
    - File already had some variant of a license header in it (even if
    Reviewed-by: Philippe Ombredanne
    Reviewed-by: Thomas Gleixner
    Signed-off-by: Greg Kroah-Hartman

    Greg Kroah-Hartman
     

14 Sep, 2017

3 commits


07 Jul, 2017

2 commits


06 Jul, 2017

5 commits