linux_dsm_epyc7002/arch/arm
Linus Torvalds 0c389d89ab maccess: make get_kernel_nofault() check for minimal type compatibility
Now that we've renamed probe_kernel_address() to get_kernel_nofault()
and made it look and behave more in line with get_user(), some of the
subtle type behavior differences end up being more obvious and possibly
dangerous.

When you do

        get_user(val, user_ptr);

the type of the access comes from the "user_ptr" part, and the above
basically acts as

        val = *user_ptr;

by design (except, of course, for the fact that the actual dereference
is done with a user access).

Note how in the above case, the type of the end result comes from the
pointer argument, and then the value is cast to the type of 'val' as
part of the assignment.

So the type of the pointer is ultimately the more important type both
for the access itself.

But 'get_kernel_nofault()' may now _look_ similar, but it behaves very
differently.  When you do

        get_kernel_nofault(val, kernel_ptr);

it behaves like

        val = *(typeof(val) *)kernel_ptr;

except, of course, for the fact that the actual dereference is done with
exception handling so that a faulting access is suppressed and returned
as the error code.

But note how different the casting behavior of the two superficially
similar accesses are: one does the actual access in the size of the type
the pointer points to, while the other does the access in the size of
the target, and ignores the pointer type entirely.

Actually changing get_kernel_nofault() to act like get_user() is almost
certainly the right thing to do eventually, but in the meantime this
patch adds logit to at least verify that the pointer type is compatible
with the type of the result.

In many cases, this involves just casting the pointer to 'void *' to
make it obvious that the type of the pointer is not the important part.
It's not how 'get_user()' acts, but at least the behavioral difference
is now obvious and explicit.

