llvm.lists.linux.dev archive mirror
 help / color / mirror / Atom feed
* [peterz-queue:perf/core 29/41] arch/x86/kernel/uprobes.c:834:16: error: incompatible pointer types passing 'unsigned long *' to parameter of type 'u64 *' (aka 'unsigned long long *')
@ 2025-08-20 17:31 kernel test robot
  0 siblings, 0 replies; 2+ messages in thread
From: kernel test robot @ 2025-08-20 17:31 UTC (permalink / raw)
  To: Peter Zijlstra; +Cc: llvm, oe-kbuild-all

tree:   https://git.kernel.org/pub/scm/linux/kernel/git/peterz/queue.git perf/core
head:   44711c518722e9e0594d07e7f7af72ec9d48c1dd
commit: 89f3fe617685431a4d82091c95ab14dd0d3b8dd6 [29/41] uprobes/x86: Fix shadow stack
config: x86_64-rhel-9.4-rust (https://download.01.org/0day-ci/archive/20250820/202508201942.kN5khpRq-lkp@intel.com/config)
compiler: clang version 20.1.8 (https://github.com/llvm/llvm-project 87f0227cb60147a26a1eeb4fb06e3b505e9c7261)
rustc: rustc 1.88.0 (6b00bc388 2025-06-23)
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20250820/202508201942.kN5khpRq-lkp@intel.com/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@intel.com>
| Closes: https://lore.kernel.org/oe-kbuild-all/202508201942.kN5khpRq-lkp@intel.com/

All errors (new ones prefixed by >>):

>> arch/x86/kernel/uprobes.c:834:16: error: incompatible pointer types passing 'unsigned long *' to parameter of type 'u64 *' (aka 'unsigned long long *') [-Werror,-Wincompatible-pointer-types]
     834 |         if (shstk_pop(&sret) == 0 && sret != args.retaddr)
         |                       ^~~~~
   arch/x86/include/asm/shstk.h:40:34: note: passing argument to parameter 'val' here
      40 | static inline int shstk_pop(u64 *val) { return -ENOTSUPP; }
         |                                  ^
   1 error generated.


vim +834 arch/x86/kernel/uprobes.c

   802	
   803	SYSCALL_DEFINE0(uprobe)
   804	{
   805		struct pt_regs *regs = task_pt_regs(current);
   806		struct uprobe_syscall_args args;
   807		unsigned long ip, sp, sret;
   808		int err;
   809	
   810		/* Allow execution only from uprobe trampolines. */
   811		if (!in_uprobe_trampoline(regs->ip))
   812			goto sigill;
   813	
   814		err = copy_from_user(&args, (void __user *)regs->sp, sizeof(args));
   815		if (err)
   816			goto sigill;
   817	
   818		ip = regs->ip;
   819	
   820		/*
   821		 * expose the "right" values of ax/r11/cx/ip/sp to uprobe_consumer/s, plus:
   822		 * - adjust ip to the probe address, call saved next instruction address
   823		 * - adjust sp to the probe's stack frame (check trampoline code)
   824		 */
   825		regs->ax  = args.ax;
   826		regs->r11 = args.r11;
   827		regs->cx  = args.cx;
   828		regs->ip  = args.retaddr - 5;
   829		regs->sp += sizeof(args);
   830		regs->orig_ax = -1;
   831	
   832		sp = regs->sp;
   833	
 > 834		if (shstk_pop(&sret) == 0 && sret != args.retaddr)
   835			goto sigill;
   836	
   837		handle_syscall_uprobe(regs, regs->ip);
   838	
   839		/*
   840		 * Some of the uprobe consumers has changed sp, we can do nothing,
   841		 * just return via iret.
   842		 */
   843		if (regs->sp != sp) {
   844			/* skip the trampoline call */
   845			if (args.retaddr - 5 == regs->ip)
   846				regs->ip += 5;
   847			return regs->ax;
   848		}
   849	
   850		regs->sp -= sizeof(args);
   851	
   852		/* for the case uprobe_consumer has changed ax/r11/cx */
   853		args.ax  = regs->ax;
   854		args.r11 = regs->r11;
   855		args.cx  = regs->cx;
   856	
   857		/* keep return address unless we are instructed otherwise */
   858		if (args.retaddr - 5 != regs->ip)
   859			args.retaddr = regs->ip;
   860	
   861		if (shstk_push(args.retaddr) == -EFAULT)
   862			goto sigill;
   863	
   864		regs->ip = ip;
   865	
   866		err = copy_to_user((void __user *)regs->sp, &args, sizeof(args));
   867		if (err)
   868			goto sigill;
   869	
   870		/* ensure sysret, see do_syscall_64() */
   871		regs->r11 = regs->flags;
   872		regs->cx  = regs->ip;
   873		return 0;
   874	
   875	sigill:
   876		force_sig(SIGILL);
   877		return -1;
   878	}
   879	

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

^ permalink raw reply	[flat|nested] 2+ messages in thread

* [peterz-queue:perf/core 29/41] arch/x86/kernel/uprobes.c:834:16: error: incompatible pointer types passing 'unsigned long *' to parameter of type 'u64 *' (aka 'unsigned long long *')
@ 2025-08-20 21:39 kernel test robot
  0 siblings, 0 replies; 2+ messages in thread
From: kernel test robot @ 2025-08-20 21:39 UTC (permalink / raw)
  To: Peter Zijlstra; +Cc: llvm, oe-kbuild-all

tree:   https://git.kernel.org/pub/scm/linux/kernel/git/peterz/queue.git perf/core
head:   44711c518722e9e0594d07e7f7af72ec9d48c1dd
commit: 89f3fe617685431a4d82091c95ab14dd0d3b8dd6 [29/41] uprobes/x86: Fix shadow stack
config: x86_64-buildonly-randconfig-003-20250821 (https://download.01.org/0day-ci/archive/20250821/202508210550.rgoAtXMe-lkp@intel.com/config)
compiler: clang version 20.1.8 (https://github.com/llvm/llvm-project 87f0227cb60147a26a1eeb4fb06e3b505e9c7261)
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20250821/202508210550.rgoAtXMe-lkp@intel.com/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@intel.com>
| Closes: https://lore.kernel.org/oe-kbuild-all/202508210550.rgoAtXMe-lkp@intel.com/

All errors (new ones prefixed by >>):

>> arch/x86/kernel/uprobes.c:834:16: error: incompatible pointer types passing 'unsigned long *' to parameter of type 'u64 *' (aka 'unsigned long long *') [-Werror,-Wincompatible-pointer-types]
     834 |         if (shstk_pop(&sret) == 0 && sret != args.retaddr)
         |                       ^~~~~
   arch/x86/include/asm/shstk.h:26:20: note: passing argument to parameter 'val' here
      26 | int shstk_pop(u64 *val);
         |                    ^
   1 error generated.


vim +834 arch/x86/kernel/uprobes.c

   802	
   803	SYSCALL_DEFINE0(uprobe)
   804	{
   805		struct pt_regs *regs = task_pt_regs(current);
   806		struct uprobe_syscall_args args;
   807		unsigned long ip, sp, sret;
   808		int err;
   809	
   810		/* Allow execution only from uprobe trampolines. */
   811		if (!in_uprobe_trampoline(regs->ip))
   812			goto sigill;
   813	
   814		err = copy_from_user(&args, (void __user *)regs->sp, sizeof(args));
   815		if (err)
   816			goto sigill;
   817	
   818		ip = regs->ip;
   819	
   820		/*
   821		 * expose the "right" values of ax/r11/cx/ip/sp to uprobe_consumer/s, plus:
   822		 * - adjust ip to the probe address, call saved next instruction address
   823		 * - adjust sp to the probe's stack frame (check trampoline code)
   824		 */
   825		regs->ax  = args.ax;
   826		regs->r11 = args.r11;
   827		regs->cx  = args.cx;
   828		regs->ip  = args.retaddr - 5;
   829		regs->sp += sizeof(args);
   830		regs->orig_ax = -1;
   831	
   832		sp = regs->sp;
   833	
 > 834		if (shstk_pop(&sret) == 0 && sret != args.retaddr)
   835			goto sigill;
   836	
   837		handle_syscall_uprobe(regs, regs->ip);
   838	
   839		/*
   840		 * Some of the uprobe consumers has changed sp, we can do nothing,
   841		 * just return via iret.
   842		 */
   843		if (regs->sp != sp) {
   844			/* skip the trampoline call */
   845			if (args.retaddr - 5 == regs->ip)
   846				regs->ip += 5;
   847			return regs->ax;
   848		}
   849	
   850		regs->sp -= sizeof(args);
   851	
   852		/* for the case uprobe_consumer has changed ax/r11/cx */
   853		args.ax  = regs->ax;
   854		args.r11 = regs->r11;
   855		args.cx  = regs->cx;
   856	
   857		/* keep return address unless we are instructed otherwise */
   858		if (args.retaddr - 5 != regs->ip)
   859			args.retaddr = regs->ip;
   860	
   861		if (shstk_push(args.retaddr) == -EFAULT)
   862			goto sigill;
   863	
   864		regs->ip = ip;
   865	
   866		err = copy_to_user((void __user *)regs->sp, &args, sizeof(args));
   867		if (err)
   868			goto sigill;
   869	
   870		/* ensure sysret, see do_syscall_64() */
   871		regs->r11 = regs->flags;
   872		regs->cx  = regs->ip;
   873		return 0;
   874	
   875	sigill:
   876		force_sig(SIGILL);
   877		return -1;
   878	}
   879	

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

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2025-08-20 21:40 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-08-20 21:39 [peterz-queue:perf/core 29/41] arch/x86/kernel/uprobes.c:834:16: error: incompatible pointer types passing 'unsigned long *' to parameter of type 'u64 *' (aka 'unsigned long long *') kernel test robot
  -- strict thread matches above, loose matches on Subject: below --
2025-08-20 17:31 kernel test robot

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).