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

From: Chen Pei

Date: Wed Aug 05 2026 - 09:29:23 EST


> +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@xxxxxxxxxxxxxxxxx>