1. 06 Dec, 2022 11 commits
  2. 05 Dec, 2022 1 commit
    • junhua huang's avatar
      arm64:uprobe fix the uprobe SWBP_INSN in big-endian · 60f07e22
      junhua huang authored
      We use uprobe in aarch64_be, which we found the tracee task would exit
      due to SIGILL when we enable the uprobe trace.
      We can see the replace inst from uprobe is not correct in aarch big-endian.
      As in Armv8-A, instruction fetches are always treated as little-endian,
      we should treat the UPROBE_SWBP_INSN as little-endian。
      
      The test case is as following。
      bash-4.4# ./mqueue_test_aarchbe 1 1 2 1 10 > /dev/null &
      bash-4.4# cd /sys/kernel/debug/tracing/
      bash-4.4# echo 'p:test /mqueue_test_aarchbe:0xc30 %x0 %x1' > uprobe_events
      bash-4.4# echo 1 > events/uprobes/enable
      bash-4.4#
      bash-4.4# ps
        PID TTY          TIME CMD
        140 ?        00:00:01 bash
        237 ?        00:00:00 ps
      [1]+  Illegal instruction     ./mqueue_test_aarchbe 1 1 2 1 100 > /dev/null
      
      which we debug use gdb as following:
      
      bash-4.4# gdb attach 155
      (gdb) disassemble send
      Dump of assembler code for function send:
         0x0000000000400c30 <+0>:     .inst   0xa00020d4 ; undefined
         0x0000000000400c34 <+4>:     mov     x29, sp
         0x0000000000400c38 <+8>:     str     w0, [sp, #28]
         0x0000000000400c3c <+12>:    strb    w1, [sp, #27]
         0x0000000000400c40 <+16>:    str     xzr, [sp, #40]
         0x0000000000400c44 <+20>:    str     xzr, [sp, #48]
         0x0000000000400c48 <+24>:    add     x0, sp, #0x1b
         0x0000000000400c4c <+28>:    mov     w3, #0x0                 // #0
         0x0000000000400c50 <+32>:    mov     x2, #0x1                 // #1
         0x0000000000400c54 <+36>:    mov     x1, x0
         0x0000000000400c58 <+40>:    ldr     w0, [sp, #28]
         0x0000000000400c5c <+44>:    bl      0x405e10 <mq_send>
         0x0000000000400c60 <+48>:    str     w0, [sp, #60]
         0x0000000000400c64 <+52>:    ldr     w0, [sp, #60]
         0x0000000000400c68 <+56>:    ldp     x29, x30, [sp], #64
         0x0000000000400c6c <+60>:    ret
      End of assembler dump.
      (gdb) info b
      No breakpoints or watchpoints.
      (gdb) c
      Continuing.
      
      Program received signal SIGILL, Illegal instruction.
      0x0000000000400c30 in send ()
      (gdb) x/10x 0x400c30
      0x400c30 <send>:    0xd42000a0   0xfd030091      0xe01f00b9      0xe16f0039
      0x400c40 <send+16>: 0xff1700f9   0xff1b00f9      0xe06f0091      0x03008052
      0x400c50 <send+32>: 0x220080d2   0xe10300aa
      (gdb) disassemble 0x400c30
      Dump of assembler code for function send:
      => 0x0000000000400c30 <+0>:     .inst   0xa00020d4 ; undefined
         0x0000000000400c34 <+4>:     mov     x29, sp
         0x0000000000400c38 <+8>:     str     w0, [sp, #28]
         0x0000000000400c3c <+12>:    strb    w1, [sp, #27]
         0x0000000000400c40 <+16>:    str     xzr, [sp, #40]
      Signed-off-by: default avatarjunhua huang <huang.junhua@zte.com.cn>
      Link: https://lore.kernel.org/r/202212021511106844809@zte.com.cnSigned-off-by: default avatarWill Deacon <will@kernel.org>
      60f07e22
  3. 01 Dec, 2022 2 commits
  4. 25 Nov, 2022 1 commit
    • Mark Rutland's avatar
      ftrace: arm64: remove static ftrace · cfce092d
      Mark Rutland authored
      The build test robot pointer out that there's a build failure when:
      
        CONFIG_HAVE_DYNAMIC_FTRACE_WITH_ARGS=y
        CONFIG_DYNAMIC_FTRACE_WITH_ARGS=n
      
      ... due to some mismatched ifdeffery, some of which checks
      CONFIG_HAVE_DYNAMIC_FTRACE_WITH_ARGS, and some of which checks
      CONFIG_DYNAMIC_FTRACE_WITH_ARGS, leading to some missing definitions expected
      by the core code when CONFIG_DYNAMIC_FTRACE=n and consequently
      CONFIG_DYNAMIC_FTRACE_WITH_ARGS=n.
      
      There's really not much point in supporting CONFIG_DYNAMIC_FTRACE=n (AKA
      static ftrace). All supported toolchains allow us to implement
      DYNAMIC_FTRACE, distributions all prefer DYNAMIC_FTRACE, and both
      powerpc and s390 removed support for static ftrace in commits:
      
        0c0c5230 ("powerpc: Only support DYNAMIC_FTRACE not static")
        5d6a0163 ("s390/ftrace: enforce DYNAMIC_FTRACE if FUNCTION_TRACER is selected")
      
      ... and according to Steven, static ftrace is only supported on x86 to
      allow testing that the core code still functions in this configuration.
      
      Given that, let's simplify matters by removing arm64's support for
      static ftrace. This avoids the problem originally reported, and leaves
      us with less code to maintain.
      
      Fixes: 26299b3f ("ftrace: arm64: move from REGS to ARGS")
      Link: https://lore.kernel.org/r/202211212249.livTPi3Y-lkp@intel.comSuggested-by: default avatarSteven Rostedt <rostedt@goodmis.org>
      Signed-off-by: default avatarMark Rutland <mark.rutland@arm.com>
      Cc: Will Deacon <will@kernel.org>
      Cc: Catalin Marinas <catalin.marinas@arm.com>
      Acked-by: default avatarSteven Rostedt (Google) <rostedt@goodmis.org>
      Link: https://lore.kernel.org/r/20221122163624.1225912-1-mark.rutland@arm.comSigned-off-by: default avatarWill Deacon <will@kernel.org>
      cfce092d
  5. 18 Nov, 2022 8 commits
  6. 15 Nov, 2022 5 commits
  7. 14 Nov, 2022 1 commit
  8. 09 Nov, 2022 9 commits
  9. 08 Nov, 2022 2 commits
    • Mark Brown's avatar
      arm64/fpsimd: Make kernel_neon_ API _GPL · aaeca984
      Mark Brown authored
      Currently for reasons lost in the mists of time the kernel_neon_ APIs are
      EXPORT_SYMBOL() but the general policy for floating point usage is that it
      should be GPL only given the non-standard runtime environment that holds
      while it is in use and PCS impacts when code is compiled for FP usage.
      
      Given the limited existing deployment of non-GPL modules for arm64 and the
      fact that other architectures like x86 already make their equivalent
      functions GPL only this is not expected to be disruptive to existing users.
      Suggested-by: default avatarChristoph Hellwig <hch@infradead.org>
      Signed-off-by: default avatarMark Brown <broonie@kernel.org>
      Link: https://lore.kernel.org/r/20221107170747.276910-1-broonie@kernel.orgSigned-off-by: default avatarWill Deacon <will@kernel.org>
      aaeca984
    • Ard Biesheuvel's avatar
      arm64: Enable data independent timing (DIT) in the kernel · 01ab991f
      Ard Biesheuvel authored
      The ARM architecture revision v8.4 introduces a data independent timing
      control (DIT) which can be set at any exception level, and instructs the
      CPU to avoid optimizations that may result in a correlation between the
      execution time of certain instructions and the value of the data they
      operate on.
      
      The DIT bit is part of PSTATE, and is therefore context switched as
      usual, given that it becomes part of the saved program state (SPSR) when
      taking an exception. We have also defined a hwcap for DIT, and so user
      space can discover already whether or nor DIT is available. This means
      that, as far as user space is concerned, DIT is wired up and fully
      functional.
      
      In the kernel, however, we never bothered with DIT: we disable at it
      boot (i.e., INIT_PSTATE_EL1 has DIT cleared) and ignore the fact that we
      might run with DIT enabled if user space happened to set it.
      
      Currently, we have no idea whether or not running privileged code with
      DIT disabled on a CPU that implements support for it may result in a
      side channel that exposes privileged data to unprivileged user space
      processes, so let's be cautious and just enable DIT while running in the
      kernel if supported by all CPUs.
      
      Cc: Catalin Marinas <catalin.marinas@arm.com>
      Cc: Will Deacon <will@kernel.org>
      Cc: Mark Rutland <mark.rutland@arm.com>
      Cc: Marc Zyngier <maz@kernel.org>
      Cc: Eric Biggers <ebiggers@kernel.org>
      Cc: Jason A. Donenfeld <Jason@zx2c4.com>
      Cc: Kees Cook <keescook@chromium.org>
      Cc: Suzuki K Poulose <suzuki.poulose@arm.com>
      Cc: Adam Langley <agl@google.com>
      Link: https://lore.kernel.org/all/YwgCrqutxmX0W72r@gmail.com/Signed-off-by: default avatarArd Biesheuvel <ardb@kernel.org>
      Acked-by: default avatarMark Rutland <mark.rutland@arm.com>
      Link: https://lore.kernel.org/r/20221107172400.1851434-1-ardb@kernel.org
      [will: Removed cpu_has_dit() as per Mark's suggestion on the list]
      Signed-off-by: default avatarWill Deacon <will@kernel.org>
      01ab991f