Skip to contentSkip to conversation

XSM: guard .sysctl() and .readconsole() hooks

PATCH In review Jan Beulich 4 participants 14 messages Jun 18 – Jun 19

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 XSM: guard .sysctl() and .readconsole() hooks

Leaving the hook pointers in struct xsm_ops when !SYSCTL would lead to the BUG_ON() in xsm_fixup_ops() triggering for respectively configured hypervisors.

While moving the #ifdef for the corresponding xsm_*() wrappers, also move those for xsm_page_offline() (where the hook pointer field already is suitably guarded).

Fixes c9eabaa03a68 ("xen/xsm: wrap around xsm_sysctl with CONFIG_SYSCTL")
Fixes bddd9af6049f ("xen/sysctl: wrap around XEN_SYSCTL_readconsole")
xen/include/xsm/xsm.h +6 -12
@@ -61,8 +61,10 @@ struct xsm_ops {
 #endif
     int (*set_target)(struct domain *d, struct domain *e);
     int (*domctl)(struct domain *d, struct xen_domctl *op);
+#ifdef CONFIG_SYSCTL
     int (*sysctl)(int cmd);
     int (*readconsole)(uint32_t clear);
+#endif
 
     int (*evtchn_unbound)(struct domain *d, struct evtchn *chn, domid_t id2);
     int (*evtchn_interdomain)(struct domain *d1, struct evtchn *chn1,
@@ -248,23 +250,17 @@ static inline int xsm_domctl(xsm_default
     return alternative_call(xsm_ops.domctl, d, op);
 }
 
+#ifdef CONFIG_SYSCTL
 static inline int xsm_sysctl(xsm_default_t def, int cmd)
 {
-#ifdef CONFIG_SYSCTL
     return alternative_call(xsm_ops.sysctl, cmd);
-#else
-    return -EOPNOTSUPP;
-#endif
 }
 
 static inline int xsm_readconsole(xsm_default_t def, uint32_t clear)
 {
-#ifdef CONFIG_SYSCTL
     return alternative_call(xsm_ops.readconsole, clear);
-#else
-    return -EOPNOTSUPP;
-#endif
 }
+#endif
 
 static inline int xsm_evtchn_unbound(
     xsm_default_t def, struct domain *d1, struct evtchn *chn, domid_t id2)
@@ -558,14 +554,12 @@ static inline int xsm_resource_setup_mis
     return alternative_call(xsm_ops.resource_setup_misc);
 }
 
+#ifdef CONFIG_SYSCTL
 static inline int xsm_page_offline(xsm_default_t def, uint32_t cmd)
 {
-#ifdef CONFIG_SYSCTL
     return alternative_call(xsm_ops.page_offline, cmd);
-#else
-    return -EOPNOTSUPP;
-#endif
 }
+#endif
 
 static inline int xsm_hypfs_op(xsm_default_t def)
 {
Reviewed-by on v1 1/1
#1 lore raw
Quoted 11 lines · Jan Beulich

Leaving the hook pointers in struct xsm_ops when !SYSCTL would lead to the BUG_ON() in xsm_fixup_ops() triggering for respectively configured hypervisors.

While moving the #ifdef for the corresponding xsm_*() wrappers, also move those for xsm_page_offline() (where the hook pointer field already is suitably guarded).

Fixes c9eabaa03a68 ("xen/xsm: wrap around xsm_sysctl with CONFIG_SYSCTL")
Fixes bddd9af6049f ("xen/sysctl: wrap around XEN_SYSCTL_readconsole")

Ugly.  We probably ought to see about booting the RANDCONFIG hypervisor too, which should be able to spot things like this.

This is a regression vs 4.21, so does need including.

xen/include/xsm/xsm.h struct xsm_ops { · line 67

Quoted 11 lines
xen/include/xsm/xsm.h +2 -0
@@ -61,8 +61,10 @@ struct xsm_ops {
 #endif
     int (*set_target)(struct domain *d, struct domain *e);
     int (*domctl)(struct domain *d, struct xen_domctl *op);
+#ifdef CONFIG_SYSCTL
     int (*sysctl)(int cmd);
     int (*readconsole)(uint32_t clear);
+#endif

... this is now the 3rd CONFIG_SYSCTL in xsm_ops.

I know it will grow the diff, but can we see about collecting them into a single region, and in dummy_ops too?  It will shrink the overall result, and the order of pointers in this ops structure is uninteresting.

~Andrew

#2 lore raw
Quoted 9 lines · Andrew Cooper
Quoted 8 lines · Jan Beulich

Leaving the hook pointers in struct xsm_ops when !SYSCTL would lead to the BUG_ON() in xsm_fixup_ops() triggering for respectively configured hypervisors.

While moving the #ifdef for the corresponding xsm_*() wrappers, also move those for xsm_page_offline() (where the hook pointer field already is suitably guarded).

Quoted 8 lines
Quoted 3 lines
Fixes c9eabaa03a68 ("xen/xsm: wrap around xsm_sysctl with CONFIG_SYSCTL")
Fixes bddd9af6049f ("xen/sysctl: wrap around XEN_SYSCTL_readconsole")

Ugly.  We probably ought to see about booting the RANDCONFIG hypervisor too, which should be able to spot things like this.

This is a regression vs 4.21, so does need including.

Aiui it's a regression vs 4.20, i.e. will want backporting to 4.21.

Quoted 1 line

Thanks.

Quoted 13 lines

xen/include/xsm/xsm.h struct xsm_ops { · line 67

Quoted 10 lines
xen/include/xsm/xsm.h +2 -0
@@ -61,8 +61,10 @@ struct xsm_ops {
 #endif
     int (*set_target)(struct domain *d, struct domain *e);
     int (*domctl)(struct domain *d, struct xen_domctl *op);
+#ifdef CONFIG_SYSCTL
     int (*sysctl)(int cmd);
     int (*readconsole)(uint32_t clear);
+#endif

... this is now the 3rd CONFIG_SYSCTL in xsm_ops.

Quoted 3 lines

I know it will grow the diff, but can we see about collecting them into a single region, and in dummy_ops too?  It will shrink the overall result, and the order of pointers in this ops structure is uninteresting.

I have a far more consolidating patch in the works, which is how I actually noticed the issue. I'd prefer to keep things as simple as possible here.

Jan

#3 lore raw
Quoted 34 lines · Jan Beulich
Quoted 9 lines · Andrew Cooper
Quoted 8 lines · Jan Beulich

Leaving the hook pointers in struct xsm_ops when !SYSCTL would lead to the BUG_ON() in xsm_fixup_ops() triggering for respectively configured hypervisors.

While moving the #ifdef for the corresponding xsm_*() wrappers, also move those for xsm_page_offline() (where the hook pointer field already is suitably guarded).

Quoted 7 lines
Quoted 3 lines
Fixes c9eabaa03a68 ("xen/xsm: wrap around xsm_sysctl with CONFIG_SYSCTL")
Fixes bddd9af6049f ("xen/sysctl: wrap around XEN_SYSCTL_readconsole")

Ugly.  We probably ought to see about booting the RANDCONFIG hypervisor too, which should be able to spot things like this.

This is a regression vs 4.21, so does need including.

Aiui it's a regression vs 4.20, i.e. will want backporting to 4.21.

Quoted 1 line

Thanks.

Quoted 12 lines

xen/include/xsm/xsm.h struct xsm_ops { · line 67

Quoted 10 lines
xen/include/xsm/xsm.h +2 -0
@@ -61,8 +61,10 @@ struct xsm_ops {
 #endif
     int (*set_target)(struct domain *d, struct domain *e);
     int (*domctl)(struct domain *d, struct xen_domctl *op);
+#ifdef CONFIG_SYSCTL
     int (*sysctl)(int cmd);
     int (*readconsole)(uint32_t clear);
+#endif

... this is now the 3rd CONFIG_SYSCTL in xsm_ops.

Quoted 5 lines
Quoted 3 lines

I know it will grow the diff, but can we see about collecting them into a single region, and in dummy_ops too?  It will shrink the overall result, and the order of pointers in this ops structure is uninteresting.

I have a far more consolidating patch in the works, which is how I actually noticed the issue. I'd prefer to keep things as simple as possible here.

Ok.  Fine by me.

~Andrew

#4 lore raw
In reply to Jan Beulich
Quoted 38 lines · Jan Beulich
Quoted 9 lines · Andrew Cooper
Quoted 8 lines · Jan Beulich

Leaving the hook pointers in struct xsm_ops when !SYSCTL would lead to the BUG_ON() in xsm_fixup_ops() triggering for respectively configured hypervisors.

While moving the #ifdef for the corresponding xsm_*() wrappers, also move those for xsm_page_offline() (where the hook pointer field already is suitably guarded).

Quoted 8 lines
Quoted 3 lines
Fixes c9eabaa03a68 ("xen/xsm: wrap around xsm_sysctl with CONFIG_SYSCTL")
Fixes bddd9af6049f ("xen/sysctl: wrap around XEN_SYSCTL_readconsole")

Ugly.  We probably ought to see about booting the RANDCONFIG hypervisor too, which should be able to spot things like this.

This is a regression vs 4.21, so does need including.

Aiui it's a regression vs 4.20, i.e. will want backporting to 4.21.

Quoted 1 line

Thanks.

Quoted 13 lines

xen/include/xsm/xsm.h struct xsm_ops { · line 67

Quoted 10 lines
xen/include/xsm/xsm.h +2 -0
@@ -61,8 +61,10 @@ struct xsm_ops {
  #endif
      int (*set_target)(struct domain *d, struct domain *e);
      int (*domctl)(struct domain *d, struct xen_domctl *op);
+#ifdef CONFIG_SYSCTL
      int (*sysctl)(int cmd);
      int (*readconsole)(uint32_t clear);
+#endif

... this is now the 3rd CONFIG_SYSCTL in xsm_ops.

Quoted 6 lines
Quoted 3 lines

I know it will grow the diff, but can we see about collecting them into a single region, and in dummy_ops too?  It will shrink the overall result, and the order of pointers in this ops structure is uninteresting.

I have a far more consolidating patch in the works, which is how I actually noticed the issue. I'd prefer to keep things as simple as possible here.

By the way, I was going back through this and notices that they are not ifdef out in xsm/dummy.h. Are we relying on them being inlines to ensure that they do not result in dead code?

v/r,
dps

#5 lore raw
Quoted 43 lines · Daniel P. Smith
Quoted 42 lines · Jan Beulich
Quoted 9 lines · Andrew Cooper
Quoted 8 lines · Jan Beulich

Leaving the hook pointers in struct xsm_ops when !SYSCTL would lead to the BUG_ON() in xsm_fixup_ops() triggering for respectively configured hypervisors.

While moving the #ifdef for the corresponding xsm_*() wrappers, also move those for xsm_page_offline() (where the hook pointer field already is suitably guarded).

Quoted 8 lines
Quoted 3 lines
Fixes c9eabaa03a68 ("xen/xsm: wrap around xsm_sysctl with CONFIG_SYSCTL")
Fixes bddd9af6049f ("xen/sysctl: wrap around XEN_SYSCTL_readconsole")

Ugly.  We probably ought to see about booting the RANDCONFIG hypervisor too, which should be able to spot things like this.

This is a regression vs 4.21, so does need including.

Aiui it's a regression vs 4.20, i.e. will want backporting to 4.21.

Quoted 1 line

Thanks.

Quoted 16 lines

xen/include/xsm/xsm.h struct xsm_ops { · line 67

Quoted 10 lines
xen/include/xsm/xsm.h +2 -0
@@ -61,8 +61,10 @@ struct xsm_ops {
  #endif
      int (*set_target)(struct domain *d, struct domain *e);
      int (*domctl)(struct domain *d, struct xen_domctl *op);
+#ifdef CONFIG_SYSCTL
      int (*sysctl)(int cmd);
      int (*readconsole)(uint32_t clear);
+#endif

... this is now the 3rd CONFIG_SYSCTL in xsm_ops.

I know it will grow the diff, but can we see about collecting them into a single region, and in dummy_ops too?  It will shrink the overall result, and the order of pointers in this ops structure is uninteresting.

Quoted 6 lines
Quoted 2 lines

I have a far more consolidating patch in the works, which is how I actually noticed the issue. I'd prefer to keep things as simple as possible here.

By the way, I was going back through this and notices that they are not ifdef out in xsm/dummy.h. Are we relying on them being inlines to ensure that they do not result in dead code?

I think so. Maybe it's unhelpful that we have

#define XSM_INLINE __maybe_unused

and we may instead better want explicit #ifdef wherever necessary.

Jan

#6 lore raw
Quoted 44 lines · Jan Beulich
Quoted 43 lines · Daniel P. Smith
Quoted 42 lines · Jan Beulich
Quoted 9 lines · Andrew Cooper
Quoted 8 lines · Jan Beulich

Leaving the hook pointers in struct xsm_ops when !SYSCTL would lead to the BUG_ON() in xsm_fixup_ops() triggering for respectively configured hypervisors.

While moving the #ifdef for the corresponding xsm_*() wrappers, also move those for xsm_page_offline() (where the hook pointer field already is suitably guarded).

Quoted 8 lines
Quoted 3 lines
Fixes c9eabaa03a68 ("xen/xsm: wrap around xsm_sysctl with CONFIG_SYSCTL")
Fixes bddd9af6049f ("xen/sysctl: wrap around XEN_SYSCTL_readconsole")

Ugly.  We probably ought to see about booting the RANDCONFIG hypervisor too, which should be able to spot things like this.

This is a regression vs 4.21, so does need including.

Aiui it's a regression vs 4.20, i.e. will want backporting to 4.21.

Quoted 1 line

Thanks.

Quoted 16 lines

xen/include/xsm/xsm.h struct xsm_ops { · line 67

Quoted 10 lines
xen/include/xsm/xsm.h +2 -0
@@ -61,8 +61,10 @@ struct xsm_ops {
   #endif
       int (*set_target)(struct domain *d, struct domain *e);
       int (*domctl)(struct domain *d, struct xen_domctl *op);
+#ifdef CONFIG_SYSCTL
       int (*sysctl)(int cmd);
       int (*readconsole)(uint32_t clear);
+#endif

... this is now the 3rd CONFIG_SYSCTL in xsm_ops.

I know it will grow the diff, but can we see about collecting them into a single region, and in dummy_ops too?  It will shrink the overall result, and the order of pointers in this ops structure is uninteresting.

Quoted 9 lines
Quoted 6 lines
Quoted 2 lines

I have a far more consolidating patch in the works, which is how I actually noticed the issue. I'd prefer to keep things as simple as possible here.

By the way, I was going back through this and notices that they are not ifdef out in xsm/dummy.h. Are we relying on them being inlines to ensure that they do not result in dead code?

I think so. Maybe it's unhelpful that we have

To be clear, you want to leave as is for now (or at least pick up in another patch)?

Quoted 4 lines

#define XSM_INLINE __maybe_unused

and we may instead better want explicit #ifdef wherever necessary.

It's been a while since I tore that apart, but I believe there is some trickery hidden in XSM_INLINE depending on whether XSM is "on or off". I could be wrong as it's been a while since I tried to unwrap all of it.

v/r,
dps

#7 lore raw
Quoted 48 lines · Daniel P. Smith
Quoted 47 lines · Jan Beulich
Quoted 46 lines · Daniel P. Smith
Quoted 44 lines · Jan Beulich
Quoted 9 lines · Andrew Cooper
Quoted 8 lines · Jan Beulich

Leaving the hook pointers in struct xsm_ops when !SYSCTL would lead to the BUG_ON() in xsm_fixup_ops() triggering for respectively configured hypervisors.

While moving the #ifdef for the corresponding xsm_*() wrappers, also move those for xsm_page_offline() (where the hook pointer field already is suitably guarded).

Quoted 8 lines
Quoted 3 lines
Fixes c9eabaa03a68 ("xen/xsm: wrap around xsm_sysctl with CONFIG_SYSCTL")
Fixes bddd9af6049f ("xen/sysctl: wrap around XEN_SYSCTL_readconsole")

Ugly.  We probably ought to see about booting the RANDCONFIG hypervisor too, which should be able to spot things like this.

This is a regression vs 4.21, so does need including.

Aiui it's a regression vs 4.20, i.e. will want backporting to 4.21.

Quoted 1 line

Thanks.

Quoted 13 lines

xen/include/xsm/xsm.h struct xsm_ops { · line 67

Quoted 10 lines
xen/include/xsm/xsm.h +2 -0
@@ -61,8 +61,10 @@ struct xsm_ops {
   #endif
       int (*set_target)(struct domain *d, struct domain *e);
       int (*domctl)(struct domain *d, struct xen_domctl *op);
+#ifdef CONFIG_SYSCTL
       int (*sysctl)(int cmd);
       int (*readconsole)(uint32_t clear);
+#endif

... this is now the 3rd CONFIG_SYSCTL in xsm_ops.

Quoted 3 lines

I know it will grow the diff, but can we see about collecting them into a single region, and in dummy_ops too?  It will shrink the overall result, and the order of pointers in this ops structure is uninteresting.

I have a far more consolidating patch in the works, which is how I actually noticed the issue. I'd prefer to keep things as simple as possible here.

Quoted 8 lines
Quoted 5 lines
Quoted 3 lines

By the way, I was going back through this and notices that they are not ifdef out in xsm/dummy.h. Are we relying on them being inlines to ensure that they do not result in dead code?

I think so. Maybe it's unhelpful that we have

To be clear, you want to leave as is for now (or at least pick up in another patch)?

It's up to you - I can add the #ifdef there, but it doesn't look to strictly be needed.

Quoted 7 lines
Quoted 3 lines

#define XSM_INLINE __maybe_unused

and we may instead better want explicit #ifdef wherever necessary.

It's been a while since I tore that apart, but I believe there is some trickery hidden in XSM_INLINE depending on whether XSM is "on or off". I could be wrong as it's been a while since I tried to unwrap all of it.

Aiui the "trickery" is that it's

#define XSM_INLINE __maybe_unused

with XSM=y and

#define XSM_INLINE always_inline

with XSM=n.

Jan

#8 lore raw
Quoted 53 lines · Jan Beulich
Quoted 52 lines · Daniel P. Smith
Quoted 51 lines · Jan Beulich
Quoted 49 lines · Daniel P. Smith
Quoted 38 lines · Jan Beulich
Quoted 9 lines · Andrew Cooper
Quoted 8 lines · Jan Beulich

Leaving the hook pointers in struct xsm_ops when !SYSCTL would lead to the BUG_ON() in xsm_fixup_ops() triggering for respectively configured hypervisors.

While moving the #ifdef for the corresponding xsm_*() wrappers, also move those for xsm_page_offline() (where the hook pointer field already is suitably guarded).

Quoted 8 lines
Quoted 3 lines
Fixes c9eabaa03a68 ("xen/xsm: wrap around xsm_sysctl with CONFIG_SYSCTL")
Fixes bddd9af6049f ("xen/sysctl: wrap around XEN_SYSCTL_readconsole")

Ugly.  We probably ought to see about booting the RANDCONFIG hypervisor too, which should be able to spot things like this.

This is a regression vs 4.21, so does need including.

Aiui it's a regression vs 4.20, i.e. will want backporting to 4.21.

Quoted 1 line

Thanks.

Quoted 13 lines

xen/include/xsm/xsm.h struct xsm_ops { · line 67

Quoted 10 lines
xen/include/xsm/xsm.h +2 -0
@@ -61,8 +61,10 @@ struct xsm_ops {
   #endif
       int (*set_target)(struct domain *d, struct domain *e);
       int (*domctl)(struct domain *d, struct xen_domctl *op);
+#ifdef CONFIG_SYSCTL
       int (*sysctl)(int cmd);
       int (*readconsole)(uint32_t clear);
+#endif

... this is now the 3rd CONFIG_SYSCTL in xsm_ops.

Quoted 6 lines
Quoted 3 lines

I know it will grow the diff, but can we see about collecting them into a single region, and in dummy_ops too?  It will shrink the overall result, and the order of pointers in this ops structure is uninteresting.

I have a far more consolidating patch in the works, which is how I actually noticed the issue. I'd prefer to keep things as simple as possible here.

By the way, I was going back through this and notices that they are not ifdef out in xsm/dummy.h. Are we relying on them being inlines to ensure that they do not result in dead code?

Quoted 7 lines
Quoted 4 lines
Quoted 1 line

I think so. Maybe it's unhelpful that we have

To be clear, you want to leave as is for now (or at least pick up in another patch)?

It's up to you - I can add the #ifdef there, but it doesn't look to strictly be needed.

Can you please make explicit which way you'd like it in order to provide an ack, so this bug fix can go in?

Jan

#9 lore raw
Quoted 54 lines · Jan Beulich
Quoted 53 lines · Jan Beulich
Quoted 52 lines · Daniel P. Smith
Quoted 51 lines · Jan Beulich
Quoted 49 lines · Daniel P. Smith
Quoted 38 lines · Jan Beulich
Quoted 9 lines · Andrew Cooper
Quoted 8 lines · Jan Beulich

Leaving the hook pointers in struct xsm_ops when !SYSCTL would lead to the BUG_ON() in xsm_fixup_ops() triggering for respectively configured hypervisors.

While moving the #ifdef for the corresponding xsm_*() wrappers, also move those for xsm_page_offline() (where the hook pointer field already is suitably guarded).

Quoted 8 lines
Quoted 3 lines
Fixes c9eabaa03a68 ("xen/xsm: wrap around xsm_sysctl with CONFIG_SYSCTL")
Fixes bddd9af6049f ("xen/sysctl: wrap around XEN_SYSCTL_readconsole")

Ugly.  We probably ought to see about booting the RANDCONFIG hypervisor too, which should be able to spot things like this.

This is a regression vs 4.21, so does need including.

Aiui it's a regression vs 4.20, i.e. will want backporting to 4.21.

Quoted 1 line

Thanks.

Quoted 13 lines

xen/include/xsm/xsm.h struct xsm_ops { · line 67

Quoted 10 lines
xen/include/xsm/xsm.h +2 -0
@@ -61,8 +61,10 @@ struct xsm_ops {
    #endif
        int (*set_target)(struct domain *d, struct domain *e);
        int (*domctl)(struct domain *d, struct xen_domctl *op);
+#ifdef CONFIG_SYSCTL
        int (*sysctl)(int cmd);
        int (*readconsole)(uint32_t clear);
+#endif

... this is now the 3rd CONFIG_SYSCTL in xsm_ops.

Quoted 6 lines
Quoted 3 lines

I know it will grow the diff, but can we see about collecting them into a single region, and in dummy_ops too?  It will shrink the overall result, and the order of pointers in this ops structure is uninteresting.

I have a far more consolidating patch in the works, which is how I actually noticed the issue. I'd prefer to keep things as simple as possible here.

By the way, I was going back through this and notices that they are not ifdef out in xsm/dummy.h. Are we relying on them being inlines to ensure that they do not result in dead code?

Quoted 7 lines
Quoted 7 lines
Quoted 4 lines
Quoted 1 line

I think so. Maybe it's unhelpful that we have

To be clear, you want to leave as is for now (or at least pick up in another patch)?

It's up to you - I can add the #ifdef there, but it doesn't look to strictly be needed.

It's not needed and will create minimal but extra churn on back port, so we can forego for now.

Quoted 2 lines

Can you please make explicit which way you'd like it in order to provide an ack, so this bug fix can go in?

#10 lore raw
In reply to Jan Beulich
Quoted 38 lines · Jan Beulich
Quoted 9 lines · Andrew Cooper
Quoted 8 lines · Jan Beulich

Leaving the hook pointers in struct xsm_ops when !SYSCTL would lead to the BUG_ON() in xsm_fixup_ops() triggering for respectively configured hypervisors.

While moving the #ifdef for the corresponding xsm_*() wrappers, also move those for xsm_page_offline() (where the hook pointer field already is suitably guarded).

Quoted 8 lines
Quoted 3 lines
Fixes c9eabaa03a68 ("xen/xsm: wrap around xsm_sysctl with CONFIG_SYSCTL")
Fixes bddd9af6049f ("xen/sysctl: wrap around XEN_SYSCTL_readconsole")

Ugly.  We probably ought to see about booting the RANDCONFIG hypervisor too, which should be able to spot things like this.

This is a regression vs 4.21, so does need including.

Aiui it's a regression vs 4.20, i.e. will want backporting to 4.21.

Quoted 1 line

Thanks.

Quoted 13 lines

xen/include/xsm/xsm.h struct xsm_ops { · line 67

Quoted 10 lines
xen/include/xsm/xsm.h +2 -0
@@ -61,8 +61,10 @@ struct xsm_ops {
  #endif
      int (*set_target)(struct domain *d, struct domain *e);
      int (*domctl)(struct domain *d, struct xen_domctl *op);
+#ifdef CONFIG_SYSCTL
      int (*sysctl)(int cmd);
      int (*readconsole)(uint32_t clear);
+#endif

... this is now the 3rd CONFIG_SYSCTL in xsm_ops.

Quoted 6 lines
Quoted 3 lines

I know it will grow the diff, but can we see about collecting them into a single region, and in dummy_ops too?  It will shrink the overall result, and the order of pointers in this ops structure is uninteresting.

I have a far more consolidating patch in the works, which is how I actually noticed the issue. I'd prefer to keep things as simple as possible here.

Would also be good to clean up flask_ops similarly.

v/r,
dps

#11 lore raw
Quoted 39 lines · Daniel P. Smith
Quoted 38 lines · Jan Beulich
Quoted 9 lines · Andrew Cooper
Quoted 8 lines · Jan Beulich

Leaving the hook pointers in struct xsm_ops when !SYSCTL would lead to the BUG_ON() in xsm_fixup_ops() triggering for respectively configured hypervisors.

While moving the #ifdef for the corresponding xsm_*() wrappers, also move those for xsm_page_offline() (where the hook pointer field already is suitably guarded).

Quoted 8 lines
Quoted 3 lines
Fixes c9eabaa03a68 ("xen/xsm: wrap around xsm_sysctl with CONFIG_SYSCTL")
Fixes bddd9af6049f ("xen/sysctl: wrap around XEN_SYSCTL_readconsole")

Ugly.  We probably ought to see about booting the RANDCONFIG hypervisor too, which should be able to spot things like this.

This is a regression vs 4.21, so does need including.

Aiui it's a regression vs 4.20, i.e. will want backporting to 4.21.

Quoted 1 line

Thanks.

Quoted 13 lines

xen/include/xsm/xsm.h struct xsm_ops { · line 67

Quoted 10 lines
xen/include/xsm/xsm.h +2 -0
@@ -61,8 +61,10 @@ struct xsm_ops {
  #endif
      int (*set_target)(struct domain *d, struct domain *e);
      int (*domctl)(struct domain *d, struct xen_domctl *op);
+#ifdef CONFIG_SYSCTL
      int (*sysctl)(int cmd);
      int (*readconsole)(uint32_t clear);
+#endif

... this is now the 3rd CONFIG_SYSCTL in xsm_ops.

Quoted 8 lines
Quoted 6 lines
Quoted 3 lines

I know it will grow the diff, but can we see about collecting them into a single region, and in dummy_ops too?  It will shrink the overall result, and the order of pointers in this ops structure is uninteresting.

I have a far more consolidating patch in the works, which is how I actually noticed the issue. I'd prefer to keep things as simple as possible here.

Would also be good to clean up flask_ops similarly.

Hence the "far more consolidating" - that'll happen (implicitly) all in one go.

Jan

#12 lore raw
Quoted 44 lines · Jan Beulich
Quoted 43 lines · Daniel P. Smith
Quoted 42 lines · Jan Beulich
Quoted 9 lines · Andrew Cooper
Quoted 8 lines · Jan Beulich

Leaving the hook pointers in struct xsm_ops when !SYSCTL would lead to the BUG_ON() in xsm_fixup_ops() triggering for respectively configured hypervisors.

While moving the #ifdef for the corresponding xsm_*() wrappers, also move those for xsm_page_offline() (where the hook pointer field already is suitably guarded).

Quoted 8 lines
Quoted 3 lines
Fixes c9eabaa03a68 ("xen/xsm: wrap around xsm_sysctl with CONFIG_SYSCTL")
Fixes bddd9af6049f ("xen/sysctl: wrap around XEN_SYSCTL_readconsole")

Ugly.  We probably ought to see about booting the RANDCONFIG hypervisor too, which should be able to spot things like this.

This is a regression vs 4.21, so does need including.

Aiui it's a regression vs 4.20, i.e. will want backporting to 4.21.

Quoted 1 line

Thanks.

Quoted 16 lines

xen/include/xsm/xsm.h struct xsm_ops { · line 67

Quoted 10 lines
xen/include/xsm/xsm.h +2 -0
@@ -61,8 +61,10 @@ struct xsm_ops {
   #endif
       int (*set_target)(struct domain *d, struct domain *e);
       int (*domctl)(struct domain *d, struct xen_domctl *op);
+#ifdef CONFIG_SYSCTL
       int (*sysctl)(int cmd);
       int (*readconsole)(uint32_t clear);
+#endif

... this is now the 3rd CONFIG_SYSCTL in xsm_ops.

I know it will grow the diff, but can we see about collecting them into a single region, and in dummy_ops too?  It will shrink the overall result, and the order of pointers in this ops structure is uninteresting.

Quoted 8 lines
Quoted 4 lines
Quoted 2 lines

I have a far more consolidating patch in the works, which is how I actually noticed the issue. I'd prefer to keep things as simple as possible here.

Would also be good to clean up flask_ops similarly.

Hence the "far more consolidating" - that'll happen (implicitly) all in one go.

Perfect. Just wanted to be sure it was on your radar.

v/r,
dps

#13 lore raw
In reply to Jan Beulich
Quoted 4 lines · Jan Beulich

Leaving the hook pointers in struct xsm_ops when !SYSCTL would lead to the BUG_ON() in xsm_fixup_ops() triggering for respectively configured hypervisors.

Quoted 8 lines

While moving the #ifdef for the corresponding xsm_*() wrappers, also move those for xsm_page_offline() (where the hook pointer field already is suitably guarded).

Fixes c9eabaa03a68 ("xen/xsm: wrap around xsm_sysctl with CONFIG_SYSCTL")
Fixes bddd9af6049f ("xen/sysctl: wrap around XEN_SYSCTL_readconsole")

~ Oleksii