Skip to contentSkip to conversation

x86/hvm: Correct error message in check_segment()

PATCH In review Andrew Cooper 2 participants 2 messages Oct 2, 2020

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 x86/hvm: Correct error message in check_segment()

The error message is wrong (given AMD's older interpretation of what a NUL segment should contain, attribute wise), and actively unhelpful because you only get it in response to a hypercall where the one piece of information you cannot provide is the segment selector.

Fix the message to talk about segment attributes, rather than the selector.

---
CC: Jan Beulich <[email protected]>
CC: Roger Pau Monné <[email protected]>
CC: Wei Liu <[email protected]>

---
 xen/arch/x86/hvm/domain.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
xen/arch/x86/hvm/domain.c +1 -1
index 8e3375265c..ffe952c2df 100644
@@ -39,7 +39,7 @@ static int check_segment(struct segment_register *reg, enum x86_segment seg)
     {
         if ( seg != x86_seg_ds && seg != x86_seg_es )
         {
-            gprintk(XENLOG_ERR, "Null selector provided for CS, SS or TR\n");
+            gprintk(XENLOG_ERR, "Empty segment attributes for CS, SS or TR\n");
             return -EINVAL;
         }
         return 0;
Signature · 1 line
2.11.0
Acked-by on v1 1/1
#1 lore raw
Quoted 8 lines · Andrew Cooper

The error message is wrong (given AMD's older interpretation of what a NUL segment should contain, attribute wise), and actively unhelpful because you only get it in response to a hypercall where the one piece of information you cannot provide is the segment selector.

Fix the message to talk about segment attributes, rather than the selector.

albeit ...

xen/arch/x86/hvm/domain.c static int check_segment(struct segment_register *reg, enum x86_segment seg) · line 42

Quoted 8 lines
xen/arch/x86/hvm/domain.c +1 -1
@@ -39,7 +39,7 @@ static int check_segment(struct segment_register *reg, enum x86_segment seg)
     {
         if ( seg != x86_seg_ds && seg != x86_seg_es )
         {
-            gprintk(XENLOG_ERR, "Null selector provided for CS, SS or TR\n");
+            gprintk(XENLOG_ERR, "Empty segment attributes for CS, SS or TR\n");

... may I suggest "Null" or "Zero" instead of "Empty"?

Jan