mirror of
https://github.com/torvalds/linux.git
synced 2026-09-14 16:10:02 +02:00
OpenRISC fix for 7.2
A bug fix found by researchers.
* Ensure to mask all privileged bits when restoring the supervisor
register from sigreturn.
-----BEGIN PGP SIGNATURE-----
iQIzBAABCgAdFiEE2cRzVK74bBA6Je/xw7McLV5mJ+QFAmqABmQACgkQw7McLV5m
J+TL9A/7BmXvg+A5KT0xKxYrC//OCvD5dGwwKVhc5tEtNhpcWZU4fQo9WioRUpcz
OfbBcKN4RGrpm9Do685mqc2+nOGFcK9SId6eN47ri2G1ZJ1+wXE1IVKLIddlpBzp
rBJJyStBAKG2ICQfgoKM26JGbRttH19hJWSDITLzA2vAMp2gxpV7I1tSiLMrbOym
e/fKuclQ2tlH3DX+CJrRia/azeKRMjhlTCsSCH+FQSG+oegtCd6PP+rWi+i7cIas
pdSrDes+ES6LcGncK+uaNQfIi4D9tm37POYOK1zq4cyQknl4yl0mCWzHDegHocM3
EMAeZXgIxWR2sDn/xGl42gXsEjsIxgwUn9eufvAaNNVomFKOE8cVTsTAI7sgOCsj
9eiLLTCAQdGt8wiKYZLfnSm/tkIrtUs+Uc0v1OWslWUN9pVOuhiE5RYVwt6oOgyf
/16K0OFVggElHSyCkk9WPWryER1fg2n/eaOHflyOCO7YaQj9LL2e6TkVae7jQ+re
vZ1ZgNuSO9ZchcemvtQ0gH28sceRy+R2ICQV7ytuR+7Isxk1kQwXuKFhjNkKcy35
pTVFaFY1d/PwrtgUglk45/9ITFLJZNiz4ToE8jrP8P9+DlQhdp7tmZ2gNmtPb3Ll
H0fOU2Bh4QeAQm4T0XDGlm1U2eGA5gy3HFUUNMXomLdNfpT2vIU=
=p9Ll
-----END PGP SIGNATURE-----
Merge tag 'for-linus' of https://github.com/openrisc/linux
Pull OpenRISC fix from Stafford Horne:
"A bug fix found by researchers:
- mask all privileged bits when restoring the supervisor register
from sigreturn"
* tag 'for-linus' of https://github.com/openrisc/linux:
openrisc: signal: do not restore privileged SR bits on sigreturn
This commit is contained in:
commit
5e060ff9d1
|
|
@ -26,6 +26,8 @@
|
|||
| SPR_SR_DCE | SPR_SR_SM)
|
||||
#define USER_SR (SPR_SR_DME | SPR_SR_IME | SPR_SR_ICE \
|
||||
| SPR_SR_DCE | SPR_SR_IEE | SPR_SR_TEE)
|
||||
/* SR bits user space may change via sigreturn, the rest stay kernel owned */
|
||||
#define SPR_SR_USER_MASK (SPR_SR_F | SPR_SR_CY | SPR_SR_OV)
|
||||
|
||||
/*
|
||||
* User space process size. This is hardcoded into a few places,
|
||||
|
|
|
|||
|
|
@ -74,6 +74,7 @@ static long save_fp_state(struct sigcontext __user *sc)
|
|||
static int restore_sigcontext(struct pt_regs *regs,
|
||||
struct sigcontext __user *sc)
|
||||
{
|
||||
unsigned long old_sr = regs->sr;
|
||||
int err = 0;
|
||||
|
||||
/* Always make any pending restarted system calls return -EINTR */
|
||||
|
|
@ -89,8 +90,8 @@ static int restore_sigcontext(struct pt_regs *regs,
|
|||
err |= __copy_from_user(®s->sr, &sc->regs.sr, sizeof(unsigned long));
|
||||
err |= restore_fp_state(sc);
|
||||
|
||||
/* make sure the SM-bit is cleared so user-mode cannot fool us */
|
||||
regs->sr &= ~SPR_SR_SM;
|
||||
/* keep the privileged SR bits kernel owned, restore only user flags */
|
||||
regs->sr = (old_sr & ~SPR_SR_USER_MASK) | (regs->sr & SPR_SR_USER_MASK);
|
||||
|
||||
regs->orig_gpr11 = -1; /* Avoid syscall restart checks */
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user