linux/arch
Matt Fleming e535ec0899 x86/mm/pat: Prevent hang during boot when mapping pages
There's a mixture of signed 32-bit and unsigned 32-bit and 64-bit data
types used for keeping track of how many pages have been mapped.

This leads to hangs during boot when mapping large numbers of pages
(multiple terabytes, as reported by Waiman) because those values are
interpreted as being negative.

commit 742563777e ("x86/mm/pat: Avoid truncation when converting
cpa->numpages to address") fixed one of those bugs, but there is
another lurking in __change_page_attr_set_clr().

Additionally, the return value type for the populate_*() functions can
return negative values when a large number of pages have been mapped,
triggering the error paths even though no error occurred.

Consistently use 64-bit types on 64-bit platforms when counting pages.
Even in the signed case this gives us room for regions 8PiB
(pebibytes) in size whilst still allowing the usual negative value
error checking idiom.

Reported-by: Waiman Long <waiman.long@hpe.com>
Cc: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Cc: Borislav Petkov <bp@alien8.de>
Cc: Linus Torvalds <torvalds@linux-foundation.org>
CC: Theodore Ts'o <tytso@mit.edu>
Cc: Arnd Bergmann <arnd@arndb.de>
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Cc: Scott J Norton <scott.norton@hpe.com>
Cc: Douglas Hatch <doug.hatch@hpe.com>
Signed-off-by: Matt Fleming <matt@codeblueprint.co.uk>
2016-09-20 14:53:00 +01:00
..
alpha alpha: fix copy_from_user() 2016-09-09 19:34:32 -04:00
arc Merge branch 'uaccess-fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs 2016-09-14 09:35:05 -07:00
arm ARM: SoC fixes 2016-09-16 12:15:41 -07:00
arm64 ARM: SoC fixes 2016-09-16 12:15:41 -07:00
avr32 avr32: fix 'undefined reference to `___copy_from_user' 2016-09-18 07:26:26 -07:00
blackfin Merge branch 'uaccess-fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs 2016-09-14 09:35:05 -07:00
c6x dma-mapping: use unsigned long for dma_attrs 2016-08-04 08:50:07 -04:00
cris cris: buggered copy_from_user/copy_to_user/clear_user 2016-09-13 17:49:38 -04:00
frv frv: fix clear_user() 2016-09-13 17:49:39 -04:00
h8300 h8300: Add missing include file to asm/io.h 2016-08-13 08:53:56 -07:00
hexagon hexagon: fix strncpy_from_user() error return 2016-09-13 17:49:39 -04:00
ia64 Merge branch 'uaccess-fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs 2016-09-14 09:35:05 -07:00
m32r m32r: fix __get_user() 2016-09-13 17:50:16 -04:00
m68k m68knommu: fix user a5 register being overwritten 2016-08-08 12:38:47 +10:00
metag metag: copy_from_user() should zero the destination on access_ok() failure 2016-09-13 17:49:40 -04:00
microblaze microblaze: fix __get_user() 2016-09-13 17:50:17 -04:00
mips Merge branch 'uaccess-fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs 2016-09-14 09:35:05 -07:00
mn10300 mn10300: copy_from_user() should zero on access_ok() failure... 2016-09-13 17:49:42 -04:00
nios2 nios2: fix __get_user() 2016-09-13 17:49:43 -04:00
openrisc openrisc: fix the fix of copy_from_user() 2016-09-18 07:26:42 -07:00
parisc Merge branch 'uaccess-fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs 2016-09-14 09:35:05 -07:00
powerpc powerpc fixes for 4.8 #6 2016-09-17 12:52:01 -07:00
s390 Merge branch 'uaccess-fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs 2016-09-14 09:35:05 -07:00
score score: fix copy_from_user() and friends 2016-09-13 17:50:14 -04:00
sh sh: fix copy_from_user() 2016-09-13 17:50:15 -04:00
sparc Merge branch 'uaccess-fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs 2016-09-14 09:35:05 -07:00
tile mm/usercopy: get rid of CONFIG_DEBUG_STRICT_USER_COPY_CHECKS 2016-08-30 10:10:21 -07:00
um um/ptrace: Fix the syscall number update after a ptrace 2016-09-07 09:25:04 -07:00
unicore32 unicore32: mm: Add missing parameter to arch_vma_access_permitted 2016-08-13 08:53:18 -07:00
x86 x86/mm/pat: Prevent hang during boot when mapping pages 2016-09-20 14:53:00 +01:00
xtensa dma-mapping: use unsigned long for dma_attrs 2016-08-04 08:50:07 -04:00
.gitignore
Kconfig seccomp: Remove 2-phase API documentation 2016-09-07 09:25:05 -07:00