09 Dec, 2015

3 commits

  • When using va_list ensure that va_start will be followed by va_end.

    Signed-off-by: Geyslan G. Bem
    Signed-off-by: Richard Weinberger

    Geyslan G. Bem
     
  • On gcc Ubuntu 4.8.4-2ubuntu1~14.04, linking vmlinux fails with:

    arch/um/os-Linux/built-in.o: In function `os_timer_create':
    /android/kernel/android/arch/um/os-Linux/time.c:51: undefined reference to `timer_create'
    arch/um/os-Linux/built-in.o: In function `os_timer_set_interval':
    /android/kernel/android/arch/um/os-Linux/time.c:84: undefined reference to `timer_settime'
    arch/um/os-Linux/built-in.o: In function `os_timer_remain':
    /android/kernel/android/arch/um/os-Linux/time.c:109: undefined reference to `timer_gettime'
    arch/um/os-Linux/built-in.o: In function `os_timer_one_shot':
    /android/kernel/android/arch/um/os-Linux/time.c:132: undefined reference to `timer_settime'
    arch/um/os-Linux/built-in.o: In function `os_timer_disable':
    /android/kernel/android/arch/um/os-Linux/time.c:145: undefined reference to `timer_settime'

    This is because -lrt appears in the generated link commandline
    after arch/um/os-Linux/built-in.o. Fix this by removing -lrt from
    arch/um/Makefile and adding it to the UM-specific section of
    scripts/link-vmlinux.sh.

    Signed-off-by: Lorenzo Colitti
    Signed-off-by: Richard Weinberger

    Lorenzo Colitti
     
  • If get_signal() returns us a signal to post
    we must not call it again, otherwise the already
    posted signal will be overridden.
    Before commit a610d6e672d this was the case as we stopped
    the while after a successful handle_signal().

    Cc: # 3.10-
    Fixes: a610d6e672d ("pull clearing RESTORE_SIGMASK into block_sigmask()")
    Signed-off-by: Richard Weinberger

    Richard Weinberger
     

07 Nov, 2015

6 commits

  • UML is using an obsolete itimer call for
    all timers and "polls" for kernel space timer firing
    in its userspace portion resulting in a long list
    of bugs and incorrect behaviour(s). It also uses
    ITIMER_VIRTUAL for its timer which results in the
    timer being dependent on it running and the cpu
    load.

    This patch fixes this by moving to posix high resolution
    timers firing off CLOCK_MONOTONIC and relaying the timer
    correctly to the UML userspace.

    Fixes:
    - crashes when hosts suspends/resumes
    - broken userspace timers - effecive ~40Hz instead
    of what they should be. Note - this modifies skas behavior
    by no longer setting an itimer per clone(). Timer events
    are relayed instead.
    - kernel network packet scheduling disciplines
    - tcp behaviour especially under load
    - various timer related corner cases

    Finally, overall responsiveness of userspace is better.

    Signed-off-by: Thomas Meyer
    Signed-off-by: Anton Ivanov
    [rw: massaged commit message]
    Signed-off-by: Richard Weinberger

    Anton Ivanov
     
  • since GFP_KERNEL with GFP_ATOMIC while spinlock is held,
    as code while holding a spinlock should be atomic.
    GFP_KERNEL may sleep and can cause deadlock,
    where as GFP_ATOMIC may fail but certainly avoids deadlockdex f70dd54..d898f6c 100644

    Signed-off-by: Saurabh Sengar
    Signed-off-by: Richard Weinberger

    Saurabh Sengar
     
  • If UML runs on the host side out of memory, report this
    condition more nicely.

    Signed-off-by: Richard Weinberger

    Richard Weinberger
     
  • We can use __NR_syscall_max.

    Signed-off-by: Richard Weinberger

    Richard Weinberger
     
  • To support changing syscall numbers we have to store
    it after syscall_trace_enter().

    Signed-off-by: Richard Weinberger

    Richard Weinberger
     
  • ...such that processes within UML can do a ptrace(PTRACE_OLDSETOPTIONS, ...)

    Signed-off-by: Richard Weinberger

    Richard Weinberger
     

