Skip to contentSkip to conversation

xen: Fix incorrect taint constant

PATCH In review Andrew Cooper 3 participants 7 messages Jun 5, 2023 – Jun 7, 2023

lore
Share & tools
lore
#0 lore raw

PATCH v2 1/1 xen: Fix incorrect taint constant

Insecure is the word being looked for here. Especially given the nature of the sole caller, and the (correct) comment next to it.

Also update the taint marker from 'U' to 'I' for consistency; this isn't expected to impact anyone in practice.

Fixes 82c0d3d491cc ("xen: Add an unsecure Taint type")

---
CC: Jan Beulich <[email protected]>
CC: Roger Pau Monné <[email protected]>
CC: Wei Liu <[email protected]>
CC: Stefano Stabellini <[email protected]>
CC: Julien Grall <[email protected]>
CC: Volodymyr Babchuk <[email protected]>
CC: Bertrand Marquis <[email protected]>

v2:
* Fix commmit message
* Update comment ahead of print_tainted()
* Change the emitted char from 'U' to 'I'

---
 xen/arch/arm/cpuerrata.c | 2 +-
 xen/common/kernel.c      | 4 ++--
 xen/include/xen/lib.h    | 2 +-
 3 files changed, 4 insertions(+), 4 deletions(-)
xen/arch/arm/cpuerrata.c +1 -1
index 1abacfe5bb67..d0658aedb6aa 100644
@@ -695,7 +695,7 @@ void __init enable_errata_workarounds(void)
                     "**** Only trusted guests should be used.                             ****\n");
 
         /* Taint the machine has being insecure */
-        add_taint(TAINT_MACHINE_UNSECURE);
+        add_taint(TAINT_MACHINE_INSECURE);
     }
 #endif
 }
xen/common/kernel.c +2 -2
index f7b1f65f373c..b8b845763d9d 100644
@@ -343,8 +343,8 @@ unsigned int tainted;
  *  'C' - Console output is synchronous.
  *  'E' - An error (e.g. a machine check exceptions) has been injected.
  *  'H' - HVM forced emulation prefix is permitted.
+ *  'I' - Platform is insecure (usually due to an errata on the platform).
  *  'M' - Machine had a machine check experience.
- *  'U' - Platform is unsecure (usually due to an errata on the platform).
  *  'S' - Out of spec CPU (One core has a feature incompatible with others).
  *
  *      The string is overwritten by the next call to print_taint().
