From: Thomas Bogendoerfer <tsbogend@alpha.franken.de>
To: Huacai Chen <chenhuacai@kernel.org>
Cc: Thorsten Blum <thorsten.blum@linux.dev>,
Oleg Nesterov <oleg@redhat.com>,
"Maciej W. Rozycki" <macro@orcam.me.uk>,
linux-mips@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH v3] MIPS: Fix MAX_REG_OFFSET
Date: Sun, 27 Apr 2025 14:51:54 +0200 [thread overview]
Message-ID: <aA4oag9MAXT3y0t8@alpha.franken.de> (raw)
In-Reply-To: <CAAhV-H6kxy9NaWXqq1QLfobVvVz9-VMybHC6M+0V-sE3MY9SRA@mail.gmail.com>
On Sun, Apr 27, 2025 at 08:32:05PM +0800, Huacai Chen wrote:
> Hi, Thorsten,
>
> On Sun, Apr 27, 2025 at 7:35 PM Thorsten Blum <thorsten.blum@linux.dev> wrote:
> >
> > 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: 40e084a506eb ("MIPS: Add uprobes support.")
> > Signed-off-by: Thorsten Blum <thorsten.blum@linux.dev>
> > ---
> > Compile-tested only.
> >
> > Changes in v2:
> > - Fix MAX_REG_OFFSET as suggested by Maciej (thanks!)
> > - Link to v1: https://lore.kernel.org/lkml/20250411090032.7844-1-thorsten.blum@linux.dev/
> >
> > Changes in v3:
> > - Keep the marker and avoid using #ifdef by adjusting MAX_REG_OFFSET as
> > suggested by Thomas and Maciej
> > - Link to v2: https://lore.kernel.org/lkml/20250417174712.69292-2-thorsten.blum@linux.dev/
> > ---
> > arch/mips/include/asm/ptrace.h | 3 ++-
> > 1 file changed, 2 insertions(+), 1 deletion(-)
> >
> > diff --git a/arch/mips/include/asm/ptrace.h b/arch/mips/include/asm/ptrace.h
> > index 85fa9962266a..ef72c46b5568 100644
> > --- a/arch/mips/include/asm/ptrace.h
> > +++ b/arch/mips/include/asm/ptrace.h
> > @@ -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))
> There is no 80 columns limit now, so no new line needed here.
but not forbidden to care about it. I still prefer this limit.
Thomas.
--
Crap can work. Given enough thrust pigs will fly, but it's not necessarily a
good idea. [ RFC1925, 2.3 ]
next prev parent reply other threads:[~2025-04-27 12:52 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-04-27 11:34 [PATCH v3] MIPS: Fix MAX_REG_OFFSET Thorsten Blum
2025-04-27 12:32 ` Huacai Chen
2025-04-27 12:51 ` Thomas Bogendoerfer [this message]
2025-04-27 13:30 ` Huacai Chen
2025-04-28 1:43 ` Maciej W. Rozycki
2025-04-28 1:35 ` Maciej W. Rozycki
2025-04-28 6:11 ` Thorsten Blum
2025-04-30 18:07 ` Thomas Bogendoerfer
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=aA4oag9MAXT3y0t8@alpha.franken.de \
--to=tsbogend@alpha.franken.de \
--cc=chenhuacai@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mips@vger.kernel.org \
--cc=macro@orcam.me.uk \
--cc=oleg@redhat.com \
--cc=thorsten.blum@linux.dev \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.