Centos-kernel-stream-9/ipc
Nico Pache db143a3d62 ipc/shm: call underlying open/close vm_ops
commit b6305049f30652f1efcf78d627fc6656151a7929
Author: Mike Kravetz <mike.kravetz@oracle.com>
Date:   Mon Nov 14 13:00:18 2022 -0800

    ipc/shm: call underlying open/close vm_ops

    Shared memory segments can be created that are backed by hugetlb pages.
    When this happens, the vmas associated with any mappings (shmat) are
    marked VM_HUGETLB, yet the vm_ops for such mappings are provided by
    ipc/shm (shm_vm_ops).  There is a mechanism to call the underlying hugetlb
    vm_ops, and this is done for most operations.  However, it is not done for
    open and close.

    This was not an issue until the introduction of the hugetlb vma_lock.
    This lock structure is pointed to by vm_private_data and the open/close
    vm_ops help maintain this structure.  The special hugetlb routine called
    at fork took care of structure updates at fork time.  However,
    vma_splitting is not properly handled for ipc shared memory mappings
    backed by hugetlb pages.  This can result in a "kernel NULL pointer
    dereference" BUG or use after free as two vmas point to the same lock
    structure.

    Update the shm open and close routines to always call the underlying open
    and close routines.

    Link: https://lkml.kernel.org/r/20221114210018.49346-1-mike.kravetz@oracle.com
    Fixes: 8d9bfb260814 ("hugetlb: add vma based lock for pmd sharing")
    Signed-off-by: Mike Kravetz <mike.kravetz@oracle.com>
    Reported-by: Doug Nelson <doug.nelson@intel.com>
    Reported-by: <syzbot+83b4134621b7c326d950@syzkaller.appspotmail.com>
    Cc: Alexander Mikhalitsyn <alexander.mikhalitsyn@virtuozzo.com>
    Cc: "Eric W . Biederman" <ebiederm@xmission.com>
    Cc: Manfred Spraul <manfred@colorfullife.com>
    Cc: Matthew Wilcox <willy@infradead.org>
    Cc: Miaohe Lin <linmiaohe@huawei.com>
    Cc: Michal Hocko <mhocko@suse.com>
    Signed-off-by: Andrew Morton <akpm@linux-foundation.org>

Bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=2168372
Signed-off-by: Nico Pache <npache@redhat.com>
2023-06-14 15:11:04 -06:00
..
Makefile
compat.c
ipc_sysctl.c ipc: adjust proc_ipc_sem_dointvec definition to match prototype 2020-09-05 12:14:29 -07:00
mq_sysctl.c sysctl: pass kernel pointers to ->proc_handler 2020-04-27 02:07:40 -04:00
mqueue.c ipc/mqueue: use get_tree_nodev() in mqueue_get_tree() 2022-05-27 16:50:50 -04:00
msg.c memcg: enable accounting of ipc resources 2021-10-05 16:10:48 -04:00
msgutil.c ipc: Use generic ns_common::count 2020-08-19 14:13:52 +02:00
namespace.c memcg: enable accounting for new namesapces and struct nsproxy 2021-11-29 11:41:20 -05:00
sem.c ipc: remove memcg accounting for sops objects in do_semtimedop() 2021-10-05 16:17:31 -04:00
shm.c ipc/shm: call underlying open/close vm_ops 2023-06-14 15:11:04 -06:00
syscall.c y2038: remove CONFIG_64BIT_TIME 2019-11-15 14:38:27 +01:00
util.c proc: remove PDE_DATA() completely 2022-04-08 17:38:02 +02:00
util.h ipc/util.c: use binary search for max_idx 2021-07-01 11:06:07 -07:00