20 Oct, 2015

3 commits

  • We have to exclude memory locations

    Richard Weinberger
     
  • If UML is executing a helper program it is using
    waitpid() with the __WCLONE flag to wait for the program
    as the helper is executed from a clone()'ed thread.
    While using __WCLONE is perfectly fine for clone()'ed
    childs it won't detect terminated childs if the helper
    has issued an execve().

    We have to use __WALL to wait for both clone()'ed and
    regular childs to detect the termination before and
    after an execve().

    Reported-and-tested-by: Thomas Meyer
    Signed-off-by: Richard Weinberger

    Richard Weinberger
     
  • Commit 30b11ee9a (um: Remove copy&paste code from init.h)
    uncovered an issue wrt. out-of-tree builds.
    For out-of-tree builds, we must not rely on relative paths.
    Before 30b11ee9a it worked by chance as no host code included
    generated header files.

    Acked-by: Randy Dunlap
    Signed-off-by: Richard Weinberger

    Richard Weinberger
     

04 Oct, 2015

1 commit

  • Pull strscpy string copy function implementation from Chris Metcalf.

    Chris sent this during the merge window, but I waffled back and forth on
    the pull request, which is why it's going in only now.

    The new "strscpy()" function is definitely easier to use and more secure
    than either strncpy() or strlcpy(), both of which are horrible nasty
    interfaces that have serious and irredeemable problems.

    strncpy() has a useless return value, and doesn't NUL-terminate an
    overlong result. To make matters worse, it pads a short result with
    zeroes, which is a performance disaster if you have big buffers.

    strlcpy(), by contrast, is a mis-designed "fix" for strlcpy(), lacking
    the insane NUL padding, but having a differently broken return value
    which returns the original length of the source string. Which means
    that it will read characters past the count from the source buffer, and
    you have to trust the source to be properly terminated. It also makes
    error handling fragile, since the test for overflow is unnecessarily
    subtle.

    strscpy() avoids both these problems, guaranteeing the NUL termination
    (but not excessive padding) if the destination size wasn't zero, and
    making the overflow condition very obvious by returning -E2BIG. It also
    doesn't read past the size of the source, and can thus be used for
    untrusted source data too.

    So why did I waffle about this for so long?

    Every time we introduce a new-and-improved interface, people start doing
    these interminable series of trivial conversion patches.

    And every time that happens, somebody does some silly mistake, and the
    conversion patch to the improved interface actually makes things worse.
    Because the patch is mindnumbing and trivial, nobody has the attention
    span to look at it carefully, and it's usually done over large swatches
    of source code which means that not every conversion gets tested.

    So I'm pulling the strscpy() support because it *is* a better interface.
    But I will refuse to pull mindless conversion patches. Use this in
    places where it makes sense, but don't do trivial patches to fix things
    that aren't actually known to be broken.

    * 'strscpy' of git://git.kernel.org/pub/scm/linux/kernel/git/cmetcalf/linux-tile:
    tile: use global strscpy() rather than private copy
    string: provide strscpy()
    Make asm/word-at-a-time.h available on all architectures

    Linus Torvalds
     

02 Sep, 2015

1 commit

  • Pull timer updates from Thomas Gleixner:
    "Rather large, but nothing exiting:

    - new range check for settimeofday() to prevent that boot time
    becomes negative.
    - fix for file time rounding
    - a few simplifications of the hrtimer code
    - fix for the proc/timerlist code so the output of clock realtime
    timers is accurate
    - more y2038 work
    - tree wide conversion of clockevent drivers to the new callbacks"

    * 'timers-core-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip: (88 commits)
    hrtimer: Handle failure of tick_init_highres() gracefully
    hrtimer: Unconfuse switch_hrtimer_base() a bit
    hrtimer: Simplify get_target_base() by returning current base
    hrtimer: Drop return code of hrtimer_switch_to_hres()
    time: Introduce timespec64_to_jiffies()/jiffies_to_timespec64()
    time: Introduce current_kernel_time64()
    time: Introduce struct itimerspec64
    time: Add the common weak version of update_persistent_clock()
    time: Always make sure wall_to_monotonic isn't positive
    time: Fix nanosecond file time rounding in timespec_trunc()
    timer_list: Add the base offset so remaining nsecs are accurate for non monotonic timers
    cris/time: Migrate to new 'set-state' interface
    kernel: broadcast-hrtimer: Migrate to new 'set-state' interface
    xtensa/time: Migrate to new 'set-state' interface
    unicore/time: Migrate to new 'set-state' interface
    um/time: Migrate to new 'set-state' interface
    sparc/time: Migrate to new 'set-state' interface
    sh/localtimer: Migrate to new 'set-state' interface
    score/time: Migrate to new 'set-state' interface
    s390/time: Migrate to new 'set-state' interface
    ...

    Linus Torvalds
     

