Re: [PATCH v8 12/29] riscv/shstk: If needed allocate a new shadow stack on clone

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi Deepak,

kernel test robot noticed the following build warnings:

[auto build test WARNING on 64f7b77f0bd9271861ed9e410e9856b6b0b21c48]

url:    https://github.com/intel-lab-lkp/linux/commits/Deepak-Gupta/mm-Introduce-ARCH_HAS_USER_SHADOW_STACK/20241112-050530
base:   64f7b77f0bd9271861ed9e410e9856b6b0b21c48
patch link:    https://lore.kernel.org/r/20241111-v5_user_cfi_series-v8-12-dce14aa30207%40rivosinc.com
patch subject: [PATCH v8 12/29] riscv/shstk: If needed allocate a new shadow stack on clone
config: riscv-defconfig (https://download.01.org/0day-ci/archive/20241112/202411121717.INT1geTN-lkp@xxxxxxxxx/config)
compiler: clang version 20.0.0git (https://github.com/llvm/llvm-project 592c0fe55f6d9a811028b5f3507be91458ab2713)
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20241112/202411121717.INT1geTN-lkp@xxxxxxxxx/reproduce)

If you fix the issue in a separate patch/commit (i.e. not just a new version of
the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <lkp@xxxxxxxxx>
| Closes: https://lore.kernel.org/oe-kbuild-all/202411121717.INT1geTN-lkp@xxxxxxxxx/

All warnings (new ones prefixed by >>):

   In file included from arch/riscv/kernel/process.c:17:
   In file included from include/linux/ptrace.h:10:
   In file included from include/linux/pid_namespace.h:7:
   In file included from include/linux/mm.h:2213:
   include/linux/vmstat.h:518:36: warning: arithmetic between different enumeration types ('enum node_stat_item' and 'enum lru_list') [-Wenum-enum-conversion]
     518 |         return node_stat_name(NR_LRU_BASE + lru) + 3; // skip "nr_"
         |                               ~~~~~~~~~~~ ^ ~~~
>> arch/riscv/kernel/process.c:245:36: warning: expression result unused [-Wunused-value]
     245 |                 ssp ? set_active_shstk(p, ssp) : 0;
         |                                                  ^
   2 warnings generated.


vim +245 arch/riscv/kernel/process.c

   209	
   210	int copy_thread(struct task_struct *p, const struct kernel_clone_args *args)
   211	{
   212		unsigned long clone_flags = args->flags;
   213		unsigned long usp = args->stack;
   214		unsigned long tls = args->tls;
   215		unsigned long ssp = 0;
   216		struct pt_regs *childregs = task_pt_regs(p);
   217	
   218		/* Ensure all threads in this mm have the same pointer masking mode. */
   219		if (IS_ENABLED(CONFIG_RISCV_ISA_SUPM) && p->mm && (clone_flags & CLONE_VM))
   220			set_bit(MM_CONTEXT_LOCK_PMLEN, &p->mm->context.flags);
   221	
   222		memset(&p->thread.s, 0, sizeof(p->thread.s));
   223	
   224		/* p->thread holds context to be restored by __switch_to() */
   225		if (unlikely(args->fn)) {
   226			/* Kernel thread */
   227			memset(childregs, 0, sizeof(struct pt_regs));
   228			/* Supervisor/Machine, irqs on: */
   229			childregs->status = SR_PP | SR_PIE;
   230	
   231			p->thread.s[0] = (unsigned long)args->fn;
   232			p->thread.s[1] = (unsigned long)args->fn_arg;
   233		} else {
   234			/* allocate new shadow stack if needed. In case of CLONE_VM we have to */
   235			ssp = shstk_alloc_thread_stack(p, args);
   236			if (IS_ERR_VALUE(ssp))
   237				return PTR_ERR((void *)ssp);
   238	
   239			*childregs = *(current_pt_regs());
   240			/* Turn off status.VS */
   241			riscv_v_vstate_off(childregs);
   242			if (usp) /* User fork */
   243				childregs->sp = usp;
   244			/* if needed, set new ssp */
 > 245			ssp ? set_active_shstk(p, ssp) : 0;
   246			if (clone_flags & CLONE_SETTLS)
   247				childregs->tp = tls;
   248			childregs->a0 = 0; /* Return value of fork() */
   249			p->thread.s[0] = 0;
   250		}
   251		p->thread.riscv_v_flags = 0;
   252		if (has_vector())
   253			riscv_v_thread_alloc(p);
   254		p->thread.ra = (unsigned long)ret_from_fork;
   255		p->thread.sp = (unsigned long)childregs; /* kernel sp */
   256		return 0;
   257	}
   258	

-- 
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki




[Index of Archives]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Bugtraq]     [Linux OMAP]     [Linux MIPS]     [eCos]     [Asterisk Internet PBX]     [Linux API]

  Powered by Linux