1. 24 Nov, 2022 1 commit
    • Christophe Leroy's avatar
      powerpc/bpf/32: Fix Oops on tail call tests · 89d21e25
      Christophe Leroy authored
      test_bpf tail call tests end up as:
      
        test_bpf: #0 Tail call leaf jited:1 85 PASS
        test_bpf: #1 Tail call 2 jited:1 111 PASS
        test_bpf: #2 Tail call 3 jited:1 145 PASS
        test_bpf: #3 Tail call 4 jited:1 170 PASS
        test_bpf: #4 Tail call load/store leaf jited:1 190 PASS
        test_bpf: #5 Tail call load/store jited:1
        BUG: Unable to handle kernel data access on write at 0xf1b4e000
        Faulting instruction address: 0xbe86b710
        Oops: Kernel access of bad area, sig: 11 [#1]
        BE PAGE_SIZE=4K MMU=Hash PowerMac
        Modules linked in: test_bpf(+)
        CPU: 0 PID: 97 Comm: insmod Not tainted 6.1.0-rc4+ #195
        Hardware name: PowerMac3,1 750CL 0x87210 PowerMac
        NIP:  be86b710 LR: be857e88 CTR: be86b704
        REGS: f1b4df20 TRAP: 0300   Not tainted  (6.1.0-rc4+)
        MSR:  00009032 <EE,ME,IR,DR,RI>  CR: 28008242  XER: 00000000
        DAR: f1b4e000 DSISR: 42000000
        GPR00: 00000001 f1b4dfe0 c11d2280 00000000 00000000 00000000 00000002 00000000
        GPR08: f1b4e000 be86b704 f1b4e000 00000000 00000000 100d816a f2440000 fe73baa8
        GPR16: f2458000 00000000 c1941ae4 f1fe2248 00000045 c0de0000 f2458030 00000000
        GPR24: 000003e8 0000000f f2458000 f1b4dc90 3e584b46 00000000 f24466a0 c1941a00
        NIP [be86b710] 0xbe86b710
        LR [be857e88] __run_one+0xec/0x264 [test_bpf]
        Call Trace:
        [f1b4dfe0] [00000002] 0x2 (unreliable)
        Instruction dump:
        XXXXXXXX XXXXXXXX XXXXXXXX XXXXXXXX XXXXXXXX XXXXXXXX XXXXXXXX XXXXXXXX
        XXXXXXXX XXXXXXXX XXXXXXXX XXXXXXXX XXXXXXXX XXXXXXXX XXXXXXXX XXXXXXXX
        ---[ end trace 0000000000000000 ]---
      
      This is a tentative to write above the stack. The problem is encoutered
      with tests added by commit 38608ee7 ("bpf, tests: Add load store
      test case for tail call")
      
      This happens because tail call is done to a BPF prog with a different
      stack_depth. At the time being, the stack is kept as is when the caller
      tail calls its callee. But at exit, the callee restores the stack based
      on its own properties. Therefore here, at each run, r1 is erroneously
      increased by 32 - 16 = 16 bytes.
      
      This was done that way in order to pass the tail call count from caller
      to callee through the stack. As powerpc32 doesn't have a red zone in
      the stack, it was necessary the maintain the stack as is for the tail
      call. But it was not anticipated that the BPF frame size could be
      different.
      
      Let's take a new approach. Use register r4 to carry the tail call count
      during the tail call, and save it into the stack at function entry if
      required. This means the input parameter must be in r3, which is more
      correct as it is a 32 bits parameter, then tail call better match with
      normal BPF function entry, the down side being that we move that input
      parameter back and forth between r3 and r4. That can be optimised later.
      
      Doing that also has the advantage of maximising the common parts between
      tail calls and a normal function exit.
      
      With the fix, tail call tests are now successfull:
      
        test_bpf: #0 Tail call leaf jited:1 53 PASS
        test_bpf: #1 Tail call 2 jited:1 115 PASS
        test_bpf: #2 Tail call 3 jited:1 154 PASS
        test_bpf: #3 Tail call 4 jited:1 165 PASS
        test_bpf: #4 Tail call load/store leaf jited:1 101 PASS
        test_bpf: #5 Tail call load/store jited:1 141 PASS
        test_bpf: #6 Tail call error path, max count reached jited:1 994 PASS
        test_bpf: #7 Tail call count preserved across function calls jited:1 140975 PASS
        test_bpf: #8 Tail call error path, NULL target jited:1 110 PASS
        test_bpf: #9 Tail call error path, index out of range jited:1 69 PASS
        test_bpf: test_tail_calls: Summary: 10 PASSED, 0 FAILED, [10/10 JIT'ed]
      Suggested-by: default avatarNaveen N. Rao <naveen.n.rao@linux.vnet.ibm.com>
      Fixes: 51c66ad8 ("powerpc/bpf: Implement extended BPF on PPC32")
      Cc: stable@vger.kernel.org
      Signed-off-by: default avatarChristophe Leroy <christophe.leroy@csgroup.eu>
      Tested-by: Naveen N. Rao <naveen.n.rao@linux.vnet.ibm.com
      Signed-off-by: default avatarMichael Ellerman <mpe@ellerman.id.au>
      Link: https://lore.kernel.org/r/757acccb7fbfc78efa42dcf3c974b46678198905.1669278887.git.christophe.leroy@csgroup.eu
      89d21e25
  2. 16 Nov, 2022 1 commit
  3. 01 Nov, 2022 1 commit
    • Michael Ellerman's avatar
      powerpc/32: Select ARCH_SPLIT_ARG64 · 02a771c9
      Michael Ellerman authored
      On 32-bit kernels, 64-bit syscall arguments are split into two
      registers. For that to work with syscall wrappers, the prototype of the
      syscall must have the argument split so that the wrapper macro properly
      unpacks the arguments from pt_regs.
      
      The fanotify_mark() syscall is one such syscall, which already has a
      split prototype, guarded behind ARCH_SPLIT_ARG64.
      
      So select ARCH_SPLIT_ARG64 to get that prototype and fix fanotify_mark()
      on 32-bit kernels with syscall wrappers.
      
      Note also that fanotify_mark() is the only usage of ARCH_SPLIT_ARG64.
      
      Fixes: 7e92e01b ("powerpc: Provide syscall wrapper")
      Signed-off-by: default avatarMichael Ellerman <mpe@ellerman.id.au>
      Link: https://lore.kernel.org/r/20221101034852.2340319-1-mpe@ellerman.id.au
      02a771c9
  4. 31 Oct, 2022 4 commits
  5. 26 Oct, 2022 1 commit
    • Nicholas Piggin's avatar
      powerpc/64s/interrupt: Fix clear of PACA_IRQS_HARD_DIS when returning to soft-masked context · 65722736
      Nicholas Piggin authored
      Commit a4cb3651 ("powerpc/64s/interrupt: Fix lost interrupts when
      returning to soft-masked context") fixed the problem of pending irqs
      being cleared when clearing the HARD_DIS bit, but then it didn't clear
      the bit at all. This change clears HARD_DIS without affecting other bits
      in the mask.
      
      When an interrupt hits in a soft-masked section that has MSR[EE]=1, it
      can hard disable and set PACA_IRQS_HARD_DIS, which must be cleared when
      returning to the EE=1 caller (unless it was set due to a MUST_HARD_MASK
      interrupt becoming pending). Failure to clear this leaves the
      returned-to context running with MSR[EE]=1 and PACA_IRQS_HARD_DIS, which
      confuses irq assertions and could be dangerous for code that might test
      the flag.
      
      This was observed in a hash MMU kernel where a kernel hash fault hits in
      a local_irqs_disabled region that has EE=1. The hash fault also runs
      with EE=1, then as it returns, a decrementer hits in the restart section
      and the irq restart code hard-masks which sets the PACA_IRQ_HARD_DIS
      flag, which is not clear when the original context is returned to.
      Reported-by: default avatarSachin Sant <sachinp@linux.ibm.com>
      Fixes: a4cb3651 ("powerpc/64s/interrupt: Fix lost interrupts when returning to soft-masked context")
      Signed-off-by: default avatarNicholas Piggin <npiggin@gmail.com>
      Tested-by: default avatarSachin Sant <sachinp@linux.ibm.com>
      Signed-off-by: default avatarMichael Ellerman <mpe@ellerman.id.au>
      Link: https://lore.kernel.org/r/20221022052207.471328-1-npiggin@gmail.com
      65722736
  6. 23 Oct, 2022 9 commits
  7. 22 Oct, 2022 21 commits
  8. 21 Oct, 2022 2 commits
    • Linus Torvalds's avatar
      Merge tag '6.1-rc1-smb3-fixes' of git://git.samba.org/sfrench/cifs-2.6 · bd8e9634
      Linus Torvalds authored
      Pull cifs fixes from Steve French:
      
       - memory leak fixes
      
       - fixes for directory leases, including an important one which fixes a
         problem noticed by git functional tests
      
       - fixes relating to missing free_xid calls (helpful for
         tracing/debugging of entry/exit into cifs.ko)
      
       - a multichannel fix
      
       - a small cleanup fix (use of list_move instead of list_del/list_add)
      
      * tag '6.1-rc1-smb3-fixes' of git://git.samba.org/sfrench/cifs-2.6:
        cifs: update internal module number
        cifs: fix memory leaks in session setup
        cifs: drop the lease for cached directories on rmdir or rename
        smb3: interface count displayed incorrectly
        cifs: Fix memory leak when build ntlmssp negotiate blob failed
        cifs: set rc to -ENOENT if we can not get a dentry for the cached dir
        cifs: use LIST_HEAD() and list_move() to simplify code
        cifs: Fix xid leak in cifs_get_file_info_unix()
        cifs: Fix xid leak in cifs_ses_add_channel()
        cifs: Fix xid leak in cifs_flock()
        cifs: Fix xid leak in cifs_copy_file_range()
        cifs: Fix xid leak in cifs_create()
      bd8e9634
    • Linus Torvalds's avatar
      Merge tag 'nfsd-6.1-2' of git://git.kernel.org/pub/scm/linux/kernel/git/cel/linux · 022c028f
      Linus Torvalds authored
      Pull nfsd fixes from Chuck Lever:
       "Fixes for patches merged in v6.1"
      
      * tag 'nfsd-6.1-2' of git://git.kernel.org/pub/scm/linux/kernel/git/cel/linux:
        nfsd: ensure we always call fh_verify_error tracepoint
        NFSD: unregister shrinker when nfsd_init_net() fails
      022c028f