public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Ingo Molnar <mingo@kernel.org>
To: Josh Poimboeuf <jpoimboe@kernel.org>
Cc: x86@kernel.org, linux-kernel@vger.kernel.org,
	Nathan Chancellor <nathan@kernel.org>,
	Peter Zijlstra <peterz@infradead.org>,
	Alexandre Chartre <alexandre.chartre@oracle.com>,
	David Laight <david.laight.linux@gmail.com>
Subject: Re: [PATCH] objtool: Fix stack overflow in validate_branch()
Date: Tue, 2 Dec 2025 17:41:11 +0100	[thread overview]
Message-ID: <aS8Wp6yYvDy0vBHD@gmail.com> (raw)
In-Reply-To: <psjy5tyrapwlib45iempavojmwglmurdz26q5ybzkd4f5f3xw6@bjpssopuoavt>

* Josh Poimboeuf <jpoimboe@kernel.org> wrote:

> On Tue, Dec 02, 2025 at 08:16:28AM -0800, Josh Poimboeuf wrote:
> > -static int handle_insn_ops(struct instruction *insn,
> > -			   struct instruction *next_insn,
> > -			   struct insn_state *state)
> > +static int noinline handle_insn_ops(struct instruction *insn,
> > +				    struct instruction *next_insn,
> > +				    struct insn_state *state)
> >  {
> > +	struct insn_state prev_state __maybe_unused = *state;
> >  	struct stack_op *op;
> > -	int ret;
> > +	int ret = 0;
> >  
> >  	for (op = insn->stack_ops; op; op = op->next) {
> >  
> >  		ret = update_cfi_state(insn, next_insn, &state->cfi, op);
> >  		if (ret)
> > -			return ret;
> > +			goto done;
> >  
> >  		if (!opts.uaccess || !insn->alt_group)
> >  			continue;
> > @@ -3303,7 +3304,8 @@ static int handle_insn_ops(struct instruction *insn,
> >  				state->uaccess_stack = 1;
> >  			} else if (state->uaccess_stack >> 31) {
> >  				WARN_INSN(insn, "PUSHF stack exhausted");
> > -				return 1;
> > +				ret = 1;
> > +				goto done;
> >  			}
> >  			state->uaccess_stack <<= 1;
> >  			state->uaccess_stack  |= state->uaccess;
> > @@ -3319,6 +3321,8 @@ static int handle_insn_ops(struct instruction *insn,
> >  		}
> >  	}
> >  
> > +done:
> > +	TRACE_INSN_STATE(insn, &prev_state, state);
> >  	return 0;
> >  }
> 
> Argh, that should return 'ret'.  Ingo, can you fix that or should I post
> a v2?

No need, I've fixed it up.

Thanks,

	Ingo

  reply	other threads:[~2025-12-02 16:41 UTC|newest]

Thread overview: 26+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-12-02 16:16 [PATCH] objtool: Fix stack overflow in validate_branch() Josh Poimboeuf
2025-12-02 16:20 ` Ingo Molnar
2025-12-02 16:49   ` Josh Poimboeuf
2025-12-02 17:03     ` Ingo Molnar
2025-12-02 17:11       ` Josh Poimboeuf
2025-12-02 19:56         ` Josh Poimboeuf
2025-12-02 20:20           ` Ingo Molnar
2025-12-02 22:05             ` David Laight
2025-12-02 23:01               ` Josh Poimboeuf
2025-12-03 11:02                 ` David Laight
2025-12-03 16:11                 ` Ingo Molnar
2025-12-03 16:40                 ` [tip: objtool/urgent] objtool: Add more robust signal error handling, detect and warn about stack overflows tip-bot2 for Josh Poimboeuf
2025-12-03 18:48                 ` tip-bot2 for Josh Poimboeuf
2025-12-03  9:25     ` [PATCH] objtool: Fix stack overflow in validate_branch() Ingo Molnar
2025-12-03 18:54       ` Josh Poimboeuf
2025-12-03 18:58         ` Josh Poimboeuf
2025-12-03 19:15           ` Ingo Molnar
2025-12-03 19:37             ` David Laight
2025-12-03 20:30               ` Linus Torvalds
2025-12-03 23:53             ` Josh Poimboeuf
2025-12-03 19:11         ` Ingo Molnar
2025-12-04  2:47           ` Josh Poimboeuf
2025-12-02 16:27 ` [tip: objtool/urgent] " tip-bot2 for Josh Poimboeuf
2025-12-02 16:28 ` [PATCH] " Josh Poimboeuf
2025-12-02 16:41   ` Ingo Molnar [this message]
2025-12-02 16:44 ` [tip: objtool/urgent] " tip-bot2 for Josh Poimboeuf

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=aS8Wp6yYvDy0vBHD@gmail.com \
    --to=mingo@kernel.org \
    --cc=alexandre.chartre@oracle.com \
    --cc=david.laight.linux@gmail.com \
    --cc=jpoimboe@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=nathan@kernel.org \
    --cc=peterz@infradead.org \
    --cc=x86@kernel.org \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox