Lines Matching full:user
68 static void init_user_layout(struct rt_sigframe_user_layout *user) in init_user_layout() argument
71 sizeof(user->sigframe->uc.uc_mcontext.__reserved); in init_user_layout()
73 memset(user, 0, sizeof(*user)); in init_user_layout()
74 user->size = offsetof(struct rt_sigframe, uc.uc_mcontext.__reserved); in init_user_layout()
76 user->limit = user->size + reserved_size; in init_user_layout()
78 user->limit -= TERMINATOR_SIZE; in init_user_layout()
79 user->limit -= EXTRA_CONTEXT_SIZE; in init_user_layout()
83 static size_t sigframe_size(struct rt_sigframe_user_layout const *user) in sigframe_size() argument
85 return round_up(max(user->size, sizeof(struct rt_sigframe)), 16); in sigframe_size()
96 static int __sigframe_alloc(struct rt_sigframe_user_layout *user, in __sigframe_alloc() argument
101 if (padded_size > user->limit - user->size && in __sigframe_alloc()
102 !user->extra_offset && in __sigframe_alloc()
106 user->limit += EXTRA_CONTEXT_SIZE; in __sigframe_alloc()
107 ret = __sigframe_alloc(user, &user->extra_offset, in __sigframe_alloc()
110 user->limit -= EXTRA_CONTEXT_SIZE; in __sigframe_alloc()
115 user->size += TERMINATOR_SIZE; in __sigframe_alloc()
121 user->limit = SIGFRAME_MAXSZ - TERMINATOR_SIZE; in __sigframe_alloc()
125 if (padded_size > user->limit - user->size) in __sigframe_alloc()
128 *offset = user->size; in __sigframe_alloc()
129 user->size += padded_size; in __sigframe_alloc()
135 * Allocate space for an optional record of <size> bytes in the user
139 static int sigframe_alloc(struct rt_sigframe_user_layout *user, in sigframe_alloc() argument
142 return __sigframe_alloc(user, offset, size, true); in sigframe_alloc()
146 static int sigframe_alloc_end(struct rt_sigframe_user_layout *user) in sigframe_alloc_end() argument
151 user->limit += TERMINATOR_SIZE; in sigframe_alloc_end()
153 ret = sigframe_alloc(user, &user->end_offset, in sigframe_alloc_end()
159 user->limit = user->size; in sigframe_alloc_end()
164 struct rt_sigframe_user_layout const *user, unsigned long offset) in apply_user_offset() argument
166 char __user *base = (char __user *)user->sigframe; in apply_user_offset()
267 static int restore_sve_fpsimd_context(struct user_ctxs *user) in restore_sve_fpsimd_context() argument
274 if (__copy_from_user(&sve, user->sve, sizeof(sve))) in restore_sve_fpsimd_context()
292 if (sve.head.size <= sizeof(*user->sve)) { in restore_sve_fpsimd_context()
320 (char __user const *)user->sve + in restore_sve_fpsimd_context()
333 /* restore_sigframe() already checked that user->fpsimd != NULL. */ in restore_sve_fpsimd_context()
334 err = __copy_from_user(fpsimd.vregs, user->fpsimd->vregs, in restore_sve_fpsimd_context()
336 __get_user_error(fpsimd.fpsr, &user->fpsimd->fpsr, err); in restore_sve_fpsimd_context()
337 __get_user_error(fpsimd.fpcr, &user->fpsimd->fpcr, err); in restore_sve_fpsimd_context()
348 static int restore_sve_fpsimd_context(struct user_ctxs *user) in restore_sve_fpsimd_context() argument
396 static int restore_za_context(struct user_ctxs *user) in restore_za_context() argument
402 if (__copy_from_user(&za, user->za, sizeof(za))) in restore_za_context()
408 if (za.head.size <= sizeof(*user->za)) { in restore_za_context()
436 (char __user const *)user->za + in restore_za_context()
451 extern int restore_za_context(struct user_ctxs *user);
455 static int parse_user_sigframe(struct user_ctxs *user, in parse_user_sigframe() argument
466 user->fpsimd = NULL; in parse_user_sigframe()
467 user->sve = NULL; in parse_user_sigframe()
468 user->za = NULL; in parse_user_sigframe()
508 if (user->fpsimd) in parse_user_sigframe()
511 if (size < sizeof(*user->fpsimd)) in parse_user_sigframe()
514 user->fpsimd = (struct fpsimd_context __user *)head; in parse_user_sigframe()
525 if (user->sve) in parse_user_sigframe()
528 if (size < sizeof(*user->sve)) in parse_user_sigframe()
531 user->sve = (struct sve_context __user *)head; in parse_user_sigframe()
538 if (user->za) in parse_user_sigframe()
541 if (size < sizeof(*user->za)) in parse_user_sigframe()
544 user->za = (struct za_context __user *)head; in parse_user_sigframe()
634 struct user_ctxs user; in restore_sigframe() local
654 err = parse_user_sigframe(&user, sf); in restore_sigframe()
657 if (!user.fpsimd) in restore_sigframe()
660 if (user.sve) in restore_sigframe()
661 err = restore_sve_fpsimd_context(&user); in restore_sigframe()
663 err = restore_fpsimd_context(user.fpsimd); in restore_sigframe()
666 if (err == 0 && system_supports_sme() && user.za) in restore_sigframe()
667 err = restore_za_context(&user); in restore_sigframe()
712 static int setup_sigframe_layout(struct rt_sigframe_user_layout *user, in setup_sigframe_layout() argument
718 err = sigframe_alloc(user, &user->fpsimd_offset, in setup_sigframe_layout()
726 err = sigframe_alloc(user, &user->esr_offset, in setup_sigframe_layout()
745 err = sigframe_alloc(user, &user->sve_offset, in setup_sigframe_layout()
763 err = sigframe_alloc(user, &user->za_offset, in setup_sigframe_layout()
769 return sigframe_alloc_end(user); in setup_sigframe_layout()
772 static int setup_sigframe(struct rt_sigframe_user_layout *user, in setup_sigframe() argument
776 struct rt_sigframe __user *sf = user->sigframe; in setup_sigframe()
779 __put_user_error(regs->regs[29], &user->next_frame->fp, err); in setup_sigframe()
780 __put_user_error(regs->regs[30], &user->next_frame->lr, err); in setup_sigframe()
795 apply_user_offset(user, user->fpsimd_offset); in setup_sigframe()
800 if (err == 0 && user->esr_offset) { in setup_sigframe()
802 apply_user_offset(user, user->esr_offset); in setup_sigframe()
811 err == 0 && user->sve_offset) { in setup_sigframe()
813 apply_user_offset(user, user->sve_offset); in setup_sigframe()
818 if (system_supports_sme() && err == 0 && user->za_offset) { in setup_sigframe()
820 apply_user_offset(user, user->za_offset); in setup_sigframe()
824 if (err == 0 && user->extra_offset) { in setup_sigframe()
825 char __user *sfp = (char __user *)user->sigframe; in setup_sigframe()
827 apply_user_offset(user, user->extra_offset); in setup_sigframe()
846 extra_size = sfp + round_up(user->size, 16) - userp; in setup_sigframe()
861 apply_user_offset(user, user->end_offset); in setup_sigframe()
870 static int get_sigframe(struct rt_sigframe_user_layout *user, in get_sigframe() argument
876 init_user_layout(user); in get_sigframe()
877 err = setup_sigframe_layout(user, false); in get_sigframe()
884 user->next_frame = (struct frame_record __user *)sp; in get_sigframe()
886 sp = round_down(sp, 16) - sigframe_size(user); in get_sigframe()
887 user->sigframe = (struct rt_sigframe __user *)sp; in get_sigframe()
892 if (!access_ok(user->sigframe, sp_top - sp)) in get_sigframe()
899 struct rt_sigframe_user_layout *user, int usig) in setup_return() argument
904 regs->sp = (unsigned long)user->sigframe; in setup_return()
905 regs->regs[29] = (unsigned long)&user->next_frame->fp; in setup_return()
955 struct rt_sigframe_user_layout user; in setup_rt_frame() local
961 if (get_sigframe(&user, ksig, regs)) in setup_rt_frame()
964 frame = user.sigframe; in setup_rt_frame()
970 err |= setup_sigframe(&user, regs, set); in setup_rt_frame()
972 setup_return(regs, &ksig->ka, &user, usig); in setup_rt_frame()
1029 * the kernel can handle, and then we build all the user-level signal handling
1147 struct rt_sigframe_user_layout user; in minsigstksz_setup() local
1149 init_user_layout(&user); in minsigstksz_setup()
1155 if (WARN_ON(setup_sigframe_layout(&user, true))) in minsigstksz_setup()
1158 signal_minsigstksz = sigframe_size(&user) + in minsigstksz_setup()