android_kernel_google_msm/drivers/char
dcashman 6f8746868e FROMLIST: drivers: char: random: add get_random_long()
(cherry picked from commit https://lkml.org/lkml/2016/2/4/831)

d07e22597d1d355 ("mm: mmap: add new /proc tunable for mmap_base ASLR")
added the ability to choose from a range of values to use for entropy
count in generating the random offset to the mmap_base address.  The
maximum value on this range was set to 32 bits for 64-bit x86 systems, but
this value could be increased further, requiring more than the 32 bits of
randomness provided by get_random_int(), as is already possible for arm64.
Add a new function: get_random_long() which more naturally fits with the
mmap usage of get_random_int() but operates exactly the same as
get_random_int().

Also, fix the shifting constant in mmap_rnd() to be an unsigned long so
that values greater than 31 bits generate an appropriate mask without
overflow.  This is especially important on x86, as its shift instruction
uses a 5-bit mask for the shift operand, which meant that any value for
mmap_rnd_bits over 31 acts as a no-op and effectively disables mmap_base
randomization.

Finally, replace calls to get_random_int() with get_random_long() where
appropriate.

Bug: 26963541
Signed-off-by: Daniel Cashman <dcashman@android.com>
Signed-off-by: Daniel Cashman <dcashman@google.com>
Change-Id: Ie7552631b5db86f3482cf15e7dc916d89c1c502b
2017-12-27 22:50:11 +03:00
..
agp agp/intel: Fix typo in needs_ilk_vtd_wa() 2015-10-22 09:20:06 +08:00
diag char: Fix NULL pointer dereferences 2016-10-29 23:12:34 +08:00
hw_random Merge remote-tracking branch 'stable/linux-3.4.y' into lineage-15.1 2017-12-27 17:13:15 +03:00
ipmi ipmi: fix timeout calculation when bmc is disconnected 2015-09-18 09:20:46 +08:00
mwave
pcmcia
tpm Merge remote-tracking branch 'stable/linux-3.4.y' into lineage-15.1 2017-12-27 17:13:15 +03:00
xilinx_hwicap
adsprpc.c char: Fix NULL pointer dereferences 2016-10-29 23:12:34 +08:00
adsprpc_shared.h
apm-emulation.c
applicom.c
applicom.h
bfin-otp.c
bsr.c
csdio.c
dcc_tty.c
ds1302.c
ds1620.c
dsp56k.c
dtlk.c
efirtc.c
generic_nvram.c
genrtc.c
hangcheck-timer.c
hpet.c
i8k.c
Kconfig
lp.c
Makefile
mbcs.c
mbcs.h
mem.c mm: Tighten x86 /dev/mem with zeroing reads 2017-07-04 12:34:19 +03:00
misc.c
mmtimer.c
msm_rotator.c
msm_smd_pkt.c
mspec.c
nsc_gpio.c
nvram.c
nwbutton.c
nwbutton.h
nwflash.c
pc8736x_gpio.c
ppdev.c
ps3flash.c
ramoops.c
random.c FROMLIST: drivers: char: random: add get_random_long() 2017-12-27 22:50:11 +03:00
raw.c
rtc.c
scx200_gpio.c
snsc.c
snsc.h
snsc_event.c
sonypi.c
tb0219.c
tile-srom.c
tlclk.c
toshiba.c
ttyprintk.c
uv_mmtimer.c
virtio_console.c virtio_console: avoid config access from irq 2015-06-19 11:40:25 +08:00