@@ -354,7 +354,7 @@ char *print_tainted(char *str)
     if ( tainted )
     {
         snprintf(str, TAINT_STRING_MAX_LEN, "Tainted: %c%c%c%c%c%c",
-                 tainted & TAINT_MACHINE_UNSECURE ? 'U' : ' ',
+                 tainted & TAINT_MACHINE_INSECURE ? 'I' : ' ',
                  tainted & TAINT_MACHINE_CHECK ? 'M' : ' ',
                  tainted & TAINT_SYNC_CONSOLE ? 'C' : ' ',
                  tainted & TAINT_ERROR_INJECT ? 'E' : ' ',
xen/include/xen/lib.h +1 -1
index e914ccade095..75ae7489b9f0 100644
@@ -201,7 +201,7 @@ uint64_t muldiv64(uint64_t a, uint32_t b, uint32_t c);
 #define TAINT_MACHINE_CHECK             (1u << 1)
 #define TAINT_ERROR_INJECT              (1u << 2)
 #define TAINT_HVM_FEP                   (1u << 3)
-#define TAINT_MACHINE_UNSECURE          (1u << 4)
+#define TAINT_MACHINE_INSECURE          (1u << 4)
 #define TAINT_CPU_OUT_OF_SPEC           (1u << 5)
 extern unsigned int tainted;
 #define TAINT_STRING_MAX_LEN            20

base-commit: 67fdffef9246c82cecd8db28838ed09e79e2528a

Signature · 1 line
2.30.2
Reviewed-by on v2 1/1
#1 lore raw

Hi Andrew,

Quoted 11 lines · Andrew Cooper

Insecure is the word being looked for here. Especially given the nature of the sole caller, and the (correct) comment next to it.

Also update the taint marker from 'U' to 'I' for consistency; this isn't expected to impact anyone in practice.

Fixes 82c0d3d491cc ("xen: Add an unsecure Taint type")

Cheers
Bertrand

#2 lore raw
In reply to Andrew Cooper
Quoted 4 lines · Andrew Cooper

v2:
* Fix commmit message
* Update comment ahead of print_tainted()
* Change the emitted char from 'U' to 'I'

Just to mention it: With this additional change I'm no longer considering this applicable to stable trees. I realize that one could argue that by taking it we could accelerate learning that we broke someone (if anyone), but I'm not inclined to follow this line of thinking. If Arm maintainers (seeing that only Arm uses this right now) think they want the change nevertheless, I'd include it, though.

Jan

#3 lore raw

Hi Jan,

Quoted 8 lines · Jan Beulich
Quoted 4 lines · Andrew Cooper

v2:
* Fix commmit message
* Update comment ahead of print_tainted()
* Change the emitted char from 'U' to 'I'

Quoted 8 lines

Just to mention it: With this additional change I'm no longer considering this applicable to stable trees. I realize that one could argue that by taking it we could accelerate learning that we broke someone (if anyone), but I'm not inclined to follow this line of thinking. If Arm maintainers (seeing that only Arm uses this right now) think they want the change nevertheless, I'd include it, though.

Not sure if it is what you mean here, but this is not a candidate for backports definitely.

Or do you mean something else here ?

Bertrand

Quoted 1 line

Jan

#4 lore raw
Quoted 19 lines · Bertrand Marquis

Hi Jan,

Quoted 8 lines · Jan Beulich
Quoted 4 lines · Andrew Cooper

v2:
* Fix commmit message
* Update comment ahead of print_tainted()
* Change the emitted char from 'U' to 'I'

Quoted 8 lines

Just to mention it: With this additional change I'm no longer considering this applicable to stable trees. I realize that one could argue that by taking it we could accelerate learning that we broke someone (if anyone), but I'm not inclined to follow this line of thinking. If Arm maintainers (seeing that only Arm uses this right now) think they want the change nevertheless, I'd include it, though.

Quoted 4 lines

Not sure if it is what you mean here, but this is not a candidate for backports definitely.

Or do you mean something else here ?

No, you got me right - I was asking whether to backport this.

Jan

#5 lore raw
In reply to Jan Beulich
Quoted 5 lines · Jan Beulich
Quoted 4 lines · Andrew Cooper

v2:
* Fix commmit message
* Update comment ahead of print_tainted()
* Change the emitted char from 'U' to 'I'

Quoted 7 lines

Just to mention it: With this additional change I'm no longer considering this applicable to stable trees. I realize that one could argue that by taking it we could accelerate learning that we broke someone (if anyone), but I'm not inclined to follow this line of thinking. If Arm maintainers (seeing that only Arm uses this right now) think they want the change nevertheless, I'd include it, though.

I'm not overly fussed.  It's not hard to rebase around.

~Andrew

#6 lore raw

Hi Andrew,

Quoted 16 lines · Andrew Cooper
Quoted 5 lines · Jan Beulich
Quoted 4 lines · Andrew Cooper

v2:
* Fix commmit message
* Update comment ahead of print_tainted()
* Change the emitted char from 'U' to 'I'

Quoted 7 lines

Just to mention it: With this additional change I'm no longer considering this applicable to stable trees. I realize that one could argue that by taking it we could accelerate learning that we broke someone (if anyone), but I'm not inclined to follow this line of thinking. If Arm maintainers (seeing that only Arm uses this right now) think they want the change nevertheless, I'd include it, though.

Quoted 1 line

I'm not overly fussed. It's not hard to rebase around.

I agree with Jan here and I do not think we should backport.

This is not fixing a bug and could induce some misunderstanding if we backport this change on a stable version.

Cheers
Bertrand

Quoted 2 lines

~Andrew