Forum | Documentation | Website | Blog

Skip to content
Snippets Groups Projects
  1. Apr 08, 2022
  2. Apr 07, 2022
    • Trond Myklebust's avatar
      NFS: Ensure rpc_run_task() cannot fail in nfs_async_rename() · 88dee0cc
      Trond Myklebust authored
      Ensure the call to rpc_run_task() cannot fail by preallocating the
      rpc_task.
      
      Fixes: 910ad386
      
       ("NFS: Fix memory allocation in rpc_alloc_task()")
      Signed-off-by: default avatarTrond Myklebust <trond.myklebust@hammerspace.com>
      88dee0cc
    • Trond Myklebust's avatar
      SUNRPC: Ensure we flush any closed sockets before xs_xprt_free() · f0043206
      Trond Myklebust authored
      
      We must ensure that all sockets are closed before we call xprt_free()
      and release the reference to the net namespace. The problem is that
      calling fput() will defer closing the socket until delayed_fput() gets
      called.
      Let's fix the situation by allowing rpciod and the transport teardown
      code (which runs on the system wq) to call __fput_sync(), and directly
      close the socket.
      
      Reported-by: default avatarFelix Fu <foyjog@gmail.com>
      Acked-by: default avatarAl Viro <viro@zeniv.linux.org.uk>
      Fixes: a73881c9 ("SUNRPC: Fix an Oops in udp_poll()")
      Cc: stable@vger.kernel.org # 5.1.x: 3be232f1: SUNRPC: Prevent immediate close+reconnect
      Cc: stable@vger.kernel.org # 5.1.x: 89f42494
      
      : SUNRPC: Don't call connect() more than once on a TCP socket
      Cc: stable@vger.kernel.org # 5.1.x
      Signed-off-by: default avatarTrond Myklebust <trond.myklebust@hammerspace.com>
      f0043206
    • Chuck Lever's avatar
      SUNRPC: Fix the svc_deferred_event trace class · 4d500445
      Chuck Lever authored
      Fix a NULL deref crash that occurs when an svc_rqst is deferred
      while the sunrpc tracing subsystem is enabled. svc_revisit() sets
      dr->xprt to NULL, so it can't be relied upon in the tracepoint to
      provide the remote's address.
      
      Unfortunately we can't revert the "svc_deferred_class" hunk in
      commit ece200dd ("sunrpc: Save remote presentation address in
      svc_xprt for trace events") because there is now a specific check
      of event format specifiers for unsafe dereferences. The warning
      that check emits is:
      
        event svc_defer_recv has unsafe dereference of argument 1
      
      A "%pISpc" format specifier with a "struct sockaddr *" is indeed
      flagged by this check.
      
      Instead, take the brute-force approach used by the svcrdma_qp_error
      tracepoint. Convert the dr::addr field into a presentation address
      in the TP_fast_assign() arm of the trace event, and store that as
      a string. This fix can be backported to -stable kernels.
      
      In the meantime, commit c6ced229 ("tracing: Update print fmt
      check to handle new __get_sockaddr() macro") is now in v5.18, so
      this wonky fix can be replaced with __sockaddr() and friends
      properly during the v5.19 merge window.
      
      Fixes: ece200dd
      
       ("sunrpc: Save remote presentation address in svc_xprt for trace events")
      Signed-off-by: default avatarChuck Lever <chuck.lever@oracle.com>
      4d500445
    • Matthew Wilcox (Oracle)'s avatar
      mm: Add vma_alloc_folio() · f584b680
      Matthew Wilcox (Oracle) authored
      
      This wrapper around alloc_pages_vma() calls prep_transhuge_page(),
      removing the obligation from the caller.  This is in the same spirit
      as __folio_alloc().
      
      Signed-off-by: default avatarMatthew Wilcox (Oracle) <willy@infradead.org>
      Reviewed-by: default avatarZi Yan <ziy@nvidia.com>
      Reviewed-by: default avatarWilliam Kucharski <william.kucharski@oracle.com>
      f584b680
  3. Apr 06, 2022
    • Chuck Lever's avatar
      SUNRPC: Fix NFSD's request deferral on RDMA transports · 773f91b2
      Chuck Lever authored
      Trond Myklebust reports an NFSD crash in svc_rdma_sendto(). Further
      investigation shows that the crash occurred while NFSD was handling
      a deferred request.
      
      This patch addresses two inter-related issues that prevent request
      deferral from working correctly for RPC/RDMA requests:
      
      1. Prevent the crash by ensuring that the original
         svc_rqst::rq_xprt_ctxt value is available when the request is
         revisited. Otherwise svc_rdma_sendto() does not have a Receive
         context available with which to construct its reply.
      
      2. Possibly since before commit 71641d99
      
       ("svcrdma: Properly
         compute .len and .buflen for received RPC Calls"),
         svc_rdma_recvfrom() did not include the transport header in the
         returned xdr_buf. There should have been no need for svc_defer()
         and friends to save and restore that header, as of that commit.
         This issue is addressed in a backport-friendly way by simply
         having svc_rdma_recvfrom() set rq_xprt_hlen to zero
         unconditionally, just as svc_tcp_recvfrom() does. This enables
         svc_deferred_recv() to correctly reconstruct an RPC message
         received via RPC/RDMA.
      
      Reported-by: default avatarTrond Myklebust <trondmy@hammerspace.com>
      Link: https://lore.kernel.org/linux-nfs/82662b7190f26fb304eb0ab1bb04279072439d4e.camel@hammerspace.com/
      
      
      Signed-off-by: default avatarChuck Lever <chuck.lever@oracle.com>
      Cc: <stable@vger.kernel.org>
      773f91b2
    • Steve Capper's avatar
      tlb: hugetlb: Add more sizes to tlb_remove_huge_tlb_entry · 697a1d44
      Steve Capper authored
      
      tlb_remove_huge_tlb_entry only considers PMD_SIZE and PUD_SIZE when
      updating the mmu_gather structure.
      
      Unfortunately on arm64 there are two additional huge page sizes that
      need to be covered: CONT_PTE_SIZE and CONT_PMD_SIZE. Where an end-user
      attempts to employ contiguous huge pages, a VM_BUG_ON can be experienced
      due to the fact that the tlb structure hasn't been correctly updated by
      the relevant tlb_flush_p.._range() call from tlb_remove_huge_tlb_entry.
      
      This patch adds inequality logic to the generic implementation of
      tlb_remove_huge_tlb_entry s.t. CONT_PTE_SIZE and CONT_PMD_SIZE are
      effectively covered on arm64. Also, as well as ptes, pmds and puds;
      p4ds are now considered too.
      
      Reported-by: default avatarDavid Hildenbrand <david@redhat.com>
      Suggested-by: default avatarPeter Zijlstra (Intel) <peterz@infradead.org>
      Cc: Anshuman Khandual <anshuman.khandual@arm.com>
      Cc: Catalin Marinas <catalin.marinas@arm.com>
      Cc: Will Deacon <will@kernel.org>
      Link: https://lore.kernel.org...
      697a1d44
  4. Apr 05, 2022
  5. Apr 04, 2022
  6. Apr 02, 2022
  7. Apr 01, 2022
  8. Mar 31, 2022
  9. Mar 30, 2022
    • Martin KaFai Lau's avatar
      bpf: Resolve to prog->aux->dst_prog->type only for BPF_PROG_TYPE_EXT · 4a9c7bbe
      Martin KaFai Lau authored
      The commit 7e40781c ("bpf: verifier: Use target program's type for access verifications")
      fixes the verifier checking for BPF_PROG_TYPE_EXT (extension)
      prog such that the verifier looks for things based
      on the target prog type that it is extending instead of
      the BPF_PROG_TYPE_EXT itself.
      
      The current resolve_prog_type() returns the target prog type.
      It checks for nullness on prog->aux->dst_prog.  However,
      when loading a BPF_PROG_TYPE_TRACING prog and it is tracing another
      bpf prog instead of a kernel function, prog->aux->dst_prog is not
      NULL also.  In this case, the verifier should still verify as the
      BPF_PROG_TYPE_TRACING type instead of the traced prog type in
      prog->aux->dst_prog->type.
      
      An oops has been reported when tracing a struct_ops prog.  A NULL
      dereference happened in check_return_code() when accessing the
      prog->aux->attach_func_proto->type and prog->aux->attach_func_proto
      is NULL here because the traced struct_ops prog has the "unreliable" set.
      
      This patch is to change the resolve_prog_type() to only
      return the target prog type if the prog being verified is
      BPF_PROG_TYPE_EXT.
      
      Fixes: 7e40781c
      
       ("bpf: verifier: Use target program's type for access verifications")
      Signed-off-by: default avatarMartin KaFai Lau <kafai@fb.com>
      Signed-off-by: default avatarAlexei Starovoitov <ast@kernel.org>
      Acked-by: default avatarYonghong Song <yhs@fb.com>
      Link: https://lore.kernel.org/bpf/20220330011456.2984509-1-kafai@fb.com
      4a9c7bbe
    • Carlos Llamas's avatar
      loop: fix ioctl calls using compat_loop_info · f941c51e
      Carlos Llamas authored
      Support for cryptoloop was deleted in commit 47e96246 ("block:
      remove support for cryptoloop and the xor transfer"), making the usage
      of loop_info->lo_encrypt_type obsolete. However, this member was also
      removed from the compat_loop_info definition and this breaks userspace
      ioctl calls for 32-bit binaries and CONFIG_COMPAT=y.
      
      This patch restores the compat_loop_info->lo_encrypt_type member and
      marks it obsolete as well as in the uapi header definitions.
      
      Fixes: 47e96246
      
       ("block: remove support for cryptoloop and the xor transfer")
      Signed-off-by: default avatarCarlos Llamas <cmllamas@google.com>
      Reviewed-by: default avatarChristoph Hellwig <hch@lst.de>
      Link: https://lore.kernel.org/r/20220329201815.1347500-1-cmllamas@google.com
      
      
      Signed-off-by: default avatarJens Axboe <axboe@kernel.dk>
      f941c51e
    • Takashi Iwai's avatar
      ALSA: pcm: Fix potential AB/BA lock with buffer_mutex and mmap_lock · bc55cfd5
      Takashi Iwai authored
      syzbot caught a potential deadlock between the PCM
      runtime->buffer_mutex and the mm->mmap_lock.  It was brought by the
      recent fix to cover the racy read/write and other ioctls, and in that
      commit, I overlooked a (hopefully only) corner case that may take the
      revert lock, namely, the OSS mmap.  The OSS mmap operation
      exceptionally allows to re-configure the parameters inside the OSS
      mmap syscall, where mm->mmap_mutex is already held.  Meanwhile, the
      copy_from/to_user calls at read/write operations also take the
      mm->mmap_lock internally, hence it may lead to a AB/BA deadlock.
      
      A similar problem was already seen in the past and we fixed it with a
      refcount (in commit b2483716
      
      ).  The former fix covered only the
      call paths with OSS read/write and OSS ioctls, while we need to cover
      the concurrent access via both ALSA and OSS APIs now.
      
      This patch addresses the problem above by replacing the buffer_mutex
      lock in the read/write operations with a refcount similar as we've
      used for OSS.  The new field, runtime->buffer_accessing, keeps the
      number of concurrent read/write operations.  Unlike the former
      buffer_mutex protection, this protects only around the
      copy_from/to_user() calls; the other codes are basically protected by
      the PCM stream lock.  The refcount can be a negative, meaning blocked
      by the ioctls.  If a negative value is seen, the read/write aborts
      with -EBUSY.  In the ioctl side, OTOH, they check this refcount, too,
      and set to a negative value for blocking unless it's already being
      accessed.
      
      Reported-by: default avatar <syzbot+6e5c88838328e99c7e1c@syzkaller.appspotmail.com>
      Fixes: dca947d4 ("ALSA: pcm: Fix races among concurrent read/write and buffer changes")
      Cc: <stable@vger.kernel.org>
      Link: https://lore.kernel.org/r/000000000000381a0d05db622a81@google.com
      Link: https://lore.kernel.org/r/20220330120903.4738-1-tiwai@suse.de
      
      
      Signed-off-by: default avatarTakashi Iwai <tiwai@suse.de>
      bc55cfd5