https://github.com/torvalds/linux
Revision d172b1a3bd065dd89234eac547fc62cf80681631 authored by Nadav Amit on 11 July 2022, 16:59:06 UTC, committed by akpm on 27 July 2022, 01:25:01 UTC
Commit 824ddc601adc ("userfaultfd: provide unmasked address on
page-fault") was introduced to fix an old bug, in which the offset in the
address of a page-fault was masked.  Concerns were raised - although were
never backed by actual code - that some userspace code might break because
the bug has been around for quite a while.  To address these concerns a
new flag was introduced, and only when this flag is set by the user,
userfaultfd provides the exact address of the page-fault.

The commit however had a bug, and if the flag is unset, the offset was
always masked based on a base-page granularity.  Yet, for huge-pages, the
behavior prior to the commit was that the address is masked to the
huge-page granulrity.

While there are no reports on real breakage, fix this issue.  If the flag
is unset, use the address with the masking that was done before.

Link: https://lkml.kernel.org/r/20220711165906.2682-1-namit@vmware.com
Fixes: 824ddc601adc ("userfaultfd: provide unmasked address on page-fault")
Signed-off-by: Nadav Amit <namit@vmware.com>
Reported-by: James Houghton <jthoughton@google.com>
Reviewed-by: Mike Rapoport <rppt@linux.ibm.com>
Reviewed-by: Peter Xu <peterx@redhat.com>
Reviewed-by: James Houghton <jthoughton@google.com>
Cc: David Hildenbrand <david@redhat.com>
Cc: Jan Kara <jack@suse.cz>
Cc: Andrea Arcangeli <aarcange@redhat.com>
Cc: <stable@vger.kernel.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
1 parent c80af0c
History
Tip revision: d172b1a3bd065dd89234eac547fc62cf80681631 authored by Nadav Amit on 11 July 2022, 16:59:06 UTC
userfaultfd: provide properly masked address for huge-pages
Tip revision: d172b1a
File Mode Size
ib.h -rw-r--r-- 2.1 KB
ib_addr.h -rw-r--r-- 7.7 KB
ib_cache.h -rw-r--r-- 4.2 KB
ib_cm.h -rw-r--r-- 16.9 KB
ib_hdrs.h -rw-r--r-- 6.8 KB
ib_mad.h -rw-r--r-- 24.5 KB
ib_marshall.h -rw-r--r-- 778 bytes
ib_pack.h -rw-r--r-- 7.7 KB
ib_pma.h -rw-r--r-- 4.2 KB
ib_sa.h -rw-r--r-- 19.5 KB
ib_smi.h -rw-r--r-- 4.5 KB
ib_sysfs.h -rw-r--r-- 1.2 KB
ib_umem.h -rw-r--r-- 6.0 KB
ib_umem_odp.h -rw-r--r-- 3.4 KB
ib_verbs.h -rw-r--r-- 139.8 KB
iba.h -rw-r--r-- 5.5 KB
ibta_vol1_c12.h -rw-r--r-- 12.9 KB
iw_cm.h -rw-r--r-- 7.1 KB
iw_portmap.h -rw-r--r-- 2.2 KB
lag.h -rw-r--r-- 530 bytes
mr_pool.h -rw-r--r-- 568 bytes
opa_addr.h -rw-r--r-- 2.4 KB
opa_port_info.h -rw-r--r-- 13.4 KB
opa_smi.h -rw-r--r-- 3.0 KB
opa_vnic.h -rw-r--r-- 2.0 KB
rdma_cm.h -rw-r--r-- 12.8 KB
rdma_cm_ib.h -rw-r--r-- 797 bytes
rdma_counter.h -rw-r--r-- 1.9 KB
rdma_netlink.h -rw-r--r-- 4.0 KB
rdma_vt.h -rw-r--r-- 14.2 KB
rdmavt_cq.h -rw-r--r-- 1.7 KB
rdmavt_mr.h -rw-r--r-- 3.9 KB
rdmavt_qp.h -rw-r--r-- 28.0 KB
restrack.h -rw-r--r-- 4.2 KB
rw.h -rw-r--r-- 2.2 KB
signature.h -rw-r--r-- 2.9 KB
tid_rdma_defs.h -rw-r--r-- 2.1 KB
uverbs_ioctl.h -rw-r--r-- 32.2 KB
uverbs_named_ioctl.h -rw-r--r-- 4.7 KB
uverbs_std_types.h -rw-r--r-- 5.2 KB
uverbs_types.h -rw-r--r-- 6.1 KB

back to top