lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <mhng-BE7B7DA7-1D39-49CF-9A6D-7AEBFE5CD2FC@Palmers-Mini.rwc.dabbelt.com>
Date: Mon, 18 Aug 2025 10:54:42 -0700 (PDT)
From: Palmer Dabbelt <palmer@...belt.com>
To: gmonaco@...hat.com
CC: lkp@...el.com, namcao@...utronix.de, llvm@...ts.linux.dev,
  oe-kbuild-all@...ts.linux.dev, linux-kernel@...r.kernel.org, rostedt@...dmis.org
Subject:     Re: kernel/trace/rv/monitors/sleep/sleep.c:130:7: error: use of undeclared identifier '__NR_clock_nanosleep'

On Mon, 18 Aug 2025 00:42:20 PDT (-0700), gmonaco@...hat.com wrote:
> On Sat, 2025-08-16 at 02:37 +0800, kernel test robot wrote:
>> tree:  
>> https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git ma
>> ster
>> head:   ee94b00c1a648530333d9734200be7a45e6e00cd
>> commit: f74f8bb246cf22f27752977da62079cb615f55b2 rv: Add rtapp_sleep
>> monitor
>> date:   5 weeks ago
>> config: riscv-randconfig-001-20250816
>> (https://download.01.org/0day-ci/archive/20250816/202508160204.SsFyNf
>> o6-lkp@...el.com/config)
>> compiler: clang version 22.0.0git
>> (https://github.com/llvm/llvm-project 93d24b6b7b148c47a2fa228a4ef3152
>> 4fa1d9f3f)
>> reproduce (this is a W=1 build):
>> (https://download.01.org/0day-ci/archive/20250816/202508160204.SsFyNf
>> o6-lkp@...el.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@...el.com>
>> > Closes:
>> > https://lore.kernel.org/oe-kbuild-all/202508160204.SsFyNfo6-lkp@intel.com/
>> 
>
> Palmer, this issue is what you fix in
> https://lore.kernel.org/lkml/20250804194518.97620-2-palmer@dabbelt.com/
> , right?

Yes.

>> All errors (new ones prefixed by >>):
>> 
>>    In file included from arch/riscv/include/asm/io.h:136:
>>    include/asm-generic/io.h:804:2: warning: performing pointer
>> arithmetic on a null pointer has undefined behavior [-Wnull-pointer-
>> arithmetic]
>>      804 |         insb(addr, buffer, count);
>>          |         ^~~~~~~~~~~~~~~~~~~~~~~~~
>>    arch/riscv/include/asm/io.h:104:53: note: expanded from macro
>> 'insb'
>>      104 | #define insb(addr, buffer, count) __insb(PCI_IOBASE +
>> (addr), buffer, count)
>>          |                                          ~~~~~~~~~~ ^
>>    In file included from kernel/trace/rv/monitors/sleep/sleep.c:2:
>>    In file included from include/linux/ftrace.h:10:
>>    In file included from include/linux/trace_recursion.h:5:
>>    In file included from include/linux/interrupt.h:11:
>>    In file included from include/linux/hardirq.h:11:
>>    In file included from
>> ./arch/riscv/include/generated/asm/hardirq.h:1:
>>    In file included from include/asm-generic/hardirq.h:17:
>>    In file included from include/linux/irq.h:20:
>>    In file included from include/linux/io.h:12:
>>    In file included from arch/riscv/include/asm/io.h:136:
>>    include/asm-generic/io.h:812:2: warning: performing pointer
>> arithmetic on a null pointer has undefined behavior [-Wnull-pointer-
>> arithmetic]
>>      812 |         insw(addr, buffer, count);
>>          |         ^~~~~~~~~~~~~~~~~~~~~~~~~
>>    arch/riscv/include/asm/io.h:105:53: note: expanded from macro
>> 'insw'
>>      105 | #define insw(addr, buffer, count) __insw(PCI_IOBASE +
>> (addr), buffer, count)
>>          |                                          ~~~~~~~~~~ ^
>>    In file included from kernel/trace/rv/monitors/sleep/sleep.c:2:
>>    In file included from include/linux/ftrace.h:10:
>>    In file included from include/linux/trace_recursion.h:5:
>>    In file included from include/linux/interrupt.h:11:
>>    In file included from include/linux/hardirq.h:11:
>>    In file included from
>> ./arch/riscv/include/generated/asm/hardirq.h:1:
>>    In file included from include/asm-generic/hardirq.h:17:
>>    In file included from include/linux/irq.h:20:
>>    In file included from include/linux/io.h:12:
>>    In file included from arch/riscv/include/asm/io.h:136:
>>    include/asm-generic/io.h:820:2: warning: performing pointer
>> arithmetic on a null pointer has undefined behavior [-Wnull-pointer-
>> arithmetic]
>>      820 |         insl(addr, buffer, count);
>>          |         ^~~~~~~~~~~~~~~~~~~~~~~~~
>>    arch/riscv/include/asm/io.h:106:53: note: expanded from macro
>> 'insl'
>>      106 | #define insl(addr, buffer, count) __insl(PCI_IOBASE +
>> (addr), buffer, count)
>>          |                                          ~~~~~~~~~~ ^
>>    In file included from kernel/trace/rv/monitors/sleep/sleep.c:2:
>>    In file included from include/linux/ftrace.h:10:
>>    In file included from include/linux/trace_recursion.h:5:
>>    In file included from include/linux/interrupt.h:11:
>>    In file included from include/linux/hardirq.h:11:
>>    In file included from
>> ./arch/riscv/include/generated/asm/hardirq.h:1:
>>    In file included from include/asm-generic/hardirq.h:17:
>>    In file included from include/linux/irq.h:20:
>>    In file included from include/linux/io.h:12:
>>    In file included from arch/riscv/include/asm/io.h:136:
>>    include/asm-generic/io.h:829:2: warning: performing pointer
>> arithmetic on a null pointer has undefined behavior [-Wnull-pointer-
>> arithmetic]
>>      829 |         outsb(addr, buffer, count);
>>          |         ^~~~~~~~~~~~~~~~~~~~~~~~~~
>>    arch/riscv/include/asm/io.h:118:55: note: expanded from macro
>> 'outsb'
>>      118 | #define outsb(addr, buffer, count) __outsb(PCI_IOBASE +
>> (addr), buffer, count)
>>          |                                            ~~~~~~~~~~ ^
>>    In file included from kernel/trace/rv/monitors/sleep/sleep.c:2:
>>    In file included from include/linux/ftrace.h:10:
>>    In file included from include/linux/trace_recursion.h:5:
>>    In file included from include/linux/interrupt.h:11:
>>    In file included from include/linux/hardirq.h:11:
>>    In file included from
>> ./arch/riscv/include/generated/asm/hardirq.h:1:
>>    In file included from include/asm-generic/hardirq.h:17:
>>    In file included from include/linux/irq.h:20:
>>    In file included from include/linux/io.h:12:
>>    In file included from arch/riscv/include/asm/io.h:136:
>>    include/asm-generic/io.h:838:2: warning: performing pointer
>> arithmetic on a null pointer has undefined behavior [-Wnull-pointer-
>> arithmetic]
>>      838 |         outsw(addr, buffer, count);
>>          |         ^~~~~~~~~~~~~~~~~~~~~~~~~~
>>    arch/riscv/include/asm/io.h:119:55: note: expanded from macro
>> 'outsw'
>>      119 | #define outsw(addr, buffer, count) __outsw(PCI_IOBASE +
>> (addr), buffer, count)
>>          |                                            ~~~~~~~~~~ ^
>>    In file included from kernel/trace/rv/monitors/sleep/sleep.c:2:
>>    In file included from include/linux/ftrace.h:10:
>>    In file included from include/linux/trace_recursion.h:5:
>>    In file included from include/linux/interrupt.h:11:
>>    In file included from include/linux/hardirq.h:11:
>>    In file included from
>> ./arch/riscv/include/generated/asm/hardirq.h:1:
>>    In file included from include/asm-generic/hardirq.h:17:
>>    In file included from include/linux/irq.h:20:
>>    In file included from include/linux/io.h:12:
>>    In file included from arch/riscv/include/asm/io.h:136:
>>    include/asm-generic/io.h:847:2: warning: performing pointer
>> arithmetic on a null pointer has undefined behavior [-Wnull-pointer-
>> arithmetic]
>>      847 |         outsl(addr, buffer, count);
>>          |         ^~~~~~~~~~~~~~~~~~~~~~~~~~
>>    arch/riscv/include/asm/io.h:120:55: note: expanded from macro
>> 'outsl'
>>      120 | #define outsl(addr, buffer, count) __outsl(PCI_IOBASE +
>> (addr), buffer, count)
>>          |                                            ~~~~~~~~~~ ^
>>    In file included from kernel/trace/rv/monitors/sleep/sleep.c:2:
>>    In file included from include/linux/ftrace.h:10:
>>    In file included from include/linux/trace_recursion.h:5:
>>    In file included from include/linux/interrupt.h:11:
>>    In file included from include/linux/hardirq.h:11:
>>    In file included from
>> ./arch/riscv/include/generated/asm/hardirq.h:1:
>>    In file included from include/asm-generic/hardirq.h:17:
>>    In file included from include/linux/irq.h:20:
>>    In file included from include/linux/io.h:12:
>>    In file included from arch/riscv/include/asm/io.h:136:
>>    include/asm-generic/io.h:1175:55: warning: performing pointer
>> arithmetic on a null pointer has undefined behavior [-Wnull-pointer-
>> arithmetic]
>>     1175 |         return (port > MMIO_UPPER_LIMIT) ? NULL :
>> PCI_IOBASE + port;
>>          |                                                  
>> ~~~~~~~~~~ ^
>> > > kernel/trace/rv/monitors/sleep/sleep.c:130:7: error: use of
>> > > undeclared identifier '__NR_clock_nanosleep'
>>      130 |         case __NR_clock_nanosleep:
>>          |              ^~~~~~~~~~~~~~~~~~~~
>> > > kernel/trace/rv/monitors/sleep/sleep.c:141:7: error: use of
>> > > undeclared identifier '__NR_futex'
>>      141 |         case __NR_futex:
>>          |              ^~~~~~~~~~
>>    7 warnings and 2 errors generated.
>> 
>> 
>> vim +/__NR_clock_nanosleep +130
>> kernel/trace/rv/monitors/sleep/sleep.c
>> 
>>    120	
>>    121	static void handle_sys_enter(void *data, struct pt_regs
>> *regs, long id)
>>    122	{
>>    123		struct ltl_monitor *mon;
>>    124		unsigned long args[6];
>>    125		int op, cmd;
>>    126	
>>    127		mon = ltl_get_monitor(current);
>>    128	
>>    129		switch (id) {
>>  > 130		case __NR_clock_nanosleep:
>>    131	#ifdef __NR_clock_nanosleep_time64
>>    132		case __NR_clock_nanosleep_time64:
>>    133	#endif
>>    134			syscall_get_arguments(current, regs, args);
>>    135			ltl_atom_set(mon,
>> LTL_NANOSLEEP_CLOCK_MONOTONIC, args[0] == CLOCK_MONOTONIC);
>>    136			ltl_atom_set(mon, LTL_NANOSLEEP_CLOCK_TAI,
>> args[0] == CLOCK_TAI);
>>    137			ltl_atom_set(mon,
>> LTL_NANOSLEEP_TIMER_ABSTIME, args[1] == TIMER_ABSTIME);
>>    138			ltl_atom_update(current,
>> LTL_CLOCK_NANOSLEEP, true);
>>    139			break;
>>    140	
>>  > 141		case __NR_futex:
>>    142	#ifdef __NR_futex_time64
>>    143		case __NR_futex_time64:
>>    144	#endif
>>    145			syscall_get_arguments(current, regs, args);
>>    146			op = args[1];
>>    147			cmd = op & FUTEX_CMD_MASK;
>>    148	
>>    149			switch (cmd) {
>>    150			case FUTEX_LOCK_PI:
>>    151			case FUTEX_LOCK_PI2:
>>    152				ltl_atom_update(current,
>> LTL_FUTEX_LOCK_PI, true);
>>    153				break;
>>    154			case FUTEX_WAIT:
>>    155			case FUTEX_WAIT_BITSET:
>>    156			case FUTEX_WAIT_REQUEUE_PI:
>>    157				ltl_atom_update(current,
>> LTL_FUTEX_WAIT, true);
>>    158				break;
>>    159			}
>>    160			break;
>>    161		}
>>    162	}
>>    163	

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