This is the mail archive of the gdb-patches@sourceware.org mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [RFA] gdbserver/tracepoint.c, eval_agent_expr, prevent stack underflow.


On Wednesday 09 March 2011 01:32:12, Michael Snyder wrote:
> Pedro,
> 
> Correct me if I'm wrong, but it looks to me as if this function will 
> detect stack underflow only after it has happened, and an invalid stack 
> element has been used.  This change sets aside the zeroeth element of 
> the stack as a sentinel, to prevent that.
> 
> OK?

1. There are several checks on SP against 0 that you haven't
touched, that would no longer work as intended...

2. There are OPs that use 'stack[SP - 2]'.

3. gdb_agent_op_pick touches 'stack[SP - foo]', with an arbitrary foo.

So, I guess either make this use both 0 and 1 as sentinels,
or make everywhere that does --sp do `if (--sp >= 0)' instead.
(or even something else smarter.)  #3 looks like should have
its own check, in either way.

This evaluator is Stan's design, dunno if he has a preference.

This goes without saying, but please make sure gdb.trace/ doesn't
regress after the patch.

-- 
Pedro Alves


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]