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
fc
fc_frame.h -rw-r--r-- 7.0 KB
fcoe_sysfs.h -rw-r--r-- 3.1 KB
iscsi_if.h -rw-r--r-- 25.6 KB
iscsi_proto.h -rw-r--r-- 15.5 KB
iser.h -rw-r--r-- 2.3 KB
libfc.h -rw-r--r-- 31.1 KB
libfcoe.h -rw-r--r-- 13.4 KB
libiscsi.h -rw-r--r-- 14.4 KB
libiscsi_tcp.h -rw-r--r-- 3.8 KB
libsas.h -rw-r--r-- 19.3 KB
sas.h -rw-r--r-- 12.8 KB
sas_ata.h -rw-r--r-- 2.4 KB
scsi.h -rw-r--r-- 5.8 KB
scsi_bsg_iscsi.h -rw-r--r-- 2.2 KB
scsi_cmnd.h -rw-r--r-- 10.1 KB
scsi_common.h -rw-r--r-- 2.3 KB
scsi_dbg.h -rw-r--r-- 2.1 KB
scsi_device.h -rw-r--r-- 21.7 KB
scsi_devinfo.h -rw-r--r-- 3.7 KB
scsi_dh.h -rw-r--r-- 2.5 KB
scsi_driver.h -rw-r--r-- 1.1 KB
scsi_eh.h -rw-r--r-- 1.6 KB
scsi_host.h -rw-r--r-- 26.4 KB
scsi_ioctl.h -rw-r--r-- 1.5 KB
scsi_proto.h -rw-r--r-- 10.6 KB
scsi_status.h -rw-r--r-- 2.7 KB
scsi_tcq.h -rw-r--r-- 993 bytes
scsi_transport.h -rw-r--r-- 2.6 KB
scsi_transport_fc.h -rw-r--r-- 28.0 KB
scsi_transport_iscsi.h -rw-r--r-- 17.2 KB
scsi_transport_sas.h -rw-r--r-- 6.8 KB
scsi_transport_spi.h -rw-r--r-- 6.5 KB
scsi_transport_srp.h -rw-r--r-- 4.8 KB
scsicam.h -rw-r--r-- 636 bytes
sg.h -rw-r--r-- 14.7 KB
srp.h -rw-r--r-- 6.9 KB
viosrp.h -rw-r--r-- 5.5 KB

back to top