[PATCH v6 3/5] riscv: ptrace support for hardware break/watchpoints

Chen Pei cp0613 at linux.alibaba.com
Wed Aug 5 06:22:52 PDT 2026


> +struct __riscv_hwdebug_state {
> +	unsigned long addr;
> +	unsigned long type;
> +	unsigned long len;
> +	unsigned long ctrl;
> +} __packed;

Hi Himanshu,

Two suggestions about the new UAPI structure added in this patch.

1) Consider __u64 instead of 'unsigned long': its size differs
   between rv32 and rv64, so the layout would not be stable across
   32-bit and 64-bit userspace (e.g. a future COMPAT path). __u64
   keeps the layout identical for both.

2) With all members the same width there is no interior padding, so
   __packed can be dropped.

The struct user_hwdebug_state above already uses fixed-width types;
defining this one the same way would be consistent.

Best regards,
Pei

-- 
Chen Pei <cp0613 at linux.alibaba.com>



More information about the linux-riscv mailing list