linux/Documentation
Andrea Arcangeli a9b85f9415 userfaultfd: change the read API to return a uffd_msg
I had requests to return the full address (not the page aligned one) to
userland.

It's not entirely clear how the page offset could be relevant because
userfaults aren't like SIGBUS that can sigjump to a different place and it
actually skip resolving the fault depending on a page offset.  There's
currently no real way to skip the fault especially because after a
UFFDIO_COPY|ZEROPAGE, the fault is optimized to be retried within the
kernel without having to return to userland first (not even self modifying
code replacing the .text that touched the faulting address would prevent
the fault to be repeated).  Userland cannot skip repeating the fault even
more so if the fault was triggered by a KVM secondary page fault or any
get_user_pages or any copy-user inside some syscall which will return to
kernel code.  The second time FAULT_FLAG_RETRY_NOWAIT won't be set leading
to a SIGBUS being raised because the userfault can't wait if it cannot
release the mmap_map first (and FAULT_FLAG_RETRY_NOWAIT is required for
that).

Still returning userland a proper structure during the read() on the uffd,
can allow to use the current UFFD_API for the future non-cooperative
extensions too and it looks cleaner as well.  Once we get additional
fields there's no point to return the fault address page aligned anymore
to reuse the bits below PAGE_SHIFT.

The only downside is that the read() syscall will read 32bytes instead of
8bytes but that's not going to be measurable overhead.

The total number of new events that can be extended or of new future bits
for already shipped events, is limited to 64 by the features field of the
uffdio_api structure.  If more will be needed a bump of UFFD_API will be
required.