Cc: Christoph Hellwig <hch@lst.de>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2020-06-18 12:10:37 -07:00
..
boot Kbuild updates for v5.8 (2nd) 2020-06-13 13:29:16 -07:00
common ARM: sa1111: Fix irq_retrigger callback return value 2020-03-16 15:48:54 +00:00
configs ARM: defconfig updates fopr 5.8 2020-06-04 19:54:15 -07:00
crypto Merge branch 'rwonce/rework' of git://git.kernel.org/pub/scm/linux/kernel/git/will/linux 2020-06-10 14:46:54 -07:00
include mm: consolidate pte_index() and pte_offset_*() definitions 2020-06-09 09:39:14 -07:00
kernel maccess: make get_kernel_nofault() check for minimal type compatibility 2020-06-18 12:10:37 -07:00
lib mmap locking API: use coccinelle to convert mmap_sem rwsem call sites 2020-06-09 09:39:14 -07:00
mach-actions ARM: actions: Drop unneeded select of COMMON_CLK 2020-05-15 23:27:37 +02:00
mach-alpine ARM: alpine: Drop unneeded select of HAVE_SMP 2020-05-15 23:27:37 +02:00
mach-artpec
mach-asm9260 ARM: asm9260: Drop unneeded select of GENERIC_CLOCKEVENTS 2020-05-15 23:27:37 +02:00
mach-aspeed ARM: aspeed: Drop unneeded select of HAVE_SMP 2020-05-15 23:27:37 +02:00
mach-at91 ARM: SoC updates 2020-04-03 15:02:35 -07:00
mach-axxia
mach-bcm
mach-berlin ARM: berlin: Drop unneeded select of HAVE_SMP 2020-05-15 23:27:37 +02:00
mach-clps711x ARM: clps711x: Drop unneeded select of multi-platform selected options 2020-05-15 23:27:37 +02:00
mach-cns3xxx ARM: cns3xxx: replace setup_irq() by request_irq() 2020-03-27 14:11:47 +01:00
mach-davinci ARM: davinci: fix build failure without I2C 2020-05-28 12:35:00 +02:00
mach-digicolor
mach-dove arm: mach-dove: Mark dove_io_desc as __maybe_unused 2020-03-13 21:44:50 +01:00
mach-ebsa110 mm: don't include asm/pgtable.h if linux/mm.h is already included 2020-06-09 09:39:13 -07:00
mach-efm32
mach-ep93xx ARM: ep93xx: Replace setup_irq() by request_irq() 2020-03-27 14:11:42 +01:00
mach-exynos arm: Unplug KVM from the build system 2020-03-24 10:55:50 +00:00
mach-footbridge treewide: replace '---help---' in Kconfig files with 'help' 2020-06-14 01:57:21 +09:00
mach-gemini
mach-highbank
mach-hisi
mach-imx mm: don't include asm/pgtable.h if linux/mm.h is already included 2020-06-09 09:39:13 -07:00
mach-integrator mm: reorder includes after introduction of linux/pgtable.h 2020-06-09 09:39:13 -07:00
mach-iop32x mm: don't include asm/pgtable.h if linux/mm.h is already included 2020-06-09 09:39:13 -07:00
mach-ixp4xx mm: don't include asm/pgtable.h if linux/mm.h is already included 2020-06-09 09:39:13 -07:00
mach-keystone mm: reorder includes after introduction of linux/pgtable.h 2020-06-09 09:39:13 -07:00
mach-lpc18xx
mach-lpc32xx
mach-mediatek ARM: mediatek: Replace <linux/clk-provider.h> by <linux/of_clk.h> 2020-05-15 22:55:06 +02:00
mach-meson
mach-milbeaut
mach-mmp This time around we have 4 lines of diff in the core framework, removing a 2020-06-10 11:42:19 -07:00
mach-moxart
mach-mv78xx0
mach-mvebu ARM: mvebu: Drop unneeded select of HAVE_SMP 2020-05-15 23:27:38 +02:00
mach-mxs
mach-nomadik
mach-npcm
mach-nspire
mach-omap1 ARM: SoC updates 2020-04-03 15:02:35 -07:00
mach-omap2 ARM: DT changes for v5.8 2020-06-04 20:02:14 -07:00
mach-orion5x
mach-oxnas ARM: oxnas: make ox820_boot_secondary static 2020-05-12 10:29:33 +02:00
mach-picoxcell
mach-prima2 ARM: prima2: Drop unneeded select of HAVE_SMP 2020-05-15 23:27:38 +02:00
mach-pxa ARM: pxa: remove Compulab pxa2xx boards 2020-05-26 00:10:57 +02:00
mach-qcom ARM: qcom: Add support for IPQ40xx 2020-03-31 21:03:27 +02:00
mach-rda
mach-realtek ARM: Prepare Realtek RTD1195 2020-04-12 23:13:38 +02:00
mach-realview VExpress modularization 2020-05-15 23:04:40 +02:00
mach-rockchip ARM: rockchip: fix spelling mistake "to" -> "too" 2020-04-13 09:40:45 +02:00
mach-rpc ARM: 8966/1: rpc: replace setup_irq() by request_irq() 2020-03-19 09:27:42 +00:00
mach-s3c24xx backlight: pwm_bl: Switch to full GPIO descriptor 2020-03-18 15:05:57 +00:00
mach-s3c64xx ARM: s3c64xx: convert to use i2c_new_client_device() 2020-04-13 12:28:23 +02:00
mach-s5pv210
mach-sa1100 mm: pgtable: add shortcuts for accessing kernel PMD and PTE 2020-06-09 09:39:13 -07:00
mach-shmobile ARM: shmobile: r8a7742: Basic SoC support 2020-04-28 10:13:58 +02:00
mach-socfpga ARM: socfpga: Drop unneeded select of PCI_DOMAINS_GENERIC 2020-05-15 23:27:38 +02:00
mach-spear ARM: spear: replace setup_irq() by request_irq() 2020-03-27 14:11:45 +01:00
mach-sti
mach-stm32
mach-sunxi
mach-tango
mach-tegra mm: introduce include/linux/pgtable.h 2020-06-09 09:39:13 -07:00
mach-u300
mach-uniphier
mach-ux500
mach-versatile VExpress modularization 2020-05-15 23:04:40 +02:00
mach-vexpress Revert "ARM: vexpress: Don't select VEXPRESS_CONFIG" 2020-05-28 12:30:33 +02:00
mach-vt8500 ARM: Remove redundant CLKDEV_LOOKUP selects 2020-05-05 12:33:57 -07:00
mach-zx
mach-zynq mm: reorder includes after introduction of linux/pgtable.h 2020-06-09 09:39:13 -07:00
mm maccess: rename probe_kernel_address to get_kernel_nofault 2020-06-18 11:14:40 -07:00
net bpf, arm: Optimize ALU ARSH K using asr immediate instruction 2020-05-04 17:04:42 +02:00
nwfpe
oprofile
plat-omap
plat-orion ARM: orion: replace setup_irq() by request_irq() 2020-03-13 21:37:15 +01:00
plat-pxa
plat-samsung ARM: samsung: Use devm_platform_ioremap_resource() to simplify code 2020-04-21 11:35:00 +02:00
plat-versatile ARM: versatile: Remove dead sched_clock code 2020-04-16 13:02:17 +02:00
probes
tools vfs: add faccessat2 syscall 2020-05-14 16:44:25 +02:00
vdso .gitignore: add SPDX License Identifier 2020-03-25 11:50:48 +01:00
vfp
xen arm/xen: make _xen_start_info static 2020-04-17 07:45:12 +02:00
Kconfig Kbuild updates for v5.8 (2nd) 2020-06-13 13:29:16 -07:00
Kconfig-nommu
Kconfig.debug treewide: replace '---help---' in Kconfig files with 'help' 2020-06-14 01:57:21 +09:00
Makefile Kbuild updates for v5.8 2020-06-06 12:00:25 -07:00