Re: [PATCH] rs6000: ROP - Do not disable shrink-wrapping for leaf functions [PR114759]

2024-06-18 Thread Peter Bergner
On 6/18/24 3:38 PM, Segher Boessenkool wrote: > From my viewpoint, -mrop-protect should not change code generation at > all, except of course it has to emit some hash* insns :-) Ideally, I agree with that. That said, the hash* insns only accept negative offsets and the allowed range is rather

Re: [PATCH] rs6000: ROP - Do not disable shrink-wrapping for leaf functions [PR114759]

2024-06-18 Thread Segher Boessenkool
On Tue, Jun 18, 2024 at 12:53:09PM -0500, Peter Bergner wrote: > On 6/18/24 8:20 AM, Segher Boessenkool wrote: > > On Mon, Jun 17, 2024 at 08:54:46PM -0500, Peter Bergner wrote: > >> So we should be able to shrink-wrap in the presence of the ROP protection. > [snip] > > But do we want to? And,

Re: [PATCH] rs6000: ROP - Do not disable shrink-wrapping for leaf functions [PR114759]

2024-06-18 Thread Peter Bergner
On 6/18/24 8:20 AM, Segher Boessenkool wrote: > On Mon, Jun 17, 2024 at 08:54:46PM -0500, Peter Bergner wrote: >> So we should be able to shrink-wrap in the presence of the ROP protection. [snip] > But do we want to? And, how far, in what cases not? My answer to the above would be "yes", "as far

Re: [PATCH] rs6000: ROP - Do not disable shrink-wrapping for leaf functions [PR114759]

2024-06-18 Thread Segher Boessenkool
On Mon, Jun 17, 2024 at 08:54:46PM -0500, Peter Bergner wrote: > On 6/17/24 7:57 PM, Segher Boessenkool wrote: > > On Mon, Jun 17, 2024 at 06:49:18PM -0500, Peter Bergner wrote: > >> On 6/17/24 6:11 PM, Segher Boessenkool wrote: > >> Yeah, I didn't write that, I only moved it, but I can try to

Re: [PATCH] rs6000: ROP - Do not disable shrink-wrapping for leaf functions [PR114759]

2024-06-17 Thread Peter Bergner
On 6/17/24 7:57 PM, Segher Boessenkool wrote: > On Mon, Jun 17, 2024 at 06:49:18PM -0500, Peter Bergner wrote: >> On 6/17/24 6:11 PM, Segher Boessenkool wrote: >> Yeah, I didn't write that, I only moved it, but I can try to come up with >> an explanation of why we need to disable it now. That

Re: [PATCH] rs6000: ROP - Do not disable shrink-wrapping for leaf functions [PR114759]

2024-06-17 Thread Segher Boessenkool
Hi! On Mon, Jun 17, 2024 at 06:49:18PM -0500, Peter Bergner wrote: > On 6/17/24 6:11 PM, Segher Boessenkool wrote: > >> - /* If we are inserting ROP-protect instructions, disable shrink wrap. > >> */ > >> - if (rs6000_rop_protect) > >> -flag_shrink_wrap = 0; > >> } > > > > (Yes, I know

[PATCH] rs6000: ROP - Do not disable shrink-wrapping for leaf functions [PR114759]

2024-06-17 Thread Peter Bergner
While auditing our ROP code generation for some test cases I wrote, I noticed a few issues which I'm tracking in PR114759. The first issue I noticed is we disable shrink-wrapping when using -mrop-protect, even in the cases where we never emit the ROP instructions because they're not needed. The

Re: [PATCH] rs6000: ROP - Do not disable shrink-wrapping for leaf functions [PR114759]

2024-06-17 Thread Peter Bergner
On 6/17/24 6:11 PM, Segher Boessenkool wrote: > "ROP insns" are the instructions used in such exploits, not what you > mean here :-) > > The instructions are called "hash*"C, so maybe call tbem "hash insns" > or "ROP protect hash insns"?. Ok, that bad verbiage was in the extra commentary not

Re: [PATCH] rs6000: ROP - Do not disable shrink-wrapping for leaf functions [PR114759]

2024-06-17 Thread Segher Boessenkool
Hi! On Mon, Jun 17, 2024 at 05:26:39PM -0500, Peter Bergner wrote: > While auditing our ROP code generation for some test cases I wrote, I noticed > a few issues which I'm tracking in PR114759. The first issue I noticed is we > disable shrink-wrapping when using -mrop-protect, even in the cases