Skip to content
This repository was archived by the owner on Nov 5, 2019. It is now read-only.
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
131 commits
Select commit Hold shift + click to select a range
d341379
floppy: fix div-by-zero in setup_format_params
evdenis Jul 12, 2019
9486594
floppy: fix out-of-bounds read in copy_buffer
evdenis Jul 12, 2019
f1862b7
gather extra early boot entropy like PaX
thestinger Mar 14, 2017
0c4720c
use kernel command-line for early entropy
thestinger Aug 16, 2017
37ab4a8
port of grsecurity's DEVICE_SIDECHANNEL feature
thestinger Jun 23, 2016
dd0bbe4
disable ptrace_scope by default
thestinger Aug 27, 2017
4a57212
arm64: zero the leading stack canary byte
thestinger Mar 23, 2017
14df469
add page sanitization / verification
thestinger Jan 20, 2017
cd6af68
add slub sanitization
thestinger Jan 24, 2017
0fed0d5
slub: add check for write-after-free
thestinger Apr 2, 2017
ce4cb5e
add slub free list XOR encryption
thestinger Jan 23, 2017
a5481b1
slub: add multi-purpose random cookies
thestinger Mar 27, 2017
3d77581
slub: check cookies in __check_heap_object
thestinger Apr 13, 2017
1e2ccc5
add missing cache_from_obj !PageSlab check
thestinger Jan 23, 2017
b0f981e
real slab_equal_or_root check for !MEMCG_KMEM
thestinger Mar 31, 2017
0e72e13
always perform cache_from_obj sanity checks
thestinger Mar 31, 2017
b6c2736
panic on kmem_cache_free with the wrong cache
thestinger Mar 25, 2017
4f4f5b9
panic on !PageSlab && !PageCompound in ksize
thestinger Mar 26, 2017
9903e88
add kmalloc alloc_size attributes
thestinger Apr 10, 2017
bb4cf8f
add vmalloc alloc_size attributes
thestinger Apr 19, 2017
2b1c458
arm64: properly account for stack rnd in mmap base
thestinger May 22, 2017
95cc9cd
arm64: determine stack entropy based on mmap entropy
thestinger May 22, 2017
d98465e
arm64: move ET_DYN base lower in the address space
thestinger May 22, 2017
f190b9a
randomize lower bits of the argument block
thestinger May 11, 2017
5e30710
fix qcacld-2.0 buffer overflows
thestinger May 22, 2017
b3a3169
disable brk system call
thestinger Jun 13, 2017
5ba7ee8
enable protected_{symlinks,hardlinks} by default
thestinger May 30, 2017
f570a98
wcnss: fix 3 byte buffer overflow on MAC change
thestinger Sep 26, 2017
390eaaa
arm64: crypto: increase AES interleave to 4x
Feb 19, 2015
4c8c316
arm64/crypto: issue aese/aesmc instructions in pairs
Mar 17, 2015
9bd2bcd
arm64: crypto: reduce priority of core AES cipher
Nov 16, 2015
64ddf4f
net: Zeroing the structure ethtool_wolinfo in ethtool_get_wol()
May 14, 2014
c8a2c3e
cuse: fix memory leak
szmi Nov 10, 2015
c3ac68a
net: llc: use correct size for sysctl timeout entries
sashalevin Jan 24, 2015
d032ac8
net: rds: use correct size for max unacked packets and bytes
sashalevin Feb 3, 2015
3f0030f
USB: whiteheat: fix potential null-deref at probe
jhovold Sep 23, 2015
1b2e2c2
Input: aiptek - fix crash on detecting device without endpoints
nefigtut Dec 1, 2015
2d37760
USB: serial: visor: fix crash on detecting device without write_urbs
nefigtut Jan 12, 2016
1f21542
kexec/uefi: copy secure_boot flag in boot params across kexec reboot
daveyoung Oct 6, 2015
23fbf4a
media/vivid-osd: fix info leak in ioctl
Oct 7, 2015
64d63aa
staging/dgnc: fix info leak in ioctl
Oct 14, 2015
853bf00
KVM: svm: unconditionally intercept #DB
bonzini Nov 10, 2015
5fd53fb
powerpc/tm: Block signal return setting invalid MSR state
mikey Nov 19, 2015
11cd52e
powerpc/tm: Check for already reclaimed tasks
mikey Nov 19, 2015
5075591
ovl: fix dentry reference leak
dhowells Sep 18, 2015
318551f
x86/mm: Add barriers and document switch_mm()-vs-flush synchronization
amluto Jan 6, 2016
7d989b0
ALSA: hrtimer: Fix stall by hrtimer_cancel()
tiwai Jan 18, 2016
d20b99b
USB: visor: fix null-deref at probe
jhovold Jan 12, 2016
eec9037
x86/mm/32: Enable full randomization on i386 and X86_32
Mar 10, 2016
a40deed
arm: oabi compat: add missing access checks
Jul 28, 2016
ba5e512
msm-core: debug: Update the number of supported pstates.
Aug 22, 2016
048907d
rds: fix an infoleak in rds_inc_info_copy
kengiter Jun 2, 2016
ba2fa39
radio-iris: check argument values before copying the data
Oct 19, 2016
a820623
spcom: check size before calling copy_to_user()
Nov 26, 2016
4996523
spcom: check buf_size validity for user send command
Dec 6, 2016
4446da3
spcom: check buf size for send modified command
Dec 6, 2016
53b895d
ASoC: wcd9320: Fix out of bounds for mad input value
Dec 8, 2016
33e51f4
ASoC: msm: qdsp6v2: DAP: Add check to validate param length
Dec 19, 2016
bb78372
net: ipc_router: fix NULL pointer de-reference issue
Sep 21, 2016
3c8a9d2
s390/sclp_ctl: fix potential information leak with /dev/sclp
Apr 25, 2016
a0127ab
apparmor: fix oops, validate buffer size in apparmor_setprocattr()
vegard Jul 7, 2016
942f6f2
input: synaptics: allocate heap memory for buffer
m-chong Aug 18, 2016
858bbc2
ASoC: msm: qdsp6v2: DAP: Add check to validate data length
ashishrjain Jun 20, 2016
b703140
ASoC: msm: qdsp6v2: DAP: Allocate param buffer with correct size
ashishrjain Jun 30, 2016
283da21
ASoC: msm: qdsp6v2: DAP: Add check to validate param length
ashishrjain Jul 1, 2016
bc423b7
ASoC: msm: qdsp6v2: DAP: Update check to validate data length
ashishrjain Jul 18, 2016
f0694de
msm-core: use get_user() API to read userspace data/settings
Jun 28, 2016
011ae5b
crypto: algif_hash - Only export and import on sockets with data
herbertx Nov 1, 2015
3de3b64
sysctl: Drop reference added by grab_header in proc_sys_readdir
zhouchengming1 Jan 6, 2017
8be9952
USB: gadgetfs: fix unbounded memory allocation bug
AlanStern Dec 9, 2016
8b7c6ca
USB: dummy-hcd: fix bug in stop_activity (handle ep0)
AlanStern Dec 14, 2016
8d940da
USB: gadgetfs: fix checks of wTotalLength in config descriptors
AlanStern Dec 9, 2016
74475b1
USB: gadgetfs: fix use-after-free bug
AlanStern Dec 9, 2016
0cba447
FROMLIST: CHROMIUM: usb: gadget: configfs: Fix KASAN use-after-free
Jan 13, 2017
ad88ea7
ASoC: msm: qdsp6v2: return error when copy from userspace fails
Jan 31, 2017
6dd98ac
input: touchscreen: gt9xx: fix memory corruption in Goodix driver
Jan 23, 2017
1d7e153
Prevent heap overflow in uvc driver
Feb 14, 2017
bb3e55a
BACKPORT: f2fs: sanity check log_blocks_per_seg
Apr 25, 2017
36951bf
KVM: Don't accept obviously wrong gsi values via KVM_IRQFD
schnhrr Sep 7, 2017
de7f777
binfmt_elf: use ELF_ET_DYN_BASE only for PIE
kees Jul 10, 2017
f10099a
msm: gsi: fix memory corruption from debugfs
Aug 3, 2016
a7c6fcf
wil6210: protect against invalid length of tx management frame
Jun 20, 2017
cb49fc9
msm: camera: sensor: Validate destination step position
Feb 7, 2017
8bf7ee5
Bluetooth: hidp_connection_add() unsafe use of l2cap_pi()
Dec 19, 2014
bb6a915
msm: mdss: check the length of the external input buffer properly
Sep 14, 2017
271e62f
USB: fix problems with duplicate endpoint addresses
AlanStern Dec 19, 2016
91fe215
ALSA: usx2y: Fix invalid stream URBs
tiwai Nov 6, 2017
f041420
ALSA: bcd2000: Add a sanity check for invalid EPs
tiwai Oct 4, 2017
78abce4
input: touchscreen: fix buffer overflow issue in synaptics driver
Mar 6, 2017
5315868
msm: mdss: Add check to fix null pointer dereference
Nov 18, 2016
95c2ec0
ASoC: qdsp6v2: prevent null pointer dereference for _vol_cmds
Nov 16, 2016
a37a768
ipc/shm: Fix shmat mmap nil-page protection
Feb 27, 2017
dd8377d
tcp: remove BUG_ON() in tcp_check_req()
edumazet Oct 2, 2015
0d59de6
irda: Fix lockdep annotations in hashbin_delete().
davem330 Feb 17, 2017
dcc97a2
bluetooth: Fix free data pointer routine
Jan 23, 2017
aad7bd1
msm: ba: Fix race conditions in debug writes
Jan 19, 2017
76b478b
iommu: iommu-debug: cleanup iommu debug
May 18, 2017
01efbbb
xfs: don't call xfs_da_shrink_inode with NULL bp
sandeen Jun 8, 2018
2a73fce
x86/paravirt: Fix spectre-v2 mitigations for paravirt guests
Aug 3, 2018
2b1f4fb
xfs: don't fail when converting shortform attr to long form during AT…
djwong Apr 18, 2018
01edb0e
scsi: libsas: fix a race condition when smp task timeout
JasonYanHw Sep 25, 2018
f4bd1be
net: phy: mdio-bcm-unimac: fix potential NULL dereference in unimac_m…
Jan 11, 2018
2239028
drivers/virt/fsl_hypervisor.c: prevent integer overflow in ioctl
May 14, 2019
fe5ec3a
inet: update the IP ID generation algorithm to higher standards.
aksecurity Apr 18, 2019
357e859
tty: mark Siemens R3964 line discipline as BROKEN
gregkh Apr 5, 2019
2ca06f8
ext4: zero out the unused memory region in the extent tree block
rsriramr May 10, 2019
4de06b6
Bluetooth: hidp: fix buffer overflow
Yoha-test Apr 12, 2019
8889f80
ipv6_sockglue: Fix a missing-check bug in ip6_ra_control()
zhanggenex May 24, 2019
192f262
scsi: mpt3sas_ctl: fix double-fetch bug in _ctl_ioctl_main()
zhanggenex May 30, 2019
fd69f2a
powerpc/pseries/dlpar: Fix a missing check in dlpar_parse_cc_property()
zhanggenex May 26, 2019
5eaf7e5
Fix a NULL-ptr-deref bug in ath6kl_usb_alloc_urb_from_pipe
benquike Aug 4, 2019
c461e20
USB: rio500: refuse more than one device at a time
oneukum May 9, 2019
aca4991
media: dvb: usb: fix use after free in dvb_usb_device_exit
oneukum Apr 30, 2019
4d721fb
ALSA: core: Fix card races between register and disconnect
tiwai Apr 16, 2019
1f587ef
USB: yurex: Fix protection fault after device removal
AlanStern Apr 23, 2019
e4758b9
xfrm: policy: Fix out-of-bound array accesses in __xfrm_policy_unlink
Feb 28, 2019
22cb9ff
scsi: libsas: delete sas port if expander discover failed
JasonYanHw May 14, 2019
7924494
ath6kl: add some bounds checking
Apr 4, 2019
4f624e3
ax25: enforce CAP_NET_RAW for raw sockets
Armondile Sep 20, 2019
8537573
UPSTREAM: ANDROID: binder: remove waitqueue when thread exits.
Jan 5, 2018
8e5b29a
msm: camera: Synchronize camera open/close calls.
Aug 22, 2017
c05060f
Bluetooth: Verify that l2cap_get_conf_opt provides large enough buffer
holtmann Jan 18, 2019
c6ded6d
Bluetooth: Check L2CAP option sizes returned from l2cap_get_conf_opt
holtmann Jan 18, 2019
be11da5
net: crypto set sk to NULL when af_alg_release.
Feb 18, 2019
5380e79
ozwpan: Use unsigned ints to prevent heap overflow
zx2c4 May 29, 2017
aaffb67
tcp: fix zero cwnd in tcp_cwnd_reduction
yuchungcheng May 26, 2017
9fc57f2
ASoC: msm: qdsp6v2: DAP: Add check to validate param length
Dec 27, 2016
6a18157
ASoC: msm: qdsp6v2: DAP: Add check to validate data length
ashishrjain Jun 20, 2016
eba7317
ASoC: msm: qdsp6v2: DAP: Update check to validate data length
ashishrjain Jul 18, 2016
0418ca7
ASoC: msm: qdsp6v2: return error when copy from userspace fails
Dec 5, 2016
d0a9fe9
BACKPORT: f2fs: sanity check log_blocks_per_seg
Apr 25, 2017
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 7 additions & 1 deletion arch/arm/kernel/sys_oabi-compat.c
Original file line number Diff line number Diff line change
Expand Up @@ -279,8 +279,12 @@ asmlinkage long sys_oabi_epoll_wait(int epfd,
mm_segment_t fs;
long ret, err, i;

if (maxevents <= 0 || maxevents > (INT_MAX/sizeof(struct epoll_event)))
if (maxevents <= 0 ||
maxevents > (INT_MAX/sizeof(*kbuf)) ||
maxevents > (INT_MAX/sizeof(*events)))
return -EINVAL;
if (!access_ok(VERIFY_WRITE, events, sizeof(*events) * maxevents))
return -EFAULT;
kbuf = kmalloc(sizeof(*kbuf) * maxevents, GFP_KERNEL);
if (!kbuf)
return -ENOMEM;
Expand Down Expand Up @@ -317,6 +321,8 @@ asmlinkage long sys_oabi_semtimedop(int semid,

if (nsops < 1 || nsops > SEMOPM)
return -EINVAL;
if (!access_ok(VERIFY_READ, tsops, sizeof(*tsops) * nsops))
return -EFAULT;
sops = kmalloc(sizeof(*sops) * nsops, GFP_KERNEL);
if (!sops)
return -ENOMEM;
Expand Down
2 changes: 1 addition & 1 deletion arch/arm64/crypto/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ aes-ce-blk-y := aes-glue-ce.o aes-ce.o
obj-$(CONFIG_CRYPTO_AES_ARM64_NEON_BLK) += aes-neon-blk.o
aes-neon-blk-y := aes-glue-neon.o aes-neon.o

AFLAGS_aes-ce.o := -DINTERLEAVE=2 -DINTERLEAVE_INLINE
AFLAGS_aes-ce.o := -DINTERLEAVE=4
AFLAGS_aes-neon.o := -DINTERLEAVE=4

CFLAGS_aes-glue-ce.o := -DUSE_V8_CRYPTO_EXTENSIONS
Expand Down
12 changes: 6 additions & 6 deletions arch/arm64/crypto/aes-ce-ccm-core.S
Original file line number Diff line number Diff line change
Expand Up @@ -101,19 +101,19 @@ ENTRY(ce_aes_ccm_final)
0: mov v4.16b, v3.16b
1: ld1 {v5.2d}, [x2], #16 /* load next round key */
aese v0.16b, v4.16b
aese v1.16b, v4.16b
aesmc v0.16b, v0.16b
aese v1.16b, v4.16b
aesmc v1.16b, v1.16b
2: ld1 {v3.2d}, [x2], #16 /* load next round key */
aese v0.16b, v5.16b
aese v1.16b, v5.16b
aesmc v0.16b, v0.16b
aese v1.16b, v5.16b
aesmc v1.16b, v1.16b
3: ld1 {v4.2d}, [x2], #16 /* load next round key */
subs w3, w3, #3
aese v0.16b, v3.16b
aese v1.16b, v3.16b
aesmc v0.16b, v0.16b
aese v1.16b, v3.16b
aesmc v1.16b, v1.16b
bpl 1b
aese v0.16b, v4.16b
Expand Down Expand Up @@ -146,19 +146,19 @@ ENDPROC(ce_aes_ccm_final)
ld1 {v5.2d}, [x10], #16 /* load 2nd round key */
2: /* inner loop: 3 rounds, 2x interleaved */
aese v0.16b, v4.16b
aese v1.16b, v4.16b
aesmc v0.16b, v0.16b
aese v1.16b, v4.16b
aesmc v1.16b, v1.16b
3: ld1 {v3.2d}, [x10], #16 /* load next round key */
aese v0.16b, v5.16b
aese v1.16b, v5.16b
aesmc v0.16b, v0.16b
aese v1.16b, v5.16b
aesmc v1.16b, v1.16b
4: ld1 {v4.2d}, [x10], #16 /* load next round key */
subs w7, w7, #3
aese v0.16b, v3.16b
aese v1.16b, v3.16b
aesmc v0.16b, v0.16b
aese v1.16b, v3.16b
aesmc v1.16b, v1.16b
ld1 {v5.2d}, [x10], #16 /* load next round key */
bpl 2b
Expand Down
2 changes: 1 addition & 1 deletion arch/arm64/crypto/aes-ce-cipher.c
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,7 @@ static void aes_cipher_decrypt(struct crypto_tfm *tfm, u8 dst[], u8 const src[])
static struct crypto_alg aes_alg = {
.cra_name = "aes",
.cra_driver_name = "aes-ce",
.cra_priority = 300,
.cra_priority = 250,
.cra_flags = CRYPTO_ALG_TYPE_CIPHER,
.cra_blocksize = AES_BLOCK_SIZE,
.cra_ctxsize = sizeof(struct crypto_aes_ctx),
Expand Down
10 changes: 3 additions & 7 deletions arch/arm64/crypto/aes-ce.S
Original file line number Diff line number Diff line change
Expand Up @@ -45,18 +45,14 @@

.macro do_enc_Nx, de, mc, k, i0, i1, i2, i3
aes\de \i0\().16b, \k\().16b
.ifnb \i1
aes\de \i1\().16b, \k\().16b
.ifnb \i3
aes\de \i2\().16b, \k\().16b
aes\de \i3\().16b, \k\().16b
.endif
.endif
aes\mc \i0\().16b, \i0\().16b
.ifnb \i1
aes\de \i1\().16b, \k\().16b
aes\mc \i1\().16b, \i1\().16b
.ifnb \i3
aes\de \i2\().16b, \k\().16b
aes\mc \i2\().16b, \i2\().16b
aes\de \i3\().16b, \k\().16b
aes\mc \i3\().16b, \i3\().16b
.endif
.endif
Expand Down
10 changes: 5 additions & 5 deletions arch/arm64/include/asm/elf.h
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@ typedef struct user_fpsimd_state elf_fpregset_t;
* the loader. We need to make sure that it is out of the way of the program
* that it will "exec", and that there is sufficient room for the brk.
*/
#define ELF_ET_DYN_BASE (2 * TASK_SIZE_64 / 3)
#define ELF_ET_DYN_BASE (U32_MAX)

/*
* When the program starts, a1 contains a pointer to a function to be
Expand All @@ -152,10 +152,10 @@ extern int arch_setup_additional_pages(struct linux_binprm *bprm,
/* 1GB of VA */
#ifdef CONFIG_COMPAT
#define STACK_RND_MASK (test_thread_flag(TIF_32BIT) ? \
0x7ff >> (PAGE_SHIFT - 12) : \
0x3ffff >> (PAGE_SHIFT - 12))
((1UL << mmap_rnd_compat_bits) - 1) >> (PAGE_SHIFT - 12) : \
((1UL << mmap_rnd_bits) - 1) >> (PAGE_SHIFT - 12))
#else
#define STACK_RND_MASK (0x3ffff >> (PAGE_SHIFT - 12))
#define STACK_RND_MASK (((1UL << mmap_rnd_bits) - 1) >> (PAGE_SHIFT - 12))
#endif

struct mm_struct;
Expand All @@ -170,7 +170,7 @@ extern unsigned long arch_randomize_brk(struct mm_struct *mm);
#define COMPAT_ELF_PLATFORM ("v8l")
#endif

#define COMPAT_ELF_ET_DYN_BASE (2 * TASK_SIZE_32 / 3)
#define COMPAT_ELF_ET_DYN_BASE (0x10000000UL)

/* AArch32 registers. */
#define COMPAT_ELF_NGREG 18
Expand Down
3 changes: 3 additions & 0 deletions arch/arm64/include/asm/stackprotector.h
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,9 @@ static __always_inline void boot_init_stack_canary(void)
get_random_bytes(&canary, sizeof(canary));
canary ^= LINUX_VERSION_CODE;

/* Sacrifice 8 bits of entropy to mitigate non-terminated C string overflows */
canary &= ~(unsigned long)0xff;

current->stack_canary = canary;
__stack_chk_guard = current->stack_canary;
}
Expand Down
2 changes: 1 addition & 1 deletion arch/arm64/include/asm/unistd32.h
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ __SYSCALL(__NR_times, compat_sys_times)
/* 44 was sys_prof */
__SYSCALL(44, sys_ni_syscall)
#define __NR_brk 45
__SYSCALL(__NR_brk, sys_brk)
__SYSCALL(__NR_brk, sys_ni_syscall)
#define __NR_setgid 46
__SYSCALL(__NR_setgid, sys_setgid16)
#define __NR_getgid 47
Expand Down
5 changes: 4 additions & 1 deletion arch/arm64/mm/mmap.c
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
* Leave enough space between the mmap area and the stack to honour ulimit in
* the face of randomisation.
*/
#define MIN_GAP (SZ_128M + ((STACK_RND_MASK << PAGE_SHIFT) + 1))
#define MIN_GAP (SZ_128M)
#define MAX_GAP (STACK_TOP/6*5)

