Skip to contentSkip to conversation

Re [PATCH] x86/CET: Fix build following c/s 43b98e7190

DISCUSSION Jan Beulich 2 participants 5 messages Jun 2, 2020 – Jun 3, 2020

lore
Share & tools
lore
#0 lore raw
Quoted 8 lines

OSSTest reports:

x86_64.S: Assembler messages:
x86_64.S:57: Error: no such instruction: `setssbsy' /home/osstest/build.150510.build-amd64/xen/xen/Rules.mk:183: recipe for target 'head.o' failed make[4]: Leaving directory '/home/osstest/build.150510.build-amd64/xen/xen/arch/x86/boot' make[4]: *** [head.o] Error 1

Quoted 4 lines

All use of CET instructions, even those inside alternative blocks, needs to be behind CONFIG_XEN_SHSTK, as it indicates suitable toolchain support.

That's quite a bit of #ifdef-ary here. Simple (operand-less) insns like SETSSBSY could easily be made available via .byte directives. Would you be amenable to to ack-ing a patch to replace some of the #ifdef-s (at least the ones at the lstar, cstar, and sysenter entry points), after 4.14?

Jan

#1 lore raw
Quoted 11 lines · Jan Beulich
Quoted 11 lines

OSSTest reports:

x86_64.S: Assembler messages:
x86_64.S:57: Error: no such instruction: `setssbsy' /home/osstest/build.150510.build-amd64/xen/xen/Rules.mk:183: recipe for target 'head.o' failed make[4]: Leaving directory '/home/osstest/build.150510.build-amd64/xen/xen/arch/x86/boot' make[4]: *** [head.o] Error 1

All use of CET instructions, even those inside alternative blocks, needs to be behind CONFIG_XEN_SHSTK, as it indicates suitable toolchain support.

Quoted 6 lines
Quoted 1 line

That's quite a bit of #ifdef-ary here. Simple (operand-less) insns like SETSSBSY could easily be made available via .byte directives. Would you be amenable to to ack-ing a patch to replace some of the #ifdef-s (at least the ones at the lstar, cstar, and sysenter entry points), after 4.14?

Yeah - that was a bit of a mess in the end.  (But given the circumstances, and that I've got past form typo'ing the SETSSBSY opcode, it probably was the right move even in hindsight).

Reducing it to .byte should be fine so long as some form of /* setssbsy */ comment appears.

One other option would be to introduce a SETSSBSY macro, but that hides the alternative so is something I'd prefer to avoid.

~Andrew

#2 lore raw
Quoted 19 lines · Andrew Cooper
Quoted 11 lines · Jan Beulich
Quoted 11 lines

OSSTest reports:

x86_64.S: Assembler messages:
x86_64.S:57: Error: no such instruction: `setssbsy' /home/osstest/build.150510.build-amd64/xen/xen/Rules.mk:183: recipe for target 'head.o' failed make[4]: Leaving directory '/home/osstest/build.150510.build-amd64/xen/xen/arch/x86/boot' make[4]: *** [head.o] Error 1

All use of CET instructions, even those inside alternative blocks, needs to be behind CONFIG_XEN_SHSTK, as it indicates suitable toolchain support.

Quoted 6 lines
Quoted 1 line

That's quite a bit of #ifdef-ary here. Simple (operand-less) insns like SETSSBSY could easily be made available via .byte directives. Would you be amenable to to ack-ing a patch to replace some of the #ifdef-s (at least the ones at the lstar, cstar, and sysenter entry points), after 4.14?

Quoted 6 lines

Yeah - that was a bit of a mess in the end.  (But given the circumstances, and that I've got past form typo'ing the SETSSBSY opcode, it probably was the right move even in hindsight).

Reducing it to .byte should be fine so long as some form of /* setssbsy */ comment appears.

Sure.

Quoted 2 lines

One other option would be to introduce a SETSSBSY macro, but that hides the alternative so is something I'd prefer to avoid.

With this you mean you'd rather not see us go the CLAC/STAC route? I was instead thinking of a pure assembly macro named "setssbsy". In fact we could switch the CLAC/STAC ugliness to some such, if we end up being happy with the model.

Jan

#3 lore raw
Quoted 25 lines · Jan Beulich
Quoted 18 lines · Andrew Cooper
Quoted 11 lines · Jan Beulich
Quoted 11 lines

OSSTest reports:

x86_64.S: Assembler messages:
x86_64.S:57: Error: no such instruction: `setssbsy' /home/osstest/build.150510.build-amd64/xen/xen/Rules.mk:183: recipe for target 'head.o' failed make[4]: Leaving directory '/home/osstest/build.150510.build-amd64/xen/xen/arch/x86/boot' make[4]: *** [head.o] Error 1