10 Aug, 2015

1 commit

  • Migrate um driver to the new 'set-state' interface provided by
    clockevents core, the earlier 'set-mode' interface is marked obsolete
    now.

    This also enables us to implement callbacks for new states of clockevent
    devices, for example: ONESHOT_STOPPED.

    Cc: Jeff Dike
    Cc: Richard Weinberger
    Cc: user-mode-linux-devel@lists.sourceforge.net
    Cc: user-mode-linux-user@lists.sourceforge.net
    Signed-off-by: Viresh Kumar
    Signed-off-by: Daniel Lezcano

    Viresh Kumar
     

31 Jul, 2015

1 commit


18 Jul, 2015

1 commit

  • Commit 2ae416b142b6 ("mm: new mm hook framework") introduced an empty
    header file (mm-arch-hooks.h) for every architecture, even those which
    doesn't need to define mm hooks.

    As suggested by Geert Uytterhoeven, this could be cleaned through the use
    of a generic header file included via each per architecture
    asm/include/Kbuild file.

    The PowerPC architecture is not impacted here since this architecture has
    to defined the arch_remap MM hook.

    Signed-off-by: Laurent Dufour
    Suggested-by: Geert Uytterhoeven
    Acked-by: Geert Uytterhoeven
    Acked-by: Vineet Gupta
    Cc: Oleg Nesterov
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Laurent Dufour
     

09 Jul, 2015

1 commit

  • Added the x86 implementation of word-at-a-time to the
    generic version, which previously only supported big-endian.

    Omitted the x86-specific load_unaligned_zeropad(), which in
    any case is also not present for the existing BE-only
    implementation of a word-at-a-time, and is only used under
    CONFIG_DCACHE_WORD_ACCESS.

    Added as a "generic-y" to the Kbuilds of all architectures
    that didn't previously have it.

    Signed-off-by: Chris Metcalf

    Chris Metcalf
     

07 Jul, 2015

1 commit

  • Once x86 exports its do_signal(), the prototypes will clash.

    Fix the clash and also improve the code a bit: remove the
    unnecessary kern_do_signal() indirection. This allows
    interrupt_end() to share the 'regs' parameter calculation.

    Also remove the unused return code to match x86.

    Minimally build and boot tested.

    Signed-off-by: Ingo Molnar
    Signed-off-by: Andy Lutomirski
    Cc: Andrew Morton
    Cc: Andy Lutomirski
    Cc: Borislav Petkov
    Cc: Brian Gerst
    Cc: Denys Vlasenko
    Cc: Denys Vlasenko
    Cc: Frederic Weisbecker
    Cc: H. Peter Anvin
    Cc: Kees Cook
    Cc: Linus Torvalds
    Cc: Oleg Nesterov
    Cc: Peter Zijlstra
    Cc: Richard Weinberger
    Cc: Rik van Riel
    Cc: Thomas Gleixner
    Cc: paulmck@linux.vnet.ibm.com
    Link: http://lkml.kernel.org/r/67c57eac09a589bac3c6c5ff22f9623ec55a184a.1435952415.git.luto@kernel.org
    Signed-off-by: Ingo Molnar

    Ingo Molnar
     

02 Jul, 2015