static int mmap_is_legacy(void)
Expand Down Expand Up @@ -65,6 +65,9 @@ unsigned long arch_mmap_rnd(void)
static unsigned long mmap_base(unsigned long rnd)
{
unsigned long gap = rlimit(RLIMIT_STACK);
unsigned long pad = STACK_RND_MASK << PAGE_SHIFT;
if (gap + pad > gap)
gap += pad;

if (gap < MIN_GAP)
gap = MIN_GAP;
Expand Down
1 change: 1 addition & 0 deletions arch/powerpc/include/asm/reg.h
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,7 @@
#define MSR_TS_T __MASK(MSR_TS_T_LG) /* Transaction Transactional */
#define MSR_TS_MASK (MSR_TS_T | MSR_TS_S) /* Transaction State bits */
#define MSR_TM_ACTIVE(x) (((x) & MSR_TS_MASK) != 0) /* Transaction active? */
#define MSR_TM_RESV(x) (((x) & MSR_TS_MASK) == MSR_TS_MASK) /* Reserved */
#define MSR_TM_TRANSACTIONAL(x) (((x) & MSR_TS_MASK) == MSR_TS_T)
#define MSR_TM_SUSPENDED(x) (((x) & MSR_TS_MASK) == MSR_TS_S)

Expand Down
18 changes: 18 additions & 0 deletions arch/powerpc/kernel/process.c
Original file line number Diff line number Diff line change
Expand Up @@ -554,6 +554,24 @@ static void tm_reclaim_thread(struct thread_struct *thr,
msr_diff &= MSR_FP | MSR_VEC | MSR_VSX | MSR_FE0 | MSR_FE1;
}

/*
* Use the current MSR TM suspended bit to track if we have
* checkpointed state outstanding.
* On signal delivery, we'd normally reclaim the checkpointed
* state to obtain stack pointer (see:get_tm_stackpointer()).
* This will then directly return to userspace without going
* through __switch_to(). However, if the stack frame is bad,
* we need to exit this thread which calls __switch_to() which
* will again attempt to reclaim the already saved tm state.
* Hence we need to check that we've not already reclaimed
* this state.
* We do this using the current MSR, rather tracking it in
* some specific thread_struct bit, as it has the additional
* benifit of checking for a potential TM bad thing exception.
*/
if (!MSR_TM_SUSPENDED(mfmsr()))
return;

tm_reclaim(thr, thr->regs->msr, cause);

/* Having done the reclaim, we now have the checkpointed
Expand Down
14 changes: 9 additions & 5 deletions arch/powerpc/kernel/signal_32.c
Original file line number Diff line number Diff line change
Expand Up @@ -875,6 +875,15 @@ static long restore_tm_user_regs(struct pt_regs *regs,
return 1;
#endif /* CONFIG_SPE */

/* Get the top half of the MSR from the user context */
if (__get_user(msr_hi, &tm_sr->mc_gregs[PT_MSR]))
return 1;
msr_hi <<= 32;
/* If TM bits are set to the reserved value, it's an invalid context */
if (MSR_TM_RESV(msr_hi))
return 1;
/* Pull in the MSR TM bits from the user context */
regs->msr = (regs->msr & ~MSR_TS_MASK) | (msr_hi & MSR_TS_MASK);
/* Now, recheckpoint. This loads up all of the checkpointed (older)
* registers, including FP and V[S]Rs. After recheckpointing, the
* transactional versions should be loaded.
Expand All @@ -884,11 +893,6 @@ static long restore_tm_user_regs(struct pt_regs *regs,
current->thread.tm_texasr |= TEXASR_FS;
/* This loads the checkpointed FP/VEC state, if used */
tm_recheckpoint(&current->thread, msr);
/* Get the top half of the MSR */
if (__get_user(msr_hi, &tm_sr->mc_gregs[PT_MSR]))
return 1;
/* Pull in MSR TM from user context */
regs->msr = (regs->msr & ~MSR_TS_MASK) | ((msr_hi<<32) & MSR_TS_MASK);

/* This loads the speculative FP/VEC state, if used */
if (msr & MSR_FP) {
Expand Down
4 changes: 4 additions & 0 deletions arch/powerpc/kernel/signal_64.c
Original file line number Diff line number Diff line change
Expand Up @@ -427,6 +427,10 @@ static long restore_tm_sigcontexts(struct pt_regs *regs,

/* get MSR separately, transfer the LE bit if doing signal return */
err |= __get_user(msr, &sc->gp_regs[PT_MSR]);
/* Don't allow reserved mode. */
if (MSR_TM_RESV(msr))
return -EINVAL;

/* pull in MSR TM from user context */
regs->msr = (regs->msr & ~MSR_TS_MASK) | (msr & MSR_TS_MASK);

Expand Down
4 changes: 4 additions & 0 deletions arch/powerpc/platforms/pseries/dlpar.c
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,10 @@ static struct property *dlpar_parse_cc_property(struct cc_workarea *ccwa)

name = (char *)ccwa + be32_to_cpu(ccwa->name_offset);
prop->name = kstrdup(name, GFP_KERNEL);
if (!prop->name) {
dlpar_free_cc_property(prop);
return NULL;
}

prop->length = be32_to_cpu(ccwa->prop_length);
value = (char *)ccwa + be32_to_cpu(ccwa->prop_offset);
Expand Down
13 changes: 7 additions & 6 deletions arch/x86/include/asm/elf.h
Original file line number Diff line number Diff line change
Expand Up @@ -244,12 +244,13 @@ extern int force_personality32;
#define CORE_DUMP_USE_REGSET
#define ELF_EXEC_PAGESIZE 4096

/* This is the location that an ET_DYN program is loaded if exec'ed. Typical
use of this is to invoke "./ld.so someprog" to test out a new version of
the loader. We need to make sure that it is out of the way of the program
that it will "exec", and that there is sufficient room for the brk. */

#define ELF_ET_DYN_BASE (TASK_SIZE / 3 * 2)
/*
* This is the base location for PIE (ET_DYN with INTERP) loads. On
* 64-bit, this is raised to 4GB to leave the entire 32-bit address
* space open for things that want to use the area for 32-bit pointers.
*/
#define ELF_ET_DYN_BASE (mmap_is_ia32() ? 0x000400000UL : \
0x100000000UL)

/* This yields a mask that user programs can use to figure out what
instruction set this CPU supports. This could be done in user space,
Expand Down
33 changes: 32 additions & 1 deletion arch/x86/include/asm/mmu_context.h
Original file line number Diff line number Diff line change
Expand Up @@ -90,8 +90,34 @@ static inline void switch_mm(struct mm_struct *prev, struct mm_struct *next,
#endif
cpumask_set_cpu(cpu, mm_cpumask(next));

/* Re-load page tables */
/*
* Re-load page tables.
*
* This logic has an ordering constraint:
*
* CPU 0: Write to a PTE for 'next'
* CPU 0: load bit 1 in mm_cpumask. if nonzero, send IPI.
* CPU 1: set bit 1 in next's mm_cpumask
* CPU 1: load from the PTE that CPU 0 writes (implicit)
*
* We need to prevent an outcome in which CPU 1 observes
* the new PTE value and CPU 0 observes bit 1 clear in
* mm_cpumask. (If that occurs, then the IPI will never
* be sent, and CPU 0's TLB will contain a stale entry.)
*
* The bad outcome can occur if either CPU's load is
* reordered before that CPU's store, so both CPUs much
* execute full barriers to prevent this from happening.
*
* Thus, switch_mm needs a full barrier between the
* store to mm_cpumask and any operation that could load
* from next->pgd. This barrier synchronizes with
* remote TLB flushers. Fortunately, load_cr3 is
* serializing and thus acts as a full barrier.
*
*/
load_cr3(next->pgd);

trace_tlb_flush(TLB_FLUSH_ON_TASK_SWITCH, TLB_FLUSH_ALL);

/* Stop flush ipis for the previous mm */
Expand All @@ -114,10 +140,15 @@ static inline void switch_mm(struct mm_struct *prev, struct mm_struct *next,
* schedule, protecting us from simultaneous changes.
*/
cpumask_set_cpu(cpu, mm_cpumask(next));

/*
* We were in lazy tlb mode and leave_mm disabled
* tlb flush IPI delivery. We must reload CR3
* to make sure to use no freed page tables.
*
* As above, this is a barrier that forces
* TLB repopulation to be ordered after the
* store to mm_cpumask.
*/
load_cr3(next->pgd);
trace_tlb_flush(TLB_FLUSH_ON_TASK_SWITCH, TLB_FLUSH_ALL);
Expand Down
1 change: 1 addition & 0 deletions arch/x86/kernel/kexec-bzimage64.c
Original file line number Diff line number Diff line change
Expand Up @@ -182,6 +182,7 @@ setup_efi_state(struct boot_params *params, unsigned long params_load_addr,
if (efi_enabled(EFI_OLD_MEMMAP))
return 0;

params->secure_boot = boot_params.secure_boot;
ei->efi_loader_signature = current_ei->efi_loader_signature;
ei->efi_systab = current_ei->efi_systab;
ei->efi_systab_hi = current_ei->efi_systab_hi;
Expand Down
14 changes: 10 additions & 4 deletions arch/x86/kernel/paravirt.c
Original file line number Diff line number Diff line change
Expand Up @@ -97,10 +97,12 @@ unsigned paravirt_patch_call(void *insnbuf,
struct branch *b = insnbuf;
unsigned long delta = (unsigned long)target - (addr+5);

if (tgt_clobbers & ~site_clobbers)
return len; /* target would clobber too much for this site */
if (len < 5)
if (len < 5) {
#ifdef CONFIG_RETPOLINE
WARN_ONCE("Failing to patch indirect CALL in %ps\n", (void *)addr);
#endif
return len; /* call too long for patch site */
}

b->opcode = 0xe8; /* call */
b->delta = delta;
Expand All @@ -115,8 +117,12 @@ unsigned paravirt_patch_jmp(void *insnbuf, const void *target,
struct branch *b = insnbuf;
unsigned long delta = (unsigned long)target - (addr+5);

if (len < 5)
if (len < 5) {
#ifdef CONFIG_RETPOLINE
WARN_ONCE("Failing to patch indirect JMP in %ps\n", (void *)addr);
#endif
return len; /* call too long for patch site */
}

b->opcode = 0xe9; /* jmp */
b->delta = delta;
Expand Down
Loading