Re: [PATCH] x86: Document -mno-cet-switch

2022-05-12 Thread H.J. Lu via Gcc-patches
On Thu, May 12, 2022 at 12:15 AM Richard Biener wrote: > > On Wed, May 11, 2022 at 9:03 PM Florian Weimer via Gcc-patches > wrote: > > > > * H. J. Lu: > > > > > On Wed, May 11, 2022 at 11:45 AM Florian Weimer > > > wrote: > > >> > > >> * H. J. Lu: > > >> > > >> >> NOTRACK avoids the need for EN

Re: [PATCH] x86: Document -mno-cet-switch

2022-05-12 Thread Richard Biener via Gcc-patches
On Wed, May 11, 2022 at 9:03 PM Florian Weimer via Gcc-patches wrote: > > * H. J. Lu: > > > On Wed, May 11, 2022 at 11:45 AM Florian Weimer wrote: > >> > >> * H. J. Lu: > >> > >> >> NOTRACK avoids the need for ENDBR instructions, right? That's a > >> >> hardening improvement, so it should be use

Re: [PATCH] x86: Document -mno-cet-switch

2022-05-11 Thread H.J. Lu via Gcc-patches
On Wed, May 11, 2022 at 12:02 PM Florian Weimer wrote: > > * H. J. Lu: > > > On Wed, May 11, 2022 at 11:45 AM Florian Weimer wrote: > >> > >> * H. J. Lu: > >> > >> >> NOTRACK avoids the need for ENDBR instructions, right? That's a > >> >> hardening improvement, so it should be used by default. >

Re: [PATCH] x86: Document -mno-cet-switch

2022-05-11 Thread Florian Weimer via Gcc-patches
* H. J. Lu: > On Wed, May 11, 2022 at 11:45 AM Florian Weimer wrote: >> >> * H. J. Lu: >> >> >> NOTRACK avoids the need for ENDBR instructions, right? That's a >> >> hardening improvement, so it should be used by default. >> > >> > NOTRACK weakens IBT since it disables IBT on the indirect jump i

Re: [PATCH] x86: Document -mno-cet-switch

2022-05-11 Thread H.J. Lu via Gcc-patches
On Wed, May 11, 2022 at 11:45 AM Florian Weimer wrote: > > * H. J. Lu: > > >> NOTRACK avoids the need for ENDBR instructions, right? That's a > >> hardening improvement, so it should be used by default. > > > > NOTRACK weakens IBT since it disables IBT on the indirect jump instruction. > > GCC us

Re: [PATCH] x86: Document -mno-cet-switch

2022-05-11 Thread Florian Weimer via Gcc-patches
* H. J. Lu: >> NOTRACK avoids the need for ENDBR instructions, right? That's a >> hardening improvement, so it should be used by default. > > NOTRACK weakens IBT since it disables IBT on the indirect jump instruction. > GCC uses it in the jump table to avoid ENDBR. Typical jump table code looks

Re: [PATCH] x86: Document -mno-cet-switch

2022-05-11 Thread H.J. Lu via Gcc-patches
On Wed, May 11, 2022 at 11:22 AM Florian Weimer wrote: > > * H. J. Lu: > > >> >> > Generate jump tables with ENDBR and skip the NOTRACK prefix for > >> >> > indirect > >> >> > jump. Document -mno-cet-switch to turn off CET instrumentation on > >> >> > jump > >> >> > tables for switch statements

Re: [PATCH] x86: Document -mno-cet-switch

2022-05-11 Thread Florian Weimer via Gcc-patches
* H. J. Lu: >> >> > Generate jump tables with ENDBR and skip the NOTRACK prefix for indirect >> >> > jump. Document -mno-cet-switch to turn off CET instrumentation on jump >> >> > tables for switch statements. >> >> >> >> Of course, that is a slight regression in security hardening. >> >> >> >> Q

Re: [PATCH] x86: Document -mno-cet-switch

2022-05-11 Thread H.J. Lu via Gcc-patches
On Wed, May 11, 2022 at 8:58 AM Florian Weimer wrote: > > * H. J. Lu: > > > On Wed, May 11, 2022 at 1:12 AM Florian Weimer wrote: > >> > >> * H. J. Lu via Gcc-patches: > >> > >> > When -fcf-protection=branch is used, the compiler will generate jump > >> > tables where the indirect jump is prefixe

Re: [PATCH] x86: Document -mno-cet-switch

2022-05-11 Thread Florian Weimer via Gcc-patches
* H. J. Lu: > On Wed, May 11, 2022 at 1:12 AM Florian Weimer wrote: >> >> * H. J. Lu via Gcc-patches: >> >> > When -fcf-protection=branch is used, the compiler will generate jump >> > tables where the indirect jump is prefixed with the NOTRACK prefix, so >> > it can jump to non-ENDBR targets. Yet

Re: [PATCH] x86: Document -mno-cet-switch

2022-05-11 Thread H.J. Lu via Gcc-patches
On Wed, May 11, 2022 at 1:12 AM Florian Weimer wrote: > > * H. J. Lu via Gcc-patches: > > > When -fcf-protection=branch is used, the compiler will generate jump > > tables where the indirect jump is prefixed with the NOTRACK prefix, so > > it can jump to non-ENDBR targets. Yet, for NOTRACK prefixe

Re: [PATCH] x86: Document -mno-cet-switch

2022-05-11 Thread Florian Weimer via Gcc-patches
* H. J. Lu via Gcc-patches: > When -fcf-protection=branch is used, the compiler will generate jump > tables where the indirect jump is prefixed with the NOTRACK prefix, so > it can jump to non-ENDBR targets. Yet, for NOTRACK prefixes to work, the > NOTRACK specific enable bit must be set, what ren

Re: [PATCH] x86: Document -mno-cet-switch

2022-05-11 Thread Uros Bizjak via Gcc-patches
On Tue, May 10, 2022 at 6:20 PM H.J. Lu wrote: > > When -fcf-protection=branch is used, the compiler will generate jump > tables where the indirect jump is prefixed with the NOTRACK prefix, so > it can jump to non-ENDBR targets. Yet, for NOTRACK prefixes to work, the > NOTRACK specific enable bit

[PATCH] x86: Document -mno-cet-switch

2022-05-10 Thread H.J. Lu via Gcc-patches
When -fcf-protection=branch is used, the compiler will generate jump tables where the indirect jump is prefixed with the NOTRACK prefix, so it can jump to non-ENDBR targets. Yet, for NOTRACK prefixes to work, the NOTRACK specific enable bit must be set, what renders the binary broken on any environ