Skip to contentSkip to conversation

arch/arc/kernel/signal.c:101:21: error: 'struct pt_regs' has no member named 'r30'; did you mean 'r10'?

PATCH New kernel test robot 2 participants 2 messages Jun 10, 2021

Subsystems (3)
lore
Share & tools
lore

kernel test robot

author build bot
#0 lore raw
tree:   https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git pending-fixes
head:   2413b547bbb10e9b0d9da0e15040d2228ef17a76
commit: 98ec2edf58c820ef953fbdfcf98d706aa804b822 [265/302] ARCv2: save ABI registers across signal handling
config: arc-randconfig-r001-20210610 (attached as .config)
compiler: arceb-elf-gcc (GCC) 9.3.0

reproduce (this is a W=1 build):
wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross chmod +x ~/bin/make.cross
# https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git/commit/?id=98ec2edf58c820ef953fbdfcf98d706aa804b822
git remote add linux-next https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git
git fetch --no-tags linux-next pending-fixes
git checkout 98ec2edf58c820ef953fbdfcf98d706aa804b822
# save the attached .config to linux build tree
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-9.3.0 make.cross ARCH=arc

If you fix the issue, kindly add following tag as appropriate

All errors (new ones prefixed by >>):

arch/arc/kernel/signal.c: In function 'stash_usr_regs':

>> arch/arc/kernel/signal.c:101:21: error: 'struct pt_regs' has no member named 'r30'; did you mean 'r10'?
     101 |   v2abi.r30 = regs->r30;
         |                     ^~~
         |                     r10
   arch/arc/kernel/signal.c: In function 'restore_usr_regs':
   arch/arc/kernel/signal.c:134:9: error: 'struct pt_regs' has no member named 'r30'; did you mean 'r10'?
     134 |   regs->r30 = v2abi.r30;
         |         ^~~
         |         r10

arch/arc/kernel/signal.c: At top level:
arch/arc/kernel/signal.c:387:6: warning: no previous prototype for 'do_signal' [-Wmissing-prototypes]
387 | void do_signal(struct pt_regs *regs)
| ^~~~~~~~~
arch/arc/kernel/signal.c:420:6: warning: no previous prototype for 'do_notify_resume' [-Wmissing-prototypes]
420 | void do_notify_resume(struct pt_regs *regs)
| ^~~~~~~~~~~~~~~~

vim +101 arch/arc/kernel/signal.c

    63	
    64	static int
    65	stash_usr_regs(struct rt_sigframe __user *sf, struct pt_regs *regs,
    66		       sigset_t *set)
    67	{
    68		int err;
    69		struct user_regs_struct uregs;
    70	
    71		uregs.scratch.bta	= regs->bta;
    72		uregs.scratch.lp_start	= regs->lp_start;
    73		uregs.scratch.lp_end	= regs->lp_end;
    74		uregs.scratch.lp_count	= regs->lp_count;
    75		uregs.scratch.status32	= regs->status32;
    76		uregs.scratch.ret	= regs->ret;
    77		uregs.scratch.blink	= regs->blink;
    78		uregs.scratch.fp	= regs->fp;
    79		uregs.scratch.gp	= regs->r26;
    80		uregs.scratch.r12	= regs->r12;
    81		uregs.scratch.r11	= regs->r11;
    82		uregs.scratch.r10	= regs->r10;
    83		uregs.scratch.r9	= regs->r9;
    84		uregs.scratch.r8	= regs->r8;
    85		uregs.scratch.r7	= regs->r7;
    86		uregs.scratch.r6	= regs->r6;
    87		uregs.scratch.r5	= regs->r5;
    88		uregs.scratch.r4	= regs->r4;
    89		uregs.scratch.r3	= regs->r3;
    90		uregs.scratch.r2	= regs->r2;
    91		uregs.scratch.r1	= regs->r1;
    92		uregs.scratch.r0	= regs->r0;
    93		uregs.scratch.sp	= regs->sp;
    94	
    95		err = __copy_to_user(&(sf->uc.uc_mcontext.regs.scratch), &uregs.scratch,
    96				     sizeof(sf->uc.uc_mcontext.regs.scratch));
    97	
    98		if (is_isa_arcv2()) {
    99			struct user_regs_arcv2 v2abi;
   100	
 > 101			v2abi.r30 = regs->r30;

102 #ifdef CONFIG_ARC_HAS_ACCL_REGS
103 v2abi.r58 = regs->r58;
104 v2abi.r59 = regs->r59;
105 #else
106 v2abi.r58 = v2abi.r59 = 0;
107 #endif
108 err |= __copy_to_user(&(sf->uc.uc_mcontext.v2abi), &v2abi,
109 sizeof(sf->uc.uc_mcontext.v2abi));
110 }
111
112 err |= __copy_to_user(&sf->uc.uc_sigmask, set, sizeof(sigset_t));
113
114 return err ? -EFAULT : 0;
115 }
116

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all(a)lists.01.org

#1 lore raw

PATCH v2 1/1 ARCv2: save ABI registers across signal handling

ARCv2 has some configuration dependent registers (r30, r58, r59) which could be targetted by the compiler. To keep the ABI stable, these were unconditionally part of the glibc ABI (sysdeps/unix/sysv/linux/arc/sys/ucontext.h:mcontext_t) however we missed populating them (by saving/restoring them across signal handling).

This patch fixes the issue by
- adding arcv2 ABI regs to kernel struct sigcontext
- populating them during signal handling

Change to struct sigcontext might seem like a glibc ABI change (although it primarily uses ucontext_t:mcontext_t) but the fact is
- it has only been extended (existing fields are not touched)
- the old sigcontext was ABI incomplete to begin with anyways

---
 arch/arc/include/uapi/asm/sigcontext.h |  1 +
 arch/arc/kernel/signal.c               | 43 ++++++++++++++++++++++++++
 2 files changed, 44 insertions(+)
arch/arc/include/uapi/asm/sigcontext.h +1 -0
index 95f8a4380e11..7a5449dfcb29 100644
@@ -18,6 +18,7 @@
  */
 struct sigcontext {
 	struct user_regs_struct regs;
+	struct user_regs_arcv2 v2abi;
 };
 
 #endif /* _ASM_ARC_SIGCONTEXT_H */
arch/arc/kernel/signal.c +43 -0

61 lines not on this page · raw message

Signature · 1 line
2.25.1