1. Oct 22, 2022
    • Hou Tao's avatar
      bpf: Use __llist_del_all() whenever possbile during memory draining · fa4447cb
      Hou Tao authored
      
      
      Except for waiting_for_gp list, there are no concurrent operations on
      free_by_rcu, free_llist and free_llist_extra lists, so use
      __llist_del_all() instead of llist_del_all(). waiting_for_gp list can be
      deleted by RCU callback concurrently, so still use llist_del_all().
      
      Acked-by: default avatarStanislav Fomichev <sdf@google.com>
      Signed-off-by: default avatarHou Tao <houtao1@huawei.com>
      Link: https://lore.kernel.org/r/20221021114913.60508-3-houtao@huaweicloud.com
      
      
      Signed-off-by: default avatarAlexei Starovoitov <ast@kernel.org>
      fa4447cb
    • Hou Tao's avatar
      bpf: Wait for busy refill_work when destroying bpf memory allocator · 3d058187
      Hou Tao authored
      A busy irq work is an unfinished irq work and it can be either in the
      pending state or in the running state. When destroying bpf memory
      allocator, refill_work may be busy for PREEMPT_RT kernel in which irq
      work is invoked in a per-CPU RT-kthread. It is also possible for kernel
      with arch_irq_work_has_interrupt() being false (e.g. 1-cpu arm32 host or
      mips) and irq work is inovked in timer interrupt.
      
      The busy refill_work leads to various issues. The obvious one is that
      there will be concurrent operations on free_by_rcu and free_list between
      irq work and memory draining. Another one is call_rcu_in_progress will
      not be reliable for the checking of pending RCU callback because
      do_call_rcu() may have not been invoked by irq work yet. The other is
      there will be use-after-free if irq work is freed before the callback
      of irq work is invoked as shown below:
      
       BUG: kernel NULL pointer dereference, address: 0000000000000000
       #PF: supervisor instruction fetch in kernel mode
       #PF: error_code(0x0010) - not-present page
       PGD 12ab94067 P4D 12ab94067 PUD 1796b4067 PMD 0
       Oops: 0010 [#1] PREEMPT_RT SMP
       CPU: 5 PID: 64 Comm: irq_work/5 Not tainted 6.0.0-rt11+ #1
       Hardware name: QEMU Standard PC (i440FX + PIIX, 1996)
       RIP: 0010:0x0
       Code: Unable to access opcode bytes at 0xffffffffffffffd6.
       RSP: 0018:ffffadc080293e78 EFLAGS: 00010286
       RAX: 0000000000000000 RBX: ffffcdc07fb6a388 RCX: ffffa05000a2e000
       RDX: ffffa05000a2e000 RSI: ffffffff96cc9827 RDI: ffffcdc07fb6a388
       ......
       Call Trace:
        <TASK>
        irq_work_single+0x24/0x60
        irq_work_run_list+0x24/0x30
        run_irq_workd+0x23/0x30
        smpboot_thread_fn+0x203/0x300
        kthread+0x126/0x150
        ret_from_fork+0x1f/0x30
        </TASK>
      
      Considering the ease of concurrency handling, no overhead for
      irq_work_sync() under non-PREEMPT_RT kernel and has-irq-work-interrupt
      kernel and the short wait time used for irq_work_sync() under PREEMPT_RT
      (When running two test_maps on PREEMPT_RT kernel and 72-cpus host, the
      max wait time is about 8ms and the 99th percentile is 10us), just using
      irq_work_sync() to wait for busy refill_work to complete before memory
      draining and memory freeing.
      
      Fixes: 7c8199e2
      
       ("bpf: Introduce any context BPF specific memory allocator.")
      Acked-by: default avatarStanislav Fomichev <sdf@google.com>
      Signed-off-by: default avatarHou Tao <houtao1@huawei.com>
      Link: https://lore.kernel.org/r/20221021114913.60508-2-houtao@huaweicloud.com
      
      
      Signed-off-by: default avatarAlexei Starovoitov <ast@kernel.org>
      3d058187
  2. Oct 21, 2022
  3. Oct 18, 2022
    • Stanislav Fomichev's avatar
      bpf: prevent decl_tag from being referenced in func_proto · ea68376c
      Stanislav Fomichev authored
      Syzkaller was able to hit the following issue:
      
      ------------[ cut here ]------------
      WARNING: CPU: 0 PID: 3609 at kernel/bpf/btf.c:1946
      btf_type_id_size+0x2d5/0x9d0 kernel/bpf/btf.c:1946
      Modules linked in:
      CPU: 0 PID: 3609 Comm: syz-executor361 Not tainted
      6.0.0-syzkaller-02734-g0326074f #0
      Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS
      Google 09/22/2022
      RIP: 0010:btf_type_id_size+0x2d5/0x9d0 kernel/bpf/btf.c:1946
      Code: ef e8 7f 8e e4 ff 41 83 ff 0b 77 28 f6 44 24 10 18 75 3f e8 6d 91
      e4 ff 44 89 fe bf 0e 00 00 00 e8 20 8e e4 ff e8 5b 91 e4 ff <0f> 0b 45
      31 f6 e9 98 02 00 00 41 83 ff 12 74 18 e8 46 91 e4 ff 44
      RSP: 0018:ffffc90003cefb40 EFLAGS: 00010293
      RAX: 0000000000000000 RBX: 0000000000000002 RCX: 0000000000000000
      RDX: ffff8880259c0000 RSI: ffffffff81968415 RDI: 0000000000000005
      RBP: ffff88801270ca00 R08: 0000000000000005 R09: 000000000000000e
      R10: 0000000000000011 R11: 0000000000000000 R12: 0000000000000000
      R13: 0000000000000011 R14: ffff888026ee6424 R15: 0000000000000011
      FS:  000055555641b300(0000) GS:ffff8880b9a00000(0000)
      knlGS:0000000000000000
      CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
      CR2: 0000000000f2e258 CR3: 000000007110e000 CR4: 00000000003506f0
      DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000
      DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400
      Call Trace:
       <TASK>
       btf_func_proto_check kernel/bpf/btf.c:4447 [inline]
       btf_check_all_types kernel/bpf/btf.c:4723 [inline]
       btf_parse_type_sec kernel/bpf/btf.c:4752 [inline]
       btf_parse kernel/bpf/btf.c:5026 [inline]
       btf_new_fd+0x1926/0x1e70 kernel/bpf/btf.c:6892
       bpf_btf_load kernel/bpf/syscall.c:4324 [inline]
       __sys_bpf+0xb7d/0x4cf0 kernel/bpf/syscall.c:5010
       __do_sys_bpf kernel/bpf/syscall.c:5069 [inline]
       __se_sys_bpf kernel/bpf/syscall.c:5067 [inline]
       __x64_sys_bpf+0x75/0xb0 kernel/bpf/syscall.c:5067
       do_syscall_x64 arch/x86/entry/common.c:50 [inline]
       do_syscall_64+0x35/0xb0 arch/x86/entry/common.c:80
       entry_SYSCALL_64_after_hwframe+0x63/0xcd
      RIP: 0033:0x7f0fbae41c69
      Code: 28 c3 e8 2a 14 00 00 66 2e 0f 1f 84 00 00 00 00 00 48 89 f8 48 89
      f7 48 89 d6 48 89 ca 4d 89 c2 4d 89 c8 4c 8b 4c 24 08 0f 05 <48> 3d 01
      f0 ff ff 73 01 c3 48 c7 c1 c0 ff ff ff f7 d8 64 89 01 48
      RSP: 002b:00007ffc8aeb6228 EFLAGS: 00000246 ORIG_RAX: 0000000000000141
      RAX: ffffffffffffffda RBX: 0000000000000000 RCX: 00007f0fbae41c69
      RDX: 0000000000000020 RSI: 0000000020000140 RDI: 0000000000000012
      RBP: 00007f0fbae05e10 R08: 0000000000000000 R09: 0000000000000000
      R10: 00000000ffffffff R11: 0000000000000246 R12: 00007f0fbae05ea0
      R13: 0000000000000000 R14: 0000000000000000 R15: 0000000000000000
       </TASK>
      
      Looks like it tries to create a func_proto which return type is
      decl_tag. For the details, see Martin's spot on analysis in [0].
      
      0: https://lore.kernel.org/bpf/CAKH8qBuQDLva_hHxxBuZzyAcYNO4ejhovz6TQeVSk8HY-2SO6g@mail.gmail.com/T/#mea6524b3fcd6298347432226e81b1e6155efc62c
      
      Cc: Yonghong Song <yhs@fb.com>
      Cc: Martin KaFai Lau <martin.lau@kernel.org>
      Fixes: bd16dee6
      
       ("bpf: Add BTF_KIND_DECL_TAG typedef support")
      Reported-by: default avatar <syzbot+d8bd751aef7c6b39a344@syzkaller.appspotmail.com>
      Signed-off-by: default avatarStanislav Fomichev <sdf@google.com>
      Acked-by: default avatarYonghong Song <yhs@fb.com>
      Link: https://lore.kernel.org/r/20221015002444.2680969-2-sdf@google.com
      
      
      Signed-off-by: default avatarMartin KaFai Lau <martin.lau@kernel.org>
      ea68376c
    • Stanislav Fomichev's avatar
      selftests/bpf: Add reproducer for decl_tag in func_proto return type · 35cc9d62
      Stanislav Fomichev authored
      
      
      It should trigger a WARN_ON_ONCE in btf_type_id_size.
      
           btf_func_proto_check kernel/bpf/btf.c:4447 [inline]
           btf_check_all_types kernel/bpf/btf.c:4723 [inline]
           btf_parse_type_sec kernel/bpf/btf.c:4752 [inline]
           btf_parse kernel/bpf/btf.c:5026 [inline]
           btf_new_fd+0x1926/0x1e70 kernel/bpf/btf.c:6892
           bpf_btf_load kernel/bpf/syscall.c:4324 [inline]
           __sys_bpf+0xb7d/0x4cf0 kernel/bpf/syscall.c:5010
           __do_sys_bpf kernel/bpf/syscall.c:5069 [inline]
           __se_sys_bpf kernel/bpf/syscall.c:5067 [inline]
           __x64_sys_bpf+0x75/0xb0 kernel/bpf/syscall.c:5067
           do_syscall_x64 arch/x86/entry/common.c:50 [inline]
           do_syscall_64+0x35/0xb0 arch/x86/entry/common.c:80
           entry_SYSCALL_64_after_hwframe+0x63/0xcd
      
      Cc: Yonghong Song <yhs@fb.com>
      Cc: Martin KaFai Lau <martin.lau@kernel.org>
      Signed-off-by: default avatarStanislav Fomichev <sdf@google.com>
      Acked-by: default avatarYonghong Song <yhs@fb.com>
      Link: https://lore.kernel.org/r/20221015002444.2680969-1-sdf@google.com
      
      
      Signed-off-by: default avatarMartin KaFai Lau <martin.lau@kernel.org>
      35cc9d62
  4. Oct 13, 2022
    • Andrii Nakryiko's avatar
      Merge branch 'Allow bpf_user_ringbuf_drain() callbacks to return 1' · e7b09357
      Andrii Nakryiko authored
      David Vernet says:
      
      ====================
      The bpf_user_ringbuf_drain() helper function allows a BPF program to
      specify a callback that is invoked when draining entries from a
      BPF_MAP_TYPE_USER_RINGBUF ring buffer map. The API is meant to allow the
      callback to return 0 if it wants to continue draining samples, and 1 if
      it's done draining. Unfortunately, bpf_user_ringbuf_drain() landed shortly
      after commit 1bfe26fb
      
       ("bpf: Add verifier support for custom
      callback return range"), which changed the default behavior of callbacks
      to only support returning 0, and the corresponding necessary change to
      bpf_user_ringbuf_drain() callbacks was missed.
      
      This patch set fixes this oversight, and updates the user_ringbuf
      selftests to return 1 in a callback to catch future instances of
      regression.
      ====================
      
      Signed-off-by: default avatarAndrii Nakryiko <andrii@kernel.org>
      e7b09357
    • David Vernet's avatar
      selftests/bpf: Make bpf_user_ringbuf_drain() selftest callback return 1 · 6e44b9f3
      David Vernet authored
      In commit 1bfe26fb ("bpf: Add verifier support for custom callback
      return range"), the verifier was updated to require callbacks to BPF
      helpers to explicitly specify the range of values that can be returned.
      bpf_user_ringbuf_drain() was merged after this in commit 20571567
      
      
      ("bpf: Add bpf_user_ringbuf_drain() helper"), and this change in default
      behavior was missed. This patch updates the BPF_MAP_TYPE_USER_RINGBUF
      selftests to also return 1 from a bpf_user_ringbuf_drain() callback so
      as to properly test this going forward.
      
      Signed-off-by: default avatarDavid Vernet <void@manifault.com>
      Signed-off-by: default avatarAndrii Nakryiko <andrii@kernel.org>
      Link: https://lore.kernel.org/bpf/20221012232015.1510043-3-void@manifault.com
      6e44b9f3
    • David Vernet's avatar
      bpf: Allow bpf_user_ringbuf_drain() callbacks to return 1 · c92a7a52
      David Vernet authored
      The bpf_user_ringbuf_drain() helper function allows a BPF program to
      specify a callback that is invoked when draining entries from a
      BPF_MAP_TYPE_USER_RINGBUF ring buffer map. The API is meant to allow the
      callback to return 0 if it wants to continue draining samples, and 1 if
      it's done draining. Unfortunately, bpf_user_ringbuf_drain() landed shortly
      after commit 1bfe26fb ("bpf: Add verifier support for custom
      callback return range"), which changed the default behavior of callbacks
      to only support returning 0.
      
      This patch corrects that oversight by allowing bpf_user_ringbuf_drain()
      callbacks to return 0 or 1. A follow-on patch will update the
      user_ringbuf selftests to also return 1 from a bpf_user_ringbuf_drain()
      callback to prevent this from regressing in the future.
      
      Fixes: 20571567
      
       ("bpf: Add bpf_user_ringbuf_drain() helper")
      Signed-off-by: default avatarDavid Vernet <void@manifault.com>
      Signed-off-by: default avatarAndrii Nakryiko <andrii@kernel.org>
      Link: https://lore.kernel.org/bpf/20221012232015.1510043-2-void@manifault.com
      c92a7a52
  5. Oct 05, 2022
  6. Oct 04, 2022
    • Linus Torvalds's avatar
      Merge tag 'edac_updates_for_v6.1' of git://git.kernel.org/pub/scm/linux/kernel/git/ras/ras · bf767625
      Linus Torvalds authored
      Pull EDAC updates from Borislav Petkov:
      
       - Add support for Skylake-S CPUs to ie31200_edac
      
       - Improve error decoding speed of the Intel drivers by avoiding the
         ACPI facilities but doing decoding in the driver itself
      
       - Other misc improvements to the Intel drivers
      
       - The usual cleanups and fixlets all over EDAC land
      
      * tag 'edac_updates_for_v6.1' of git://git.kernel.org/pub/scm/linux/kernel/git/ras/ras:
        EDAC/i7300: Correct the i7300_exit() function name in comment
        x86/sb_edac: Add row column translation for Broadwell
        EDAC/i10nm: Print an extra register set of retry_rd_err_log
        EDAC/i10nm: Retrieve and print retry_rd_err_log registers for HBM
        EDAC/skx_common: Add ChipSelect ADXL component
        EDAC/ppc_4xx: Reorder symbols to get rid of a few forward declarations
        EDAC: Remove obsolete declarations in edac_module.h
        EDAC/i10nm: Add driver decoder for Ice Lake and Tremont CPUs
        EDAC/skx_common: Make output format similar
        EDAC/skx_common: Use driver decoder first
        EDAC/mc: Drop duplicated dimm->nr_pages debug printout
        EDAC/mc: Replace spaces with tabs in memtype flags definition
        EDAC/wq: Remove unneeded flush_workqueue()
        EDAC/ie31200: Add Skylake-S support
      bf767625
    • Borislav Petkov's avatar
      Merge branches 'edac-drivers' and 'edac-misc' into edac-updates-for-v6.1 · c2577956
      Borislav Petkov authored
      
      
      Combine all queued EDAC changes for submission into v6.1:
      
      * edac-drivers:
        EDAC/ie31200: Add Skylake-S support
      
      * edac-misc:
        EDAC/i7300: Correct the i7300_exit() function name in comment
        x86/sb_edac: Add row column translation for Broadwell
        EDAC/i10nm: Print an extra register set of retry_rd_err_log
        EDAC/i10nm: Retrieve and print retry_rd_err_log registers for HBM
        EDAC/skx_common: Add ChipSelect ADXL component
        EDAC/ppc_4xx: Reorder symbols to get rid of a few forward declarations
        EDAC: Remove obsolete declarations in edac_module.h
        EDAC/i10nm: Add driver decoder for Ice Lake and Tremont CPUs
        EDAC/skx_common: Make output format similar
        EDAC/skx_common: Use driver decoder first
        EDAC/mc: Drop duplicated dimm->nr_pages debug printout
        EDAC/mc: Replace spaces with tabs in memtype flags definition
        EDAC/wq: Remove unneeded flush_workqueue()
      
      Signed-off-by: default avatarBorislav Petkov <bp@suse.de>
      c2577956
    • Jakub Kicinski's avatar
      eth: pse: add missing static inlines · 681bf011
      Jakub Kicinski authored
      
      
      build bot reports missing 'static inline' qualifiers in the header.
      
      Reported-by: default avatarkernel test robot <lkp@intel.com>
      Fixes: 18ff0bcd
      
       ("ethtool: add interface to interact with Ethernet Power Equipment")
      Reviewed-by: default avatarOleksij Rempel <o.rempel@pengutronix.de>
      Link: https://lore.kernel.org/r/20221004040327.2034878-1-kuba@kernel.org
      
      
      Signed-off-by: default avatarJakub Kicinski <kuba@kernel.org>
      681bf011
    • Linus Torvalds's avatar
      Merge tag 'statx-dioalign-for-linus' of... · 725737e7
      Linus Torvalds authored
      Merge tag 'statx-dioalign-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/ebiggers/linux
      
      Pull STATX_DIOALIGN support from Eric Biggers:
       "Make statx() support reporting direct I/O (DIO) alignment information.
      
        This provides a generic interface for userspace programs to determine
        whether a file supports DIO, and if so with what alignment
        restrictions. Specifically, STATX_DIOALIGN works on block devices, and
        on regular files when their containing filesystem has implemented
        support.
      
        An interface like this has been requested for years, since the
        conditions for when DIO is supported in Linux have gotten increasingly
        complex over time. Today, DIO support and alignment requirements can
        be affected by various filesystem features such as multi-device
        support, data journalling, inline data, encryption, verity,
        compression, checkpoint disabling, log-structured mode, etc.
      
        Further complicating things, Linux v6.0 relaxed the traditional rule
        of DIO needing to be aligned to the bl...
      725737e7
    • Linus Torvalds's avatar
      Merge tag 'fsverity-for-linus' of git://git.kernel.org/pub/scm/fs/fscrypt/fscrypt · 5779aa2d
      Linus Torvalds authored
      Pull fsverity updates from Eric Biggers:
       "Minor changes to convert uses of kmap() to kmap_local_page()"
      
      * tag 'fsverity-for-linus' of git://git.kernel.org/pub/scm/fs/fscrypt/fscrypt:
        fs-verity: use kmap_local_page() instead of kmap()
        fs-verity: use memcpy_from_page()
      5779aa2d
    • Linus Torvalds's avatar
      Merge tag 'fscrypt-for-linus' of git://git.kernel.org/pub/scm/fs/fscrypt/fscrypt · 438b2cdd
      Linus Torvalds authored
      Pull fscrypt updates from Eric Biggers:
       "This release contains some implementation changes, but no new
        features:
      
         - Rework the implementation of the fscrypt filesystem-level keyring
           to not be as tightly coupled to the keyrings subsystem. This
           resolves several issues.
      
         - Eliminate most direct uses of struct request_queue from fs/crypto/,
           since struct request_queue is considered to be a block layer
           implementation detail.
      
         - Stop using the PG_error flag to track decryption failures. This is
           a prerequisite for freeing up PG_error for other uses"
      
      * tag 'fscrypt-for-linus' of git://git.kernel.org/pub/scm/fs/fscrypt/fscrypt:
        fscrypt: work on block_devices instead of request_queues
        fscrypt: stop holding extra request_queue references
        fscrypt: stop using keyrings subsystem for fscrypt_master_key
        fscrypt: stop using PG_error to track error status
        fscrypt: remove fscrypt_set_test_dummy_encryption()
      438b2cdd
    • Linus Torvalds's avatar
      Merge tag 'dlm-6.1' of git://git.kernel.org/pub/scm/linux/kernel/git/teigland/linux-dlm · f4309528
      Linus Torvalds authored
      Pull dlm updates from David Teigland:
      
       - Fix a couple races found with a new torture test
      
       - Improve errors when api functions are used incorrectly
      
       - Improve tracing for lock requests from user space
      
       - Fix use after free in recently added tracing cod.
      
       - Small internal code cleanups
      
      * tag 'dlm-6.1' of git://git.kernel.org/pub/scm/linux/kernel/git/teigland/linux-dlm:
        fs: dlm: fix possible use after free if tracing
        fs: dlm: const void resource name parameter
        fs: dlm: LSFL_CB_DELAY only for kernel lockspaces
        fs: dlm: remove DLM_LSFL_FS from uapi
        fs: dlm: trace user space callbacks
        fs: dlm: change ls_clear_proc_locks to spinlock
        fs: dlm: remove dlm_del_ast prototype
        fs: dlm: handle rcom in else if branch
        fs: dlm: allow lockspaces have zero lvblen
        fs: dlm: fix invalid derefence of sb_lvbptr
        fs: dlm: handle -EINVAL as log_error()
        fs: dlm: use __func__ for function name
        fs: dlm: handle -EBUSY first in unlock validation
        fs: dlm: handle -EBUSY first in lock arg validation
        fs: dlm: fix race between test_bit() and queue_work()
        fs: dlm: fix race in lowcomms
      f4309528
    • Linus Torvalds's avatar
      Merge tag 'nfsd-6.1' of git://git.kernel.org/pub/scm/linux/kernel/git/cel/linux · f90497a1
      Linus Torvalds authored
      Pull nfsd updates from Chuck Lever:
       "This release is mostly bug fixes, clean-ups, and optimizations.
      
        One notable set of fixes addresses a subtle buffer overflow issue that
        occurs if a small RPC Call message arrives in an oversized RPC record.
        This is only possible on a framed RPC transport such as TCP.
      
        Because NFSD shares the receive and send buffers in one set of pages,
        an oversized RPC record steals pages from the send buffer that will be
        used to construct the RPC Reply message. NFSD must not assume that a
        full-sized buffer is always available to it; otherwise, it will walk
        off the end of the send buffer while constructing its reply.
      
        In this release, we also introduce the ability for the server to wait
        a moment for clients to return delegations before it responds with
        NFS4ERR_DELAY. This saves a retransmit and a network round- trip when
        a delegation recall is needed. This work will be built upon in future
        releases.
      
        The NFS server adds another shrinker to its collection. Because
        courtesy clients can linger for quite some time, they might be
        freeable when the server host comes under memory pressure. A new
        shrinker has been added that releases courtesy client resources during
        low memory scenarios.
      
        Lastly, of note: the maximum number of operations per NFSv4 COMPOUND
        that NFSD can handle is increased from 16 to 50. There are NFSv4
        client implementations that need more than 16 to successfully perform
        a mount operation that uses a pathname with many components"
      
      * tag 'nfsd-6.1' of git://git.kernel.org/pub/scm/linux/kernel/git/cel/linux: (53 commits)
        nfsd: extra checks when freeing delegation stateids
        nfsd: make nfsd4_run_cb a bool return function
        nfsd: fix comments about spinlock handling with delegations
        nfsd: only fill out return pointer on success in nfsd4_lookup_stateid
        NFSD: fix use-after-free on source server when doing inter-server copy
        NFSD: Cap rsize_bop result based on send buffer size
        NFSD: Rename the fields in copy_stateid_t
        nfsd: use DEFINE_SHOW_ATTRIBUTE to define nfsd_file_cache_stats_fops
        nfsd: use DEFINE_SHOW_ATTRIBUTE to define nfsd_reply_cache_stats_fops
        nfsd: use DEFINE_SHOW_ATTRIBUTE to define client_info_fops
        nfsd: use DEFINE_SHOW_ATTRIBUTE to define export_features_fops and supported_enctypes_fops
        nfsd: use DEFINE_PROC_SHOW_ATTRIBUTE to define nfsd_proc_ops
        NFSD: Pack struct nfsd4_compoundres
        NFSD: Remove unused nfsd4_compoundargs::cachetype field
        NFSD: Remove "inline" directives on op_rsize_bop helpers
        NFSD: Clean up nfs4svc_encode_compoundres()
        SUNRPC: Fix typo in xdr_buf_subsegment's kdoc comment
        NFSD: Clean up WRITE arg decoders
        NFSD: Use xdr_inline_decode() to decode NFSv3 symlinks
        NFSD: Refactor common code out of dirlist helpers
        ...
      f90497a1
    • Linus Torvalds's avatar
      Merge tag 'erofs-for-6.1-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/xiang/erofs · 3497640a
      Linus Torvalds authored
      Pull erofs updates from Gao Xiang:
       "In this cycle, for container use cases, fscache-based shared domain is
        introduced [1] so that data blobs in the same domain will be storage
        deduplicated and it will also be used for page cache sharing later.
      
        Also, a special packed inode is now introduced to record inode
        fragments which keep the tail part of files by Yue Hu [2]. You can
        keep arbitary length or (at will) the whole file as a fragment and
        then fragments can be optionally compressed in the packed inode
        together and even deduplicated for smaller image sizes.
      
        In addition to that, global compressed data deduplication by sharing
        partial-referenced pclusters is also supported in this cycle.
      
        Summary:
      
         - Introduce fscache-based domain to share blobs between images
      
         - Support recording fragments in a special packed inode
      
         - Support partial-referenced pclusters for global compressed data
           deduplication
      
         - Fix an order >= MAX_ORDER warning due to crafted negative i_size
      
         - Several cleanups"
      
      Link: https://lore.kernel.org/r/20220916085940.89392-1-zhujia.zj@bytedance.com [1]
      Link: https://lore.kernel.org/r/cover.1663065968.git.huyue2@coolpad.com [2]
      
      * tag 'erofs-for-6.1-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/xiang/erofs:
        erofs: clean up erofs_iget()
        erofs: clean up unnecessary code and comments
        erofs: fold in z_erofs_reload_indexes()
        erofs: introduce partial-referenced pclusters
        erofs: support on-disk compressed fragments data
        erofs: support interlaced uncompressed data for compressed files
        erofs: clean up .read_folio() and .readahead() in fscache mode
        erofs: introduce 'domain_id' mount option
        erofs: Support sharing cookies in the same domain
        erofs: introduce a pseudo mnt to manage shared cookies
        erofs: introduce fscache-based domain
        erofs: code clean up for fscache
        erofs: use kill_anon_super() to kill super in fscache mode
        erofs: fix order >= MAX_ORDER warning due to crafted negative i_size
      3497640a
    • Linus Torvalds's avatar
      Merge tag 'fs.vfsuid.fat.v6.1' of git://git.kernel.org/pub/scm/linux/kernel/git/vfs/idmapping · 8bea8ff3
      Linus Torvalds authored
      Pull fatfs vfsuid conversion from Christian Brauner:
       "Last cycle we introduced the new vfs{g,u}id_t types that we had agreed
        on. The most important parts of the vfs have been converted but there
        are a few more places we need to switch before we can remove the old
        helpers completely.
      
        This cycle we converted all filesystems that called idmapped mount
        helpers directly. The affected filesystems are f2fs, fat, fuse, ksmbd,
        overlayfs, and xfs. We've sent patches for all of them. Looking at
        -next f2fs, ksmbd, overlayfs, and xfs have all picked up these patches
        and they should land in mainline during the v6.1 merge window.
      
        So all filesystems that have a separate tree should send the vfsuid
        conversion themselves. Onle the fat conversion is going through this
        generic fs trees because there is no fat tree.
      
        In order to change time settings on an inode fat checks that the
        caller either is the owner of the inode or the inode's group is in the
        caller's group list. If fat is on an idmapped mount we compare whether
        the inode mapped into the mount is equivalent to the caller's fsuid.
        If it isn't we compare whether the inode's group mapped into the mount
        is in the caller's group list.
      
        We now use the new vfsuid based helpers for that"
      
      * tag 'fs.vfsuid.fat.v6.1' of git://git.kernel.org/pub/scm/linux/kernel/git/vfs/idmapping:
        fat: port to vfs{g,u}id_t and associated helpers
      8bea8ff3
    • Linus Torvalds's avatar
      Merge tag 'fs.acl.rework.prep.v6.1' of git://git.kernel.org/pub/scm/linux/kernel/git/vfs/idmapping · 223b8452
      Linus Torvalds authored
      Pull vfs acl updates from Christian Brauner:
       "These are general fixes and preparatory changes related to the ongoing
        posix acl rework. The actual rework where we build a type safe posix
        acl api wasn't ready for this merge window but we're hopeful for the
        next merge window.
      
        General fixes:
      
         - Some filesystems like 9p and cifs have to implement custom posix
           acl handlers because they require access to the dentry in order to
           set and get posix acls while the set and get inode operations
           currently don't. But the ntfs3 filesystem has no such requirement
           and thus implemented custom posix acl xattr handlers when it really
           didn't have to. So this pr contains patch that just implements set
           and get inode operations for ntfs3 and switches it to rely on the
           generic posix acl xattr handlers. (We would've appreciated reviews
           from the ntfs3 maintainers but we didn't get any. But hey, if we
           really broke it we'll fix it. But fstests for ntfs3 said it's
           fine.)
      
         - The posix_acl_fix_xattr_common() helper has been adapted so it can
           be used by a few more callers and avoiding open-coding the same
           checks over and over.
      
        Other than the two general fixes this series introduces a new helper
        vfs_set_acl_prepare(). The reason for this helper is so that we can
        mitigate one of the source that change {g,u}id values directly in the
        uapi struct. With the vfs_set_acl_prepare() helper we can move the
        idmapped mount fixup into the generic posix acl set handler.
      
        The advantage of this is that it allows us to remove the
        posix_acl_setxattr_idmapped_mnt() helper which so far we had to call
        in vfs_setxattr() to account for idmapped mounts. While semantically
        correct the problem with this approach was that we had to keep the
        value parameter of the generic vfs_setxattr() call as non-const. This
        is rectified in this series.
      
        Ultimately, we will get rid of all the extreme kludges and type
        unsafety once we have merged the posix api - hopefully during the next
        merge window - built solely around get and set inode operations. Which
        incidentally will also improve handling of posix acls in security and
        especially in integrity modesl. While this will come with temporarily
        having two inode operation for posix acls that is nothing compared to
        the problems we have right now and so well worth it. We'll end up with
        something that we can actually reason about instead of needing to
        write novels to explain what's going on"
      
      * tag 'fs.acl.rework.prep.v6.1' of git://git.kernel.org/pub/scm/linux/kernel/git/vfs/idmapping:
        xattr: always us is_posix_acl_xattr() helper
        acl: fix the comments of posix_acl_xattr_set
        xattr: constify value argument in vfs_setxattr()
        ovl: use vfs_set_acl_prepare()
        acl: move idmapping handling into posix_acl_xattr_set()
        acl: add vfs_set_acl_prepare()
        acl: return EOPNOTSUPP in posix_acl_fix_xattr_common()
        ntfs3: rework xattr handlers and switch to POSIX ACL VFS helpers
      223b8452
    • Linus Torvalds's avatar
      Merge tag 'pull-fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs · da380aef
      Linus Torvalds authored
      Pull coredump fix from Al Viro:
       "Brown paper bag bug fix for the coredumping fix late in the 6.0
        release cycle"
      
      * tag 'pull-fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs:
        [brown paperbag] fix coredump breakage
      da380aef
    • Linus Torvalds's avatar
      Merge tag 'lsm-pr-20221003' of git://git.kernel.org/pub/scm/linux/kernel/git/pcmoore/lsm · 26b84401
      Linus Torvalds authored
      Pull LSM updates from Paul Moore:
       "Seven patches for the LSM layer and we've got a mix of trivial and
        significant patches. Highlights below, starting with the smaller bits
        first so they don't get lost in the discussion of the larger items:
      
         - Remove some redundant NULL pointer checks in the common LSM audit
           code.
      
         - Ratelimit the lockdown LSM's access denial messages.
      
           With this change there is a chance that the last visible lockdown
           message on the console is outdated/old, but it does help preserve
           the initial series of lockdown denials that started the denial
           message flood and my gut feeling is that these might be the more
           valuable messages.
      
         - Open userfaultfds as readonly instead of read/write.
      
           While this code obviously lives outside the LSM, it does have a
           noticeable impact on the LSMs with Ondrej explaining the situation
           in the commit description. It is worth noting that this patch
           languished on the VFS list for over a year without any comments
           (objections or otherwise) so I took the liberty of pulling it into
           the LSM tree after giving fair notice. It has been in linux-next
           since the end of August without any noticeable problems.
      
         - Add a LSM hook for user namespace creation, with implementations
           for both the BPF LSM and SELinux.
      
           Even though the changes are fairly small, this is the bulk of the
           diffstat as we are also including BPF LSM selftests for the new
           hook.
      
           It's also the most contentious of the changes in this pull request
           with Eric Biederman NACK'ing the LSM hook multiple times during its
           development and discussion upstream. While I've never taken NACK's
           lightly, I'm sending these patches to you because it is my belief
           that they are of good quality, satisfy a long-standing need of
           users and distros, and are in keeping with the existing nature of
           the LSM layer and the Linux Kernel as a whole.
      
           The patches in implement a LSM hook for user namespace creation
           that allows for a granular approach, configurable at runtime, which
           enables both monitoring and control of user namespaces. The general
           consensus has been that this is far preferable to the other
           solutions that have been adopted downstream including outright
           removal from the kernel, disabling via system wide sysctls, or
           various other out-of-tree mechanisms that users have been forced to
           adopt since we haven't been able to provide them an upstream
           solution for their requests. Eric has been steadfast in his
           objections to this LSM hook, explaining that any restrictions on
           the user namespace could have significant impact on userspace.
           While there is the possibility of impacting userspace, it is
           important to note that this solution only impacts userspace when it
           is requested based on the runtime configuration supplied by the
           distro/admin/user. Frederick (the pathset author), the LSM/security
           community, and myself have tried to work with Eric during
           development of this patchset to find a mutually acceptable
           solution, but Eric's approach and unwillingness to engage in a
           meaningful way have made this impossible. I have CC'd Eric directly
           on this pull request so he has a chance to provide his side of the
           story; there have been no objections outside of Eric's"
      
      * tag 'lsm-pr-20221003' of git://git.kernel.org/pub/scm/linux/kernel/git/pcmoore/lsm:
        lockdown: ratelimit denial messages
        userfaultfd: open userfaultfds with O_RDONLY
        selinux: Implement userns_create hook
        selftests/bpf: Add tests verifying bpf lsm userns_create hook
        bpf-lsm: Make bpf_lsm_userns_create() sleepable
        security, lsm: Introduce security_create_user_ns()
        lsm: clean up redundant NULL pointer check
      26b84401
    • Linus Torvalds's avatar
      Merge tag 'selinux-pr-20221003' of git://git.kernel.org/pub/scm/linux/kernel/git/pcmoore/selinux · e816da29
      Linus Torvalds authored
      Pull SELinux updates from Paul Moore:
       "Six SELinux patches, all are simple and easily understood, but a list
        of the highlights is below:
      
         - Use 'grep -E' instead of 'egrep' in the SELinux policy install
           script.
      
           Fun fact, this seems to be GregKH's *second* dedicated SELinux
           patch since we transitioned to git (ignoring merges, the SPDX
           stuff, and a trivial fs reference removal when lustre was yanked);
           the first was back in 2011 when selinuxfs was placed in
           /sys/fs/selinux. Oh, the memories ...
      
         - Convert the SELinux policy boolean values to use signed integer
           types throughout the SELinux kernel code.
      
           Prior to this we were using a mix of signed and unsigned integers
           which was probably okay in this particular case, but it is
           definitely not a good idea in general.
      
         - Remove a reference to the SELinux runtime disable functionality in
           /etc/selinux/config as we are in the process of deprecating that.
      
           See [1] for more background on this if you missed the previous
           notes on the deprecation.
      
         - Minor cleanups: remove unneeded variables and function parameter
           constification"
      
      Link: https://github.com/SELinuxProject/selinux-kernel/wiki/DEPRECATE-runtime-disable [1]
      
      * tag 'selinux-pr-20221003' of git://git.kernel.org/pub/scm/linux/kernel/git/pcmoore/selinux:
        selinux: remove runtime disable message in the install_policy.sh script
        selinux: use "grep -E" instead of "egrep"
        selinux: remove the unneeded result variable
        selinux: declare read-only parameters const
        selinux: use int arrays for boolean values
        selinux: remove an unneeded variable in sel_make_class_dir_entries()
      e816da29
    • Jakub Kicinski's avatar
      Merge git://git.kernel.org/pub/scm/linux/kernel/git/netdev/net · e52f7c1d
      Jakub Kicinski authored
      Merge in the left-over fixes before the net-next pull-request.
      
      Conflicts:
      
      drivers/net/ethernet/mediatek/mtk_ppe.c
        ae3ed15d ("net: ethernet: mtk_eth_soc: fix state in __mtk_foe_entry_clear")
        9d8cb4c0 ("net: ethernet: mtk_eth_soc: add foe_entry_size to mtk_eth_soc")
      https://lore.kernel.org/all/6cb6893b-4921-a068-4c30-1109795110bb@tessares.net/
      
      kernel/bpf/helpers.c
        8addbfc7 ("bpf: Gate dynptr API behind CAP_BPF")
        5679ff2f ("bpf: Move bpf_loop and bpf_for_each_map_elem under CAP_BPF")
        8a67f2de ("bpf: expose bpf_strtol and bpf_strtoul to all program types")
      https://lore.kernel.org/all/20221003201957.13149-1-daniel@iogearbox.net/
      
      
      
      Signed-off-by: default avatarJakub Kicinski <kuba@kernel.org>
      e52f7c1d
    • Linus Torvalds's avatar
      Merge tag 'integrity-v6.1' of git://git.kernel.org/pub/scm/linux/kernel/git/zohar/linux-integrity · eafb121e
      Linus Torvalds authored
      Pull integrity updates from Mimi Zohar:
       "Just two bug fixes"
      
      * tag 'integrity-v6.1' of git://git.kernel.org/pub/scm/linux/kernel/git/zohar/linux-integrity:
        efi: Correct Macmini DMI match in uefi cert quirk
        ima: fix blocking of security.ima xattrs of unsupported algorithms
      eafb121e