1 commit

  • Pull module updates from Rusty Russell:
    "Main excitement here is Peter Zijlstra's lockless rbtree optimization
    to speed module address lookup. He found some abusers of the module
    lock doing that too.

    A little bit of parameter work here too; including Dan Streetman's
    breaking up the big param mutex so writing a parameter can load
    another module (yeah, really). Unfortunately that broke the usual
    suspects, !CONFIG_MODULES and !CONFIG_SYSFS, so those fixes were
    appended too"

    * tag 'modules-next-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/rusty/linux: (26 commits)
    modules: only use mod->param_lock if CONFIG_MODULES
    param: fix module param locks when !CONFIG_SYSFS.
    rcu: merge fix for Convert ACCESS_ONCE() to READ_ONCE() and WRITE_ONCE()
    module: add per-module param_lock
    module: make perm const
    params: suppress unused variable error, warn once just in case code changes.
    modules: clarify CONFIG_MODULE_COMPRESS help, suggest 'N'.
    kernel/module.c: avoid ifdefs for sig_enforce declaration
    kernel/workqueue.c: remove ifdefs over wq_power_efficient
    kernel/params.c: export param_ops_bool_enable_only
    kernel/params.c: generalize bool_enable_only
    kernel/module.c: use generic module param operaters for sig_enforce
    kernel/params: constify struct kernel_param_ops uses
    sysfs: tightened sysfs permission checks
    module: Rework module_addr_{min,max}
    module: Use __module_address() for module_address_lookup()
    module: Make the mod_tree stuff conditional on PERF_EVENTS || TRACING
    module: Optimize __module_address() using a latched RB-tree
    rbtree: Implement generic latch_tree
    seqlock: Introduce raw_read_seqcount_latch()
    ...

    Linus Torvalds
     

29 Jun, 2015

1 commit

  • Pull UML updates from Richard Weinberger:

    - remove hppfs ("HonePot ProcFS")

    - initial support for musl libc

    - uaccess cleanup

    - random cleanups and bug fixes all over the place

    * 'for-linus-4.2-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/rw/uml: (21 commits)
    um: Don't pollute kernel namespace with uapi
    um: Include sys/types.h for makedev(), major(), minor()
    um: Do not use stdin and stdout identifiers for struct members
    um: Do not use __ptr_t type for stack_t's .ss pointer
    um: Fix mconsole dependency
    um: Handle tracehook_report_syscall_entry() result
    um: Remove copy&paste code from init.h
    um: Stop abusing __KERNEL__
    um: Catch unprotected user memory access
    um: Fix warning in setup_signal_stack_si()
    um: Rework uaccess code
    um: Add uaccess.h to ldt.c
    um: Add uaccess.h to syscalls_64.c
    um: Add asm/elf.h to vma.c
    um: Cleanup mem_32/64.c headers
    um: Remove hppfs
    um: Move syscall() declaration into os.h
    um: kernel: ksyms: Export symbol syscall() for fixing modpost issue
    um/os-Linux: Use char[] for syscall_stub declarations
    um: Use char[] for linker script address declarations
    ...

    Linus Torvalds
     

27 Jun, 2015

1 commit

  • Pull char/misc driver updates from Greg KH:
    "Here's the big char/misc driver pull request for 4.2-rc1.

    Lots of mei, extcon, coresight, uio, mic, and other driver updates in
    here. Full details in the shortlog. All of these have been in
    linux-next for some time with no reported problems"

    * tag 'char-misc-4.2-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/char-misc: (176 commits)
    mei: me: wait for power gating exit confirmation
    mei: reset flow control on the last client disconnection
    MAINTAINERS: mei: add mei_cl_bus.h to maintained file list
    misc: sram: sort and clean up included headers
    misc: sram: move reserved block logic out of probe function
    misc: sram: add private struct device and virt_base members
    misc: sram: report correct SRAM pool size
    misc: sram: bump error message level on unclean driver unbinding
    misc: sram: fix device node reference leak on error
    misc: sram: fix enabled clock leak on error path
    misc: mic: Fix reported static checker warning
    misc: mic: Fix randconfig build error by including errno.h
    uio: pruss: Drop depends on ARCH_DAVINCI_DA850 from config
    uio: pruss: Add CONFIG_HAS_IOMEM dependence
    uio: pruss: Include
    extcon: Redefine the unique id of supported external connectors without 'enum extcon' type
    char:xilinx_hwicap:buffer_icap - change 1/0 to true/false for bool type variable in function buffer_icap_set_configuration().
    Drivers: hv: vmbus: Allocate ring buffer memory in NUMA aware fashion
    parport: check exclusive access before register
    w1: use correct lock on error in w1_seq_show()
    ...

    Linus Torvalds
     