All use of CET instructions, even those inside alternative blocks, needs to be behind CONFIG_XEN_SHSTK, as it indicates suitable toolchain support.

Quoted 6 lines
Quoted 1 line

That's quite a bit of #ifdef-ary here. Simple (operand-less) insns like SETSSBSY could easily be made available via .byte directives. Would you be amenable to to ack-ing a patch to replace some of the #ifdef-s (at least the ones at the lstar, cstar, and sysenter entry points), after 4.14?

Quoted 6 lines

Yeah - that was a bit of a mess in the end.  (But given the circumstances, and that I've got past form typo'ing the SETSSBSY opcode, it probably was the right move even in hindsight).

Reducing it to .byte should be fine so long as some form of /* setssbsy */ comment appears.

Quoted 8 lines

Sure.

Quoted 2 lines

One other option would be to introduce a SETSSBSY macro, but that hides the alternative so is something I'd prefer to avoid.

With this you mean you'd rather not see us go the CLAC/STAC route? I was instead thinking of a pure assembly macro named "setssbsy". In fact we could switch the CLAC/STAC ugliness to some such, if we end up being happy with the model.

The thing about the current STAC / CLAC is that, as written, they give the impression of being unconditional.  This is poor in terms of code clarity.

Furthermore, making them indistinguishable from the plain instructions is definitely a no-go, because then we've got assembly source (again, which appears unconditional) which doesn't match its disassembly (the backing nops) - at least with the macros in upper case, it is obvious that something is up, even if you have to searching for why.

If we went for pure assembly macros with an alt_ or maybe_ prefix, then that would be reasonable.  It looks as close to regular instruction as possible, but also makes it explicitly clear that it is conditional.

~Andrew

#4 lore raw
Quoted 45 lines · Andrew Cooper
Quoted 25 lines · Jan Beulich
Quoted 18 lines · Andrew Cooper
Quoted 11 lines · Jan Beulich
Quoted 11 lines

OSSTest reports:

x86_64.S: Assembler messages:
x86_64.S:57: Error: no such instruction: `setssbsy' /home/osstest/build.150510.build-amd64/xen/xen/Rules.mk:183: recipe for target 'head.o' failed make[4]: Leaving directory '/home/osstest/build.150510.build-amd64/xen/xen/arch/x86/boot' make[4]: *** [head.o] Error 1

All use of CET instructions, even those inside alternative blocks, needs to be behind CONFIG_XEN_SHSTK, as it indicates suitable toolchain support.

Quoted 6 lines
Quoted 1 line

That's quite a bit of #ifdef-ary here. Simple (operand-less) insns like SETSSBSY could easily be made available via .byte directives. Would you be amenable to to ack-ing a patch to replace some of the #ifdef-s (at least the ones at the lstar, cstar, and sysenter entry points), after 4.14?

Quoted 6 lines

Yeah - that was a bit of a mess in the end.  (But given the circumstances, and that I've got past form typo'ing the SETSSBSY opcode, it probably was the right move even in hindsight).

Reducing it to .byte should be fine so long as some form of /* setssbsy */ comment appears.

Quoted 8 lines

Sure.

Quoted 2 lines

One other option would be to introduce a SETSSBSY macro, but that hides the alternative so is something I'd prefer to avoid.

With this you mean you'd rather not see us go the CLAC/STAC route? I was instead thinking of a pure assembly macro named "setssbsy". In fact we could switch the CLAC/STAC ugliness to some such, if we end up being happy with the model.

The thing about the current STAC / CLAC is that, as written, they give the impression of being unconditional.  This is poor in terms of code clarity.

Furthermore, making them indistinguishable from the plain instructions is definitely a no-go, because then we've got assembly source (again, which appears unconditional) which doesn't match its disassembly (the backing nops) - at least with the macros in upper case, it is obvious that something is up, even if you have to searching for why.

Quoted 3 lines

If we went for pure assembly macros with an alt_ or maybe_ prefix, then that would be reasonable.  It looks as close to regular instruction as possible, but also makes it explicitly clear that it is conditional.

That wasn't the plan - I didn't mean to hide the alternatives aspect. I wanted to have simple "setssbsy", "clac", and "stac" macros expanding to just the insns, getting instantiated when !HAVE_AS_<whatever>. This would make assembly code look descriptive no matter what assembler capabilities there are (for these operand-less insns, that is, not in general).

Jan