ARC fixes for 5.13-rc7
- ARCv2 userspace ABI not populating a few registers - Unbork CONFIG_HARDENED_USERCOPY for ARC -----BEGIN PGP SIGNATURE----- iQIzBAABCgAdFiEEOXpuCuR6hedrdLCJadfx3eKKwl4FAmDM0qkACgkQadfx3eKK wl4YaBAAhFqYprf2OOqHhJ1DhZJjvqZ+VGdptA/vlKuxHCpQjp36H4CSKESTJMwJ Od+vgo9D6ZVDrS2SD7wQyYdXvtTJll5rF4QMN7vOVSvH4grAMECum6pgNAlTBtXu s1M6B/Xi/PEkIqZMGeKga6GIIIlEMX8pOXTYw0n3j6N1cnW+RZzXf4t6um72Eq6h KnMUdaZgIS8nQTCf2FJniPYC0UvIfi5Ru33cLK2IywG6eW3nsf9KwG2efF2oQgtx uSGd2j+pnAZdWIX5/o2FyrpoOTxMRyPM10TJXPoeYIXWnnwLQVzW6NfdMiISNYq5 PtPOJn7/eEQmEm0c+EPUKwjnjGonBqjfx3DR0pUly3ATuok+rjYHH1j1qr1LSAaI 2smQyseTQZ0V+S6v22Su599KL8sQ8IKxQ0BptJeN1VI8Pgau3gkFabC/ghupYrfR H7fynF69V1WSh9zxcCQ9EP24WX8Oi5CRhqmT3zHY+INyZ7ZXF/j6OSIEKSW+wul+ e/3AJGjuhCMwGhEeApEb/pGy8mm8QqBnCwY/gG8EZtgWHPLJcsZ7WBbabkF24Efn DTw9XYd+gTV2g1nast8aKiWXZf9l7bIneKMB+MWbUnFbUxM9QIvY3EW/CLiRoSsM +uJrBbgcm/HIzAcSj6oSBK8lyL72GFH1lIom4M38kNVkSzz2PRM= =F11Z -----END PGP SIGNATURE----- Merge tag 'arc-5.13-rc7-fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/vgupta/arc Pull ARC fixes from Vineet Gupta: - ARCv2 userspace ABI not populating a few registers - Unbork CONFIG_HARDENED_USERCOPY for ARC * tag 'arc-5.13-rc7-fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/vgupta/arc: ARC: fix CONFIG_HARDENED_USERCOPY ARCv2: save ABI registers across signal handling
This commit is contained in:
commit
b1edae0d5f
@ -18,6 +18,7 @@
|
||||
*/
|
||||
struct sigcontext {
|
||||
struct user_regs_struct regs;
|
||||
struct user_regs_arcv2 v2abi;
|
||||
};
|
||||
|
||||
#endif /* _ASM_ARC_SIGCONTEXT_H */
|
||||
|
@ -61,6 +61,41 @@ struct rt_sigframe {
|
||||
unsigned int sigret_magic;
|
||||
};
|
||||
|
||||
static int save_arcv2_regs(struct sigcontext *mctx, struct pt_regs *regs)
|
||||
{
|
||||
int err = 0;
|
||||
#ifndef CONFIG_ISA_ARCOMPACT
|
||||
struct user_regs_arcv2 v2abi;
|
||||
|
||||
v2abi.r30 = regs->r30;
|
||||
#ifdef CONFIG_ARC_HAS_ACCL_REGS
|
||||
v2abi.r58 = regs->r58;
|
||||
v2abi.r59 = regs->r59;
|
||||
#else
|
||||
v2abi.r58 = v2abi.r59 = 0;
|
||||
#endif
|
||||
err = __copy_to_user(&mctx->v2abi, &v2abi, sizeof(v2abi));
|
||||
#endif
|
||||
return err;
|
||||
}
|
||||
|
||||
static int restore_arcv2_regs(struct sigcontext *mctx, struct pt_regs *regs)
|
||||
{
|
||||
int err = 0;
|
||||
#ifndef CONFIG_ISA_ARCOMPACT
|
||||
struct user_regs_arcv2 v2abi;
|
||||
|
||||
err = __copy_from_user(&v2abi, &mctx->v2abi, sizeof(v2abi));
|
||||
|
||||
regs->r30 = v2abi.r30;
|
||||
#ifdef CONFIG_ARC_HAS_ACCL_REGS
|
||||
regs->r58 = v2abi.r58;
|
||||
regs->r59 = v2abi.r59;
|
||||
#endif
|
||||
#endif
|
||||
return err;
|
||||
}
|
||||
|
||||
static int
|
||||
stash_usr_regs(struct rt_sigframe __user *sf, struct pt_regs *regs,
|
||||
sigset_t *set)
|
||||
@ -94,6 +129,10 @@ stash_usr_regs(struct rt_sigframe __user *sf, struct pt_regs *regs,
|
||||
|
||||
err = __copy_to_user(&(sf->uc.uc_mcontext.regs.scratch), &uregs.scratch,
|
||||
sizeof(sf->uc.uc_mcontext.regs.scratch));
|
||||
|
||||
if (is_isa_arcv2())
|
||||
err |= save_arcv2_regs(&(sf->uc.uc_mcontext), regs);
|
||||
|
||||
err |= __copy_to_user(&sf->uc.uc_sigmask, set, sizeof(sigset_t));
|
||||
|
||||
return err ? -EFAULT : 0;
|
||||
@ -109,6 +148,10 @@ static int restore_usr_regs(struct pt_regs *regs, struct rt_sigframe __user *sf)
|
||||
err |= __copy_from_user(&uregs.scratch,
|
||||
&(sf->uc.uc_mcontext.regs.scratch),
|
||||
sizeof(sf->uc.uc_mcontext.regs.scratch));
|
||||
|
||||
if (is_isa_arcv2())
|
||||
err |= restore_arcv2_regs(&(sf->uc.uc_mcontext), regs);
|
||||
|
||||
if (err)
|
||||
return -EFAULT;
|
||||
|
||||
|
@ -57,7 +57,6 @@ SECTIONS
|
||||
.init.ramfs : { INIT_RAM_FS }
|
||||
|
||||
. = ALIGN(PAGE_SIZE);
|
||||
_stext = .;
|
||||
|
||||
HEAD_TEXT_SECTION
|
||||
INIT_TEXT_SECTION(L1_CACHE_BYTES)
|
||||
@ -83,6 +82,7 @@ SECTIONS
|
||||
|
||||
.text : {
|
||||
_text = .;
|
||||
_stext = .;
|
||||
TEXT_TEXT
|
||||
SCHED_TEXT
|
||||
CPUIDLE_TEXT
|
||||
|
Loading…
x
Reference in New Issue
Block a user