Skip to content

Commit

Permalink
MIPS: Fix MAX_REG_OFFSET
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Thorsten Blum authored and Thomas Bogendoerfer committed Apr 30, 2025
1 parent 7f74c06 commit c44572e
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion arch/mips/include/asm/ptrace.h
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,8 @@ static inline void instruction_pointer_set(struct pt_regs *regs,

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

/**
* regs_get_register() - get register value from its offset
Expand Down

0 comments on commit c44572e

Please sign in to comment.