tmp_suning_uos_patched/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
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
mach-alpine
mach-artpec
mach-asm9260
mach-aspeed
mach-at91
mach-axxia
mach-bcm
mach-berlin
mach-clps711x
mach-cns3xxx
mach-davinci
mach-digicolor
mach-dove
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
mach-exynos
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
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
mach-mxs
mach-nomadik
mach-npcm
mach-nspire
mach-omap1
mach-omap2 ARM: DT changes for v5.8 2020-06-04 20:02:14 -07:00
mach-orion5x
mach-oxnas
mach-picoxcell
mach-prima2
mach-pxa
mach-qcom
mach-rda
mach-realtek
mach-realview
mach-rockchip
mach-rpc
mach-s3c24xx
mach-s3c64xx
mach-s5pv210
mach-sa1100 mm: pgtable: add shortcuts for accessing kernel PMD and PTE 2020-06-09 09:39:13 -07:00
mach-shmobile
mach-socfpga
mach-spear
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
mach-vexpress
mach-vt8500
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
nwfpe
oprofile
plat-omap
plat-orion
plat-pxa
plat-samsung
plat-versatile
probes
tools
vdso
vfp
xen
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