1. 15 9月, 2016 1 次提交
  2. 08 9月, 2016 1 次提交
    • M
      um/ptrace: Fix the syscall number update after a ptrace · ce29856a
      Mickaël Salaün 提交于
      Update the syscall number after each PTRACE_SETREGS on ORIG_*AX.
      
      This is needed to get the potentially altered syscall number in the
      seccomp filters after RET_TRACE.
      
      This fix four seccomp_bpf tests:
      > [ RUN      ] TRACE_syscall.skip_after_RET_TRACE
      > seccomp_bpf.c:1560:TRACE_syscall.skip_after_RET_TRACE:Expected -1 (18446744073709551615) == syscall(39) (26)
      > seccomp_bpf.c:1561:TRACE_syscall.skip_after_RET_TRACE:Expected 1 (1) == (*__errno_location ()) (22)
      > [     FAIL ] TRACE_syscall.skip_after_RET_TRACE
      > [ RUN      ] TRACE_syscall.kill_after_RET_TRACE
      > TRACE_syscall.kill_after_RET_TRACE: Test exited normally instead of by signal (code: 1)
      > [     FAIL ] TRACE_syscall.kill_after_RET_TRACE
      > [ RUN      ] TRACE_syscall.skip_after_ptrace
      > seccomp_bpf.c:1622:TRACE_syscall.skip_after_ptrace:Expected -1 (18446744073709551615) == syscall(39) (26)
      > seccomp_bpf.c:1623:TRACE_syscall.skip_after_ptrace:Expected 1 (1) == (*__errno_location ()) (22)
      > [     FAIL ] TRACE_syscall.skip_after_ptrace
      > [ RUN      ] TRACE_syscall.kill_after_ptrace
      > TRACE_syscall.kill_after_ptrace: Test exited normally instead of by signal (code: 1)
      > [     FAIL ] TRACE_syscall.kill_after_ptrace
      
      Fixes: 26703c63 ("um/ptrace: run seccomp after ptrace")
      Signed-off-by: NMickaël Salaün <mic@digikod.net>
      Acked-by: NKees Cook <keescook@chromium.org>
      Cc: Jeff Dike <jdike@addtoit.com>
      Cc: Richard Weinberger <richard@nod.at>
      Cc: James Morris <jmorris@namei.org>
      Cc: user-mode-linux-devel@lists.sourceforge.net
      Signed-off-by: NJames Morris <james.l.morris@oracle.com>
      Signed-off-by: NKees Cook <keescook@chromium.org>
      ce29856a
  3. 09 8月, 2016 1 次提交
    • M
      um/ptrace: Fix the syscall number update after a ptrace · 4b056a4b
      Mickaël Salaün 提交于
      Update the syscall number after each PTRACE_SETREGS on ORIG_*AX.
      
      This is needed to get the potentially altered syscall number in the
      seccomp filters after RET_TRACE.
      
      This fix four seccomp_bpf tests:
      > [ RUN      ] TRACE_syscall.skip_after_RET_TRACE
      > seccomp_bpf.c:1560:TRACE_syscall.skip_after_RET_TRACE:Expected -1 (18446744073709551615) == syscall(39) (26)
      > seccomp_bpf.c:1561:TRACE_syscall.skip_after_RET_TRACE:Expected 1 (1) == (*__errno_location ()) (22)
      > [     FAIL ] TRACE_syscall.skip_after_RET_TRACE
      > [ RUN      ] TRACE_syscall.kill_after_RET_TRACE
      > TRACE_syscall.kill_after_RET_TRACE: Test exited normally instead of by signal (code: 1)
      > [     FAIL ] TRACE_syscall.kill_after_RET_TRACE
      > [ RUN      ] TRACE_syscall.skip_after_ptrace
      > seccomp_bpf.c:1622:TRACE_syscall.skip_after_ptrace:Expected -1 (18446744073709551615) == syscall(39) (26)
      > seccomp_bpf.c:1623:TRACE_syscall.skip_after_ptrace:Expected 1 (1) == (*__errno_location ()) (22)
      > [     FAIL ] TRACE_syscall.skip_after_ptrace
      > [ RUN      ] TRACE_syscall.kill_after_ptrace
      > TRACE_syscall.kill_after_ptrace: Test exited normally instead of by signal (code: 1)
      > [     FAIL ] TRACE_syscall.kill_after_ptrace
      
      Fixes: 26703c63 ("um/ptrace: run seccomp after ptrace")
      Signed-off-by: NMickaël Salaün <mic@digikod.net>
      Acked-by: NKees Cook <keescook@chromium.org>
      Cc: Jeff Dike <jdike@addtoit.com>
      Cc: Richard Weinberger <richard@nod.at>
      Cc: James Morris <jmorris@namei.org>
      Cc: user-mode-linux-devel@lists.sourceforge.net
      Signed-off-by: NJames Morris <james.l.morris@oracle.com>
      4b056a4b
  4. 08 8月, 2016 1 次提交
  5. 04 8月, 2016 1 次提交
    • V
      um: Support kcov · 915eed20
      Vegard Nossum 提交于
      This adds support for kcov to UML.
      
      There is a small problem where UML will randomly segfault during boot;
      this is because current_thread_info() occasionally returns an invalid
      (non-NULL) pointer and we try to dereference it in
      __sanitizer_cov_trace_pc(). I consider this a bug in UML itself and this
      patch merely exposes it.
      
      [v2: disable instrumentation in UML-specific code]
      
      Cc: Quentin Casasnovas <quentin.casasnovas@oracle.com>
      Cc: Richard Weinberger <richard@nod.at>
      Cc: Thomas Meyer <thomas@m3y3r.de>
      Cc: user-mode-linux-devel <user-mode-linux-devel@lists.sourceforge.net>
      Cc: Dmitry Vyukov <dvyukov@google.com>
      Signed-off-by: NVegard Nossum <vegard.nossum@oracle.com>
      Signed-off-by: NRichard Weinberger <richard@nod.at>
      915eed20
  6. 14 7月, 2016 1 次提交
    • P
      x86: Audit and remove any remaining unnecessary uses of module.h · eb008eb6
      Paul Gortmaker 提交于
      Historically a lot of these existed because we did not have
      a distinction between what was modular code and what was providing
      support to modules via EXPORT_SYMBOL and friends.  That changed
      when we forked out support for the latter into the export.h file.
      
      This means we should be able to reduce the usage of module.h
      in code that is obj-y Makefile or bool Kconfig.  In the case of
      some of these which are modular, we can extend that to also include
      files that are building basic support functionality but not related
      to loading or registering the final module; such files also have
      no need whatsoever for module.h
      
      The advantage in removing such instances is that module.h itself
      sources about 15 other headers; adding significantly to what we feed
      cpp, and it can obscure what headers we are effectively using.
      
      Since module.h was the source for init.h (for __init) and for
      export.h (for EXPORT_SYMBOL) we consider each instance for the
      presence of either and replace as needed.
      
      In the case of crypto/glue_helper.c we delete a redundant instance
      of MODULE_LICENSE in order to delete module.h -- the license info
      is already present at the top of the file.
      
      The uncore change warrants a mention too; it is uncore.c that uses
      module.h and not uncore.h; hence the relocation done there.
      Signed-off-by: NPaul Gortmaker <paul.gortmaker@windriver.com>
      Cc: Linus Torvalds <torvalds@linux-foundation.org>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Thomas Gleixner <tglx@linutronix.de>
      Link: http://lkml.kernel.org/r/20160714001901.31603-9-paul.gortmaker@windriver.comSigned-off-by: NIngo Molnar <mingo@kernel.org>
      eb008eb6
  7. 24 5月, 2016 1 次提交
  8. 22 5月, 2016 3 次提交
    • E
      um: add extended processor state save/restore support · a78ff111
      Eli Cooper 提交于
      This patch extends save_fp_registers() and restore_fp_registers() to use
      PTRACE_GETREGSET and PTRACE_SETREGSET with the XSTATE note type, adding
      support for new processor state extensions between context switches.
      
      When the new ptrace requests are unavailable, it falls back to the old
      PTRACE_GETFPREGS and PTRACE_SETFPREGS methods, which have been renamed to
      save_i387_registers() and restore_i387_registers().
      
      Now these functions expect *fp_regs to have the space of an _xstate struct.
      Thus, this also makes ptrace in UML responde to PTRACE_GETFPREGS/_SETFPREG
      requests with a user_i387_struct (thus independent from HOST_FP_SIZE), and
      by calling save_i387_registers() and restore_i387_registers() instead of
      the extended save_fp_registers() and restore_fp_registers() functions.
      Signed-off-by: NEli Cooper <elicooper@gmx.com>
      a78ff111
    • E
      um: extend fpstate to _xstate to support YMM registers · b6024b21
      Eli Cooper 提交于
      Extends fpstate to _xstate, in order to hold AVX/YMM registers.
      
      To avoid oversized stack frame, the following functions have been
      refactored by using malloc.
       - sig_handler_common
       - timer_real_alarm_handler
      Signed-off-by: NEli Cooper <elicooper@gmx.com>
      b6024b21
    • E
      um: fix FPU state preservation around signal handlers · 6de5a8a5
      Eli Cooper 提交于
      This patch makes UML saves/restores FPU state from/to the fpstate in
      pt_regs when setting up or returning from a signal stack, rather than
      calling ptrace directly. This ensures that FPU state is correctly
      preserved around signal handlers in a multi-threaded scenario.
      Signed-off-by: NEli Cooper <elicooper@gmx.com>
      6de5a8a5
  9. 14 3月, 2016 2 次提交
    • A
      ipv6: Pass proto to csum_ipv6_magic as __u8 instead of unsigned short · 1e940829
      Alexander Duyck 提交于
      This patch updates csum_ipv6_magic so that it correctly recognizes that
      protocol is a unsigned 8 bit value.
      
      This will allow us to better understand what limitations may or may not be
      present in how we handle the data.  For example there are a number of
      places that call htonl on the protocol value.  This is likely not necessary
      and can be replaced with a multiplication by ntohl(1) which will be
      converted to a shift by the compiler.
      Signed-off-by: NAlexander Duyck <aduyck@mirantis.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      1e940829
    • A
      ipv4: Update parameters for csum_tcpudp_magic to their original types · 01cfbad7
      Alexander Duyck 提交于
      This patch updates all instances of csum_tcpudp_magic and
      csum_tcpudp_nofold to reflect the types that are usually used as the source
      inputs.  For example the protocol field is populated based on nexthdr which
      is actually an unsigned 8 bit value.  The length is usually populated based
      on skb->len which is an unsigned integer.
      
      This addresses an issue in which the IPv6 function csum_ipv6_magic was
      generating a checksum using the full 32b of skb->len while
      csum_tcpudp_magic was only using the lower 16 bits.  As a result we could
      run into issues when attempting to adjust the checksum as there was no
      protocol agnostic way to update it.
      
      With this change the value is still truncated as many architectures use
      "(len + proto) << 8", however this truncation only occurs for values
      greater than 16776960 in length and as such is unlikely to occur as we stop
      the inner headers at ~64K in size.
      
      I did have to make a few minor changes in the arm, mn10300, nios2, and
      score versions of the function in order to support these changes as they
      were either using things such as an OR to combine the protocol and length,
      or were using ntohs to convert the length which would have truncated the
      value.
      
      I also updated a few spots in terms of whitespace and type differences for
      the addresses.  Most of this was just to make sure all of the definitions
      were in sync going forward.
      Signed-off-by: NAlexander Duyck <aduyck@mirantis.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      01cfbad7
  10. 06 3月, 2016 1 次提交
  11. 30 1月, 2016 1 次提交
  12. 29 1月, 2016 3 次提交
  13. 13 1月, 2016 1 次提交
  14. 11 1月, 2016 3 次提交
    • M
      um: Fix build error and kconfig for i386 · 42d91f61
      Mickaël Salaün 提交于
      Fix build error by generating elfcore.o only when ELF_CORE (depending on
      COREDUMP) is selected:
      
      arch/x86/um/built-in.o: In function `elf_core_write_extra_phdrs':
      (.text+0x3e62): undefined reference to `dump_emit'
      arch/x86/um/built-in.o: In function `elf_core_write_extra_data':
      (.text+0x3eef): undefined reference to `dump_emit'
      
      Fixes: 5d2acfc7 ("kconfig: make allnoconfig disable options behind EMBEDDED and EXPERT")
      Signed-off-by: NMickaël Salaün <mic@digikod.net>
      Cc: Jeff Dike <jdike@addtoit.com>
      Cc: Richard Weinberger <richard@nod.at>
      Cc: Josh Triplett <josh@joshtriplett.org>
      Cc: Paul E. McKenney <paulmck@linux.vnet.ibm.com>
      Cc: Michal Marek <mmarek@suse.cz>
      Cc: Andrew Morton <akpm@linux-foundation.org>
      Cc: Linus Torvalds <torvalds@linux-foundation.org>
      Signed-off-by: NRichard Weinberger <richard@nod.at>
      Reviewed-by: NJosh Triplett <josh@joshtriplett.org>
      42d91f61
    • M
      um: Add full asm/syscall.h support · d8f8b844
      Mickaël Salaün 提交于
      Add subarchitecture-independent implementation of asm-generic/syscall.h
      allowing access to user system call parameters and results:
      * syscall_get_nr()
      * syscall_rollback()
      * syscall_get_error()
      * syscall_get_return_value()
      * syscall_set_return_value()
      * syscall_get_arguments()
      * syscall_set_arguments()
      * syscall_get_arch() provided by arch/x86/um/asm/syscall.h
      
      This provides the necessary syscall helpers needed by
      HAVE_ARCH_SECCOMP_FILTER plus syscall_get_error().
      
      This is inspired from Meredydd Luff's patch
      (https://gerrit.chromium.org/gerrit/21425).
      Signed-off-by: NMickaël Salaün <mic@digikod.net>
      Cc: Jeff Dike <jdike@addtoit.com>
      Cc: Richard Weinberger <richard@nod.at>
      Cc: Thomas Gleixner <tglx@linutronix.de>
      Cc: Ingo Molnar <mingo@redhat.com>
      Cc: H. Peter Anvin <hpa@zytor.com>
      Cc: Kees Cook <keescook@chromium.org>
      Cc: Andy Lutomirski <luto@amacapital.net>
      Cc: Will Drewry <wad@chromium.org>
      Cc: Meredydd Luff <meredydd@senatehouse.org>
      Cc: David Drysdale <drysdale@google.com>
      Signed-off-by: NRichard Weinberger <richard@nod.at>
      Acked-by: NKees Cook <keescook@chromium.org>
      d8f8b844
    • M
      um: Fix ptrace GETREGS/SETREGS bugs · e04c989e
      Mickaël Salaün 提交于
      This fix two related bugs:
      * PTRACE_GETREGS doesn't get the right orig_ax (syscall) value
      * PTRACE_SETREGS can't set the orig_ax value (erased by initial value)
      
      Get rid of the now useless and error-prone get_syscall().
      
      Fix inconsistent behavior in the ptrace implementation for i386 when
      updating orig_eax automatically update the syscall number as well. This
      is now updated in handle_syscall().
      Signed-off-by: NMickaël Salaün <mic@digikod.net>
      Cc: Jeff Dike <jdike@addtoit.com>
      Cc: Richard Weinberger <richard@nod.at>
      Cc: Thomas Gleixner <tglx@linutronix.de>
      Cc: Kees Cook <keescook@chromium.org>
      Cc: Andy Lutomirski <luto@amacapital.net>
      Cc: Will Drewry <wad@chromium.org>
      Cc: Thomas Meyer <thomas@m3y3r.de>
      Cc: Nicolas Iooss <nicolas.iooss_linux@m4x.org>
      Cc: Anton Ivanov <aivanov@brocade.com>
      Cc: Meredydd Luff <meredydd@senatehouse.org>
      Cc: David Drysdale <drysdale@google.com>
      Signed-off-by: NRichard Weinberger <richard@nod.at>
      Acked-by: NKees Cook <keescook@chromium.org>
      e04c989e
  15. 23 12月, 2015 1 次提交
  16. 09 12月, 2015 1 次提交
  17. 07 11月, 2015 3 次提交
  18. 20 10月, 2015 1 次提交
  19. 14 10月, 2015 1 次提交
  20. 09 10月, 2015 2 次提交
  21. 06 7月, 2015 1 次提交
  22. 26 6月, 2015 1 次提交
  23. 04 6月, 2015 1 次提交
    • I
      x86/asm/entry: Move the 'thunk' functions to arch/x86/entry/ · e6b93f4e
      Ingo Molnar 提交于
      These are all calling x86 entry code functions, so move them close
      to other entry code.
      
      Change lib-y to obj-y: there's no real difference between the two
      as we don't really drop any of them during the linking stage, and
      obj-y is the more common approach for core kernel object code.
      
      Cc: Borislav Petkov <bp@alien8.de>
      Cc: H. Peter Anvin <hpa@zytor.com>
      Cc: Linus Torvalds <torvalds@linux-foundation.org>
      Cc: Thomas Gleixner <tglx@linutronix.de>
      Cc: Andy Lutomirski <luto@amacapital.net>
      Cc: Denys Vlasenko <dvlasenk@redhat.com>
      Cc: Brian Gerst <brgerst@gmail.com>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: linux-kernel@vger.kernel.org
      Signed-off-by: NIngo Molnar <mingo@kernel.org>
      e6b93f4e
  24. 01 6月, 2015 1 次提交
  25. 31 5月, 2015 6 次提交