26 Jun, 2015

5 commits


25 Jun, 2015

1 commit

  • CRIU is recreating the process memory layout by remapping the checkpointee
    memory area on top of the current process (criu). This includes remapping
    the vDSO to the place it has at checkpoint time.

    However some architectures like powerpc are keeping a reference to the
    vDSO base address to build the signal return stack frame by calling the
    vDSO sigreturn service. So once the vDSO has been moved, this reference
    is no more valid and the signal frame built later are not usable.

    This patch serie is introducing a new mm hook framework, and a new
    arch_remap hook which is called when mremap is done and the mm lock still
    hold. The next patch is adding the vDSO remap and unmap tracking to the
    powerpc architecture.

    This patch (of 3):

    This patch introduces a new set of header file to manage mm hooks:
    - per architecture empty header file (arch/x/include/asm/mm-arch-hooks.h)
    - a generic header (include/linux/mm-arch-hooks.h)

    The architecture which need to overwrite a hook as to redefine it in its
    header file, while architecture which doesn't need have nothing to do.

    The default hooks are defined in the generic header and are used in the
    case the architecture is not defining it.

    In a next step, mm hooks defined in include/asm-generic/mm_hooks.h should
    be moved here.

    Signed-off-by: Laurent Dufour
    Suggested-by: Andrew Morton
    Cc: "Kirill A. Shutemov"
    Cc: Hugh Dickins
    Cc: Rik van Riel
    Cc: Mel Gorman
    Cc: Pavel Emelyanov
    Cc: Benjamin Herrenschmidt
    Cc: Paul Mackerras
    Cc: Michael Ellerman
    Cc: Ingo Molnar
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Laurent Dufour
     

23 Jun, 2015

1 commit

  • Add a "param_lock" mutex to each module, and update params.c to use
    the correct built-in or module mutex while locking kernel params.
    Remove the kparam_block_sysfs_r/w() macros, replace them with direct
    calls to kernel_param_[un]lock(module).

    The kernel param code currently uses a single mutex to protect
    modification of any and all kernel params. While this generally works,
    there is one specific problem with it; a module callback function
    cannot safely load another module, i.e. with request_module() or even
    with indirect calls such as crypto_has_alg(). If the module to be
    loaded has any of its params configured (e.g. with a /etc/modprobe.d/*
    config file), then the attempt will result in a deadlock between the
    first module param callback waiting for modprobe, and modprobe trying to
    lock the single kernel param mutex to set the new module's param.

    This fixes that by using per-module mutexes, so that each individual module
    is protected against concurrent changes in its own kernel params, but is
    not blocked by changes to other module params. All built-in modules
    continue to use the built-in mutex, since they will always be loaded at
    runtime and references (e.g. request_module(), crypto_has_alg()) to them
    will never cause load-time param changing.

    This also simplifies the interface used by modules to block sysfs access
    to their params; while there are currently functions to block and unblock
    sysfs param access which are split up by read and write and expect a single
    kernel param to be passed, their actual operation is identical and applies
    to all params, not just the one passed to them; they simply lock and unlock
    the global param mutex. They are replaced with direct calls to
    kernel_param_[un]lock(THIS_MODULE), which locks THIS_MODULE's param_lock, or
    if the module is built-in, it locks the built-in mutex.

    Suggested-by: Rusty Russell
    Signed-off-by: Dan Streetman
    Signed-off-by: Rusty Russell

    Dan Streetman
     

01 Jun, 2015

5 commits


31 May, 2015

6 commits