[akpm@linux-foundation.org: use __packed]
Signed-off-by: Andrea Arcangeli <aarcange@redhat.com>
Acked-by: Pavel Emelyanov <xemul@parallels.com>
Cc: Sanidhya Kashyap <sanidhya.gatech@gmail.com>
Cc: zhang.zhanghailiang@huawei.com
Cc: "Kirill A. Shutemov" <kirill@shutemov.name>
Cc: Andres Lagar-Cavilla <andreslc@google.com>
Cc: Dave Hansen <dave.hansen@intel.com>
Cc: Paolo Bonzini <pbonzini@redhat.com>
Cc: Rik van Riel <riel@redhat.com>
Cc: Mel Gorman <mgorman@suse.de>
Cc: Andy Lutomirski <luto@amacapital.net>
Cc: Hugh Dickins <hughd@google.com>
Cc: Peter Feiner <pfeiner@google.com>
Cc: "Dr. David Alan Gilbert" <dgilbert@redhat.com>
Cc: Johannes Weiner <hannes@cmpxchg.org>
Cc: "Huangpeng (Peter)" <peter.huangpeng@huawei.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2015-09-04 16:54:41 -07:00
..
ABI This is the bulk of GPIO changes for the v4.3 kernel cycle: 2015-09-04 10:07:45 -07:00
DocBook Merge branch 'for_linus' of git://git.kernel.org/pub/scm/linux/kernel/git/jack/linux-fs 2015-09-03 12:28:30 -07:00
EDID
PCI The documentation tree update for 4.1. Numerous fixes, the overdue removal 2015-04-18 11:10:49 -04:00
RCU Merge branches 'doc.2015.07.15a' and 'torture.2015.07.15a' into HEAD 2015-08-04 08:42:02 -07:00
accounting
acpi ACPI / Documentation: Update method tracing documentation. 2015-08-07 02:42:22 +02:00
aoe
arm ARM: SoC platform updates for v4.3 2015-09-01 12:18:40 -07:00
arm64 arm64/Documentation: clarify wording regarding memory below the Image 2015-07-29 18:32:10 +01:00
auxdisplay
backlight
blackfin Docs: blackfin: Use new switch macro SAMPLE_IRQ_TIMER instead of IRQ_TIMER5 2015-05-07 09:35:14 -06:00
block Documentation: update notes in biovecs about arbitrarily sized bios 2015-08-13 12:32:07 -06:00
blockdev zram: add dynamic device add/remove functionality 2015-06-25 17:00:36 -07:00
bus-devices
cdrom
cgroups Merge branch 'for-4.3-unified-base' into for-4.3 2015-08-25 14:19:29 -04:00
cma cma: debug: document new debugfs interface 2015-04-14 16:49:00 -07:00
connector
console
cpu-freq cpufreq: remove redundant CPUFREQ_INCOMPATIBLE notifier event 2015-09-01 15:50:38 +02:00
cpuidle
cris
crypto crypto: doc - AEAD / RNG AF_ALG interface 2015-03-09 21:06:18 +11:00
development-process
device-mapper dm raid: document RAID 4/5/6 discard support 2015-08-31 15:05:31 -04:00
devicetree This is the bulk of pin control changes for the v4.3 development 2015-09-04 10:22:09 -07:00
dmaengine Merge branch 'topic/pxa' into for-linus 2015-06-25 09:21:58 +05:30
driver-model Char/Misc driver patches for 4.1-rc1 2015-04-21 09:42:58 -07:00
dvb
early-userspace
extcon
fault-injection futex: Fault/error injection capabilities 2015-07-20 11:45:45 +02:00
fb Documentation/fb: add documentation for sm712fb 2015-08-07 15:05:01 -07:00
features Merge git://git.kernel.org/pub/scm/linux/kernel/git/cmetcalf/linux-tile 2015-09-04 08:59:53 -07:00
filesystems Merge tag 'for-f2fs-4.3' of git://git.kernel.org/pub/scm/linux/kernel/git/jaegeuk/f2fs 2015-09-03 13:10:22 -07:00
firmware_class
fmc
frv
gpio Documentation: gpio: consumer: describe active low property 2015-08-17 10:38:52 +02:00
hid HID: sensor: Update document for custom sensor 2015-04-10 22:22:56 +02:00
hwmon hwmon: (fam15h_power) Add documentation for new processors support 2015-08-27 07:51:15 -07:00
i2c Merge branch 'i2c/for-4.2' of git://git.kernel.org/pub/scm/linux/kernel/git/wsa/linux 2015-06-25 18:42:39 -07:00
ia64 virtual: Documentation: simplify and generalize paravirt_ops.txt 2015-02-13 17:15:44 +10:30
ide
infiniband
input Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/dtor/input 2015-08-09 09:38:42 +02:00
ioctl userfaultfd: uAPI 2015-09-04 16:54:41 -07:00
isdn
ja_JP Doc: ja_JP: Fix typo in HOWTO 2015-06-08 16:43:09 -06:00
kbuild kbuild: Allow arch Makefiles to override {cpp,ld,c}flags 2015-07-06 11:09:00 +05:30
kdump kernel: add panic_on_warn 2014-12-10 17:41:10 -08:00
ko_KR
laptops Move freefall program from Documentation/ to tools/ 2015-06-08 16:42:07 -06:00
leds Merge branch 'for-next' of git://git.kernel.org/pub/scm/linux/kernel/git/cooloney/linux-leds 2015-07-01 19:09:11 -07:00
locking Documentation changes for 3.20 2015-02-11 13:03:11 -08:00
m68k
memory-devices
metag
mic Char/Misc driver patches for 4.2-rc1 2015-06-26 14:51:15 -07:00
mips
misc-devices mei: add async event notification ioctls 2015-08-03 17:30:00 -07:00
mmc
mn10300
mtd
namespaces
netlabel
networking Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/net-next 2015-09-03 08:08:17 -07:00
nfc NFC: Fix typo in nfc-hci.txt 2015-06-08 23:15:45 +02:00
nios2 Documentation: Add documentation for Nios2 architecture 2014-12-08 12:56:06 +08:00
nvdimm libnvdimm: Non-Volatile Devices 2015-06-26 11:23:38 -04:00
nvmem Documentation: nvmem: add nvmem api level and how-to doc 2015-08-05 13:43:45 -07:00
parisc
pcmcia pcmcia: Fix typo in locking documentation 2015-08-07 14:34:58 +02:00
phy
platform
power Power management and ACPI material for v4.3-rc1 2015-09-01 19:45:46 -07:00
powerpc SCSI misc on 20150901 2015-09-02 12:22:54 -07:00
pps Doc: pps: Fix file name in pps.txt 2015-07-14 12:35:42 -06:00
prctl Documentation/prctl: don't build tsc tests when cross compiling 2015-06-22 16:05:04 -06:00
pti
ptp
rapidio
s390 KVM: s390: remove outdated documentation 2015-07-29 11:02:35 +02:00
scheduler sched/dl/Documentation: Split Section 3 2015-05-19 08:39:21 +02:00
scsi Merge branch 'for-4.2/sg' of git://git.kernel.dk/linux-block 2015-06-25 15:22:36 -07:00
security Smack: allow multiple labels in onlycap 2015-06-02 11:53:42 -07:00
serial Doc: serial-rs485.txt: update RS485 driver interface 2015-06-12 17:39:51 -07:00
sh
sound Doc: sound:oss: Fix typo in sound/oss 2015-06-09 17:23:00 +02:00
spi Documentation/spi/spidev_test.c: fix warning 2015-04-17 09:04:12 -04:00
sysctl Documentation: mm: fix location of extfrag_index 2015-07-24 15:05:56 +02:00
target Documentation/target: Fix tcm_mod_builder.py build breakage 2015-07-24 17:48:55 -07:00
thermal thermal: support slope and offset coefficients 2015-05-11 19:46:52 -07:00
timers documentation: Update NO_HZ_FULL interaction with POSIX timers 2015-02-26 11:57:29 -08:00
tpm
trace powerpc updates for 4.3 2015-09-03 16:41:38 -07:00
usb Revert "usb: interface authorization: Documentation part" 2015-08-18 09:57:15 -07:00
vDSO Documentation/vDSO: don't build tests when cross compiling 2015-06-22 16:04:57 -06:00
video4linux [media] Documentation: update cardlists 2015-06-09 18:43:47 -03:00
virtual kvm/x86: add sending hyper-v crash notification to user space 2015-07-23 08:27:06 +02:00
vm userfaultfd: change the read API to return a uffd_msg 2015-09-04 16:54:41 -07:00
w1 w1: Add support for DS28EA00 sequence to w1-therm 2015-05-24 12:08:59 -07:00
watchdog watchdog: omap_wdt: early_enable module parameter 2015-07-01 16:43:17 +02:00
wimax
x86 Merge branch 'x86-mm-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip 2015-09-01 10:07:40 -07:00
xtensa
zh_CN Documentation updates for 4.2 2015-06-24 20:01:36 -07:00
00-INDEX Update of Documentation/dmaengine/00-INDEX 2014-12-29 15:28:24 -07:00
BUG-HUNTING
Changes Documentation: GNU is frequently spelled Gnu 2014-12-29 15:33:17 -07:00
CodeOfConflict Code of Conflict 2015-02-27 11:44:24 -08:00
CodingStyle Documentation: CodingStyle: remove broken links in the References section 2015-07-10 13:54:34 -06:00
DMA-API-HOWTO.txt Documentation updates for 4.2 2015-06-24 20:01:36 -07:00
DMA-API.txt PCI: Add pci_bus_addr_t 2015-05-29 17:21:45 -05:00
DMA-ISA-LPC.txt
DMA-attributes.txt
HOWTO docs: update HOWTO for 3.x -> 4.x versioning 2015-08-24 11:28:17 -06:00
IPMI.txt ipmi:ssif: Ignore spaces when comparing I2C adapter names 2015-05-05 14:24:45 -05:00
IRQ-affinity.txt
IRQ-domain.txt IRQCHIP: Update docs regarding irq_domain_add_tree() 2015-04-01 17:21:35 +02:00
IRQ.txt
Intel-IOMMU.txt Documentation/Intel-IOMMU.txt: Modify definition of DRHD 2015-08-24 11:39:45 -06:00
Makefile Documentation: Remove ZBOOT MMC/SDHI utility and docs 2015-02-24 06:45:25 +09:00
ManagementStyle
SAK.txt
SM501.txt
SecurityBugs
SubmitChecklist
SubmittingDrivers
SubmittingPatches Merge branch 'for-next' of git://git.kernel.org/pub/scm/linux/kernel/git/jikos/trivial 2015-09-01 18:46:42 -07:00
VGA-softcursor.txt
adding-syscalls.txt Documentation: describe how to add a system call 2015-08-13 17:54:06 -06:00
applying-patches.txt
assoc_array.txt
atomic_ops.txt locking/Documentation: Clarify failed cmpxchg() memory ordering semantics 2015-08-03 10:57:09 +02:00
bad_memory.txt
basic_profiling.txt
bcache.txt
binfmt_misc.txt
braille-console.txt
bt8xxgpio.txt
btmrvl.txt
bus-virt-phys-mapping.txt
cachetlb.txt rmap: drop support of non-linear mappings 2015-02-10 14:30:31 -08:00
circular-buffers.txt
clk.txt clk: change clk_ops' ->determine_rate() prototype 2015-07-27 18:12:01 -07:00
coccinelle.txt
cpu-hotplug.txt cpumask: fix cpu-hotplug documentation 2015-03-05 13:37:01 +10:30
cpu-load.txt
cputopology.txt Documentation: Update cputopology.txt 2015-05-27 15:22:15 +02:00
crc32.txt
dcdbas.txt
debugging-modules.txt
debugging-via-ohci1394.txt Doc: Change wikipedia's URL from http to https 2015-06-22 10:14:05 -06:00
dell_rbu.txt
devices.txt
digsig.txt
dma-buf-sharing.txt dma-buf: cleanup dma_buf_export() to make it easily extensible 2015-04-21 14:47:16 +05:30
dontdiff
dynamic-debug-howto.txt
edac.txt EDAC: Update Documentation/edac.txt 2015-06-24 18:17:40 +02:00
efi-stub.txt
eisa.txt
email-clients.txt fix Evolution submenu name in email-clients.txt 2015-07-24 15:05:57 +02:00
flexible-arrays.txt
futex-requeue-pi.txt doc: Fix misnamed FUTEX_CMP_REQUEUE_PI op constants 2015-01-19 12:05:32 +01:00
gcov.txt
gdb-kernel-debugging.txt scripts/gdb: add basic documentation 2015-02-17 14:34:54 -08:00
highuid.txt
hsi.txt
hw_random.txt
hwspinlock.txt hwspinlock/core: add device tree support 2015-05-02 09:54:30 +03:00
init.txt
initrd.txt
intel_txt.txt
io-mapping.txt
io_ordering.txt
iostats.txt
irqflags-tracing.txt
isapnp.txt
java.txt
kasan.txt Merge branch 'doc/4.2' into docs-next 2015-06-08 17:04:11 -06:00
kernel-doc-nano-HOWTO.txt Documenation: Update location of docproc.c 2015-07-14 12:36:39 -06:00
kernel-docs.txt
kernel-parameters.txt Merge branch 'core-rcu-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip 2015-08-31 18:12:07 -07:00
kernel-per-CPU-kthreads.txt documentation: Update per-CPU kthreads documentation 2015-02-26 11:57:30 -08:00
kmemcheck.txt Documentation: update the CONFIG_DEBUG_PAGEALLOC description 2015-03-20 07:41:55 -06:00
kmemleak.txt Doc: Change wikipedia's URL from http to https 2015-06-22 10:14:05 -06:00
kobject.txt kobject: grammar fix 2014-12-08 09:07:11 -05:00
kprobes.txt kprobes: Update Documentation/kprobes.txt 2015-03-20 07:41:55 -06:00
kref.txt
kselftest.txt kselftest: Move the docs to the Documentation dir 2014-11-24 10:49:54 -07:00
ldm.txt
local_ops.txt percpu: update local_ops.txt to reflect this_cpu operations 2014-12-13 12:42:53 -08:00
lockup-watchdogs.txt watchdog: add watchdog_cpumask sysctl to assist nohz 2015-06-24 17:49:40 -07:00
logo.gif
logo.txt
lzo.txt
magic-number.txt Documentation/magic-number: Remove SCC_MAGIC 2015-05-13 15:39:04 -04:00
mailbox.txt Documentation: minor typo fix in mailbox.txt 2015-08-13 18:03:18 -06:00
md-cluster.txt md-cluster: Design Documentation 2015-02-23 07:16:46 -06:00
md.txt doc:md: fix typo in md.txt. 2015-06-23 06:49:44 -06:00
media-framework.txt
memory-barriers.txt Merge branch 'locking-core-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip 2015-09-03 15:46:07 -07:00
memory-hotplug.txt mem-hotplug: fix typo in Documentation/memory-hotplug.txt 2015-03-20 07:41:55 -06:00
men-chameleon-bus.txt Documentation: Minor changes to men-chameleon-bus.txt 2015-07-24 15:15:17 +02:00
module-signing.txt modsign: change default key details 2015-04-30 09:35:41 -07:00
mono.txt
nommu-mmap.txt fs: introduce f_op->mmap_capabilities for nommu mmap support 2015-01-20 14:02:58 -07:00
ntb.txt NTB: Rename Intel code names to platform names 2015-07-04 14:09:25 -04:00
numastat.txt
oops-tracing.txt livepatch: kernel: add TAINT_LIVEPATCH 2014-12-22 15:40:48 +01:00
padata.txt
parport-lowlevel.txt
parport.txt
percpu-rw-semaphore.txt
phy.txt phy: core: Add devm_of_phy_get_by_index to phy-core 2015-05-11 21:42:23 +05:30
pi-futex.txt
pinctrl.txt pinctrl: move strict option to pinmux_ops 2015-05-06 14:45:19 +02:00
pnp.txt
preempt-locking.txt x86/fpu: Rename math_state_restore() to fpu__restore() 2015-05-19 15:47:18 +02:00
printk-formats.txt The documentation tree update for 4.1. Numerous fixes, the overdue removal 2015-04-18 11:10:49 -04:00
pwm.txt
ramoops.txt pstore-ram: Allow optional mapping with pgprot_noncached 2014-12-11 13:38:31 -08:00
rbtree.txt
remoteproc.txt remoteproc: introduce rproc_get_by_phandle API 2015-06-16 21:12:52 +03:00
rfkill.txt rfkill: document rfkill module parameters 2015-01-09 23:22:12 +01:00
robust-futex-ABI.txt
robust-futexes.txt
rpmsg.txt
rtc.txt Documentation, split up rtc.txt into documentation and test file 2015-03-24 22:01:58 -06:00
serial-console.txt
sgi-ioc4.txt
smsc_ece1099.txt
sparse.txt
stable_api_nonsense.txt
stable_kernel_rules.txt stable: Update documentation to clarify preferred procedure 2015-05-22 09:38:56 -06:00
static-keys.txt jump label, locking/static_keys: Update docs 2015-08-03 11:51:14 +02:00
svga.txt
sysfs-rules.txt
sysrq.txt Documentation/sysrq.txt: Mention MIPS TLB dump (x) 2015-09-03 12:07:43 +02:00
this_cpu_ops.txt
unaligned-memory-access.txt
unicode.txt
unshare.txt
vfio.txt vfio: powerpc/spapr: Support Dynamic DMA windows 2015-06-11 15:16:55 +10:00
vgaarbiter.txt
video-output.txt
vme_api.txt Documentation: mention vme_master_mmap() in VME API 2015-06-12 17:26:56 -07:00
volatile-considered-harmful.txt
workqueue.txt workqueue: fix trivial typo in Documentation/workqueue.txt 2015-05-05 09:50:38 -04:00
xillybus.txt
xz.txt
zorro.txt