Skip to content

Commit de4f683

Browse files
tobluxgregkh
authored andcommitted
MIPS: Fix MAX_REG_OFFSET
[ Upstream commit c44572e ] Fix MAX_REG_OFFSET to point to the last register in 'pt_regs' and not to the marker itself, which could allow regs_get_register() to return an invalid offset. Fixes: 40e084a ("MIPS: Add uprobes support.") Suggested-by: Maciej W. Rozycki <macro@orcam.me.uk> Signed-off-by: Thorsten Blum <thorsten.blum@linux.dev> Signed-off-by: Thomas Bogendoerfer <tsbogend@alpha.franken.de> Signed-off-by: Sasha Levin <sashal@kernel.org>
1 parent 3cd0438 commit de4f683

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

arch/mips/include/asm/ptrace.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,8 @@ static inline void instruction_pointer_set(struct pt_regs *regs,
6565

6666
/* Query offset/name of register from its name/offset */
6767
extern int regs_query_register_offset(const char *name);
68-
#define MAX_REG_OFFSET (offsetof(struct pt_regs, __last))
68+
#define MAX_REG_OFFSET \
69+
(offsetof(struct pt_regs, __last) - sizeof(unsigned long))
6970

7071
/**
7172
* regs_get_register() - get register value from its offset

0 commit comments

Comments
 (0)