Skip to content

Commit e3f9324

Browse files
RISC-V: Remove ptrace support for vectors
We've found two bugs here: NT_RISCV_VECTOR steps on NT_RISCV_CSR (which is only for embedded), and we don't have vlenb in the core dumps. Given that we've have a pair of bugs croup up as part of the GDB review we've probably got other issues, so let's just cut this for 6.5 and get it right. Fixes: 0c59922 ("riscv: Add ptrace vector support") Reviewed-by: Maciej W. Rozycki <macro@orcam.me.uk> Signed-off-by: Andy Chiu <andy.chiu@sifive.com> Link: https://lore.kernel.org/r/20230816155450.26200-2-andy.chiu@sifive.com Signed-off-by: Palmer Dabbelt <palmer@rivosinc.com>
1 parent 06c2afb commit e3f9324

File tree

2 files changed

+0
-70
lines changed

2 files changed

+0
-70
lines changed

arch/riscv/kernel/ptrace.c

Lines changed: 0 additions & 69 deletions
Original file line numberDiff line numberDiff line change
@@ -25,9 +25,6 @@ enum riscv_regset {
2525
#ifdef CONFIG_FPU
2626
REGSET_F,
2727
#endif
28-
#ifdef CONFIG_RISCV_ISA_V
29-
REGSET_V,
30-
#endif
3128
};
3229

3330
static int riscv_gpr_get(struct task_struct *target,
@@ -84,61 +81,6 @@ static int riscv_fpr_set(struct task_struct *target,
8481
}
8582
#endif
8683

87-
#ifdef CONFIG_RISCV_ISA_V
88-
static int riscv_vr_get(struct task_struct *target,
89-
const struct user_regset *regset,
90-
struct membuf to)
91-
{
92-
struct __riscv_v_ext_state *vstate = &target->thread.vstate;
93-
94-
if (!riscv_v_vstate_query(task_pt_regs(target)))
95-
return -EINVAL;
96-
97-
/*
98-
* Ensure the vector registers have been saved to the memory before
99-
* copying them to membuf.
100-
*/
101-
if (target == current)
102-
riscv_v_vstate_save(current, task_pt_regs(current));
103-
104-
/* Copy vector header from vstate. */
105-
membuf_write(&to, vstate, offsetof(struct __riscv_v_ext_state, datap));
106-
membuf_zero(&to, sizeof(vstate->datap));
107-
108-
/* Copy all the vector registers from vstate. */
109-
return membuf_write(&to, vstate->datap, riscv_v_vsize);
110-
}
111-
112-
static int riscv_vr_set(struct task_struct *target,
113-
const struct user_regset *regset,
114-
unsigned int pos, unsigned int count,
115-
const void *kbuf, const void __user *ubuf)
116-
{
117-
int ret, size;
118-
struct __riscv_v_ext_state *vstate = &target->thread.vstate;
119-
120-
if (!riscv_v_vstate_query(task_pt_regs(target)))
121-
return -EINVAL;
122-
123-
/* Copy rest of the vstate except datap */
124-
ret = user_regset_copyin(&pos, &count, &kbuf, &ubuf, vstate, 0,
125-
offsetof(struct __riscv_v_ext_state, datap));
126-
if (unlikely(ret))
127-
return ret;
128-
129-
/* Skip copy datap. */
130-
size = sizeof(vstate->datap);
131-
count -= size;
132-
ubuf += size;
133-
134-
/* Copy all the vector registers. */
135-
pos = 0;
136-
ret = user_regset_copyin(&pos, &count, &kbuf, &ubuf, vstate->datap,
137-
0, riscv_v_vsize);
138-
return ret;
139-
}
140-
#endif
141-
14284
static const struct user_regset riscv_user_regset[] = {
14385
[REGSET_X] = {
14486
.core_note_type = NT_PRSTATUS,
@@ -158,17 +100,6 @@ static const struct user_regset riscv_user_regset[] = {
158100
.set = riscv_fpr_set,
159101
},
160102
#endif
161-
#ifdef CONFIG_RISCV_ISA_V
162-
[REGSET_V] = {
163-
.core_note_type = NT_RISCV_VECTOR,
164-
.align = 16,
165-
.n = ((32 * RISCV_MAX_VLENB) +
166-
sizeof(struct __riscv_v_ext_state)) / sizeof(__u32),
167-
.size = sizeof(__u32),
168-
.regset_get = riscv_vr_get,
169-
.set = riscv_vr_set,
170-
},
171-
#endif
172103
};
173104

174105
static const struct user_regset_view riscv_user_native_view = {

include/uapi/linux/elf.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -443,7 +443,6 @@ typedef struct elf64_shdr {
443443
#define NT_MIPS_DSP 0x800 /* MIPS DSP ASE registers */
444444
#define NT_MIPS_FP_MODE 0x801 /* MIPS floating-point mode */
445445
#define NT_MIPS_MSA 0x802 /* MIPS SIMD registers */
446-
#define NT_RISCV_VECTOR 0x900 /* RISC-V vector registers */
447446
#define NT_LOONGARCH_CPUCFG 0xa00 /* LoongArch CPU config registers */
448447
#define NT_LOONGARCH_CSR 0xa01 /* LoongArch control and status registers */
449448
#define NT_LOONGARCH_LSX 0xa02 /* LoongArch Loongson SIMD Extension registers */

0 commit comments

Comments
 (0)