Skip to contentSkip to conversation

x86/pv: Fix !CONFIG_PV build following XSA-296

PATCH In review Andrew Cooper 4 participants 5 messages Oct 31, 2019 – Nov 1, 2019

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 x86/pv: Fix !CONFIG_PV build following XSA-296

PTF_* are declared within CONFIG_PV, and used outside:

mm.c: In function ‘_put_page_type’:
mm.c:2819:32: error: ‘PTF_preemptible’ undeclared (first use in this function)

       bool preemptible = flags & PTF_preemptible;
                                  ^~~~~~~~~~~~~~~
  mm.c:2819:32: note: each undeclared identifier is reported only once for each
  function it appears in
  mm.c:2842:24: error: ‘PTF_partial_set’ undeclared (first use in this function)
           if ( !(flags & PTF_partial_set) )
                          ^~~~~~~~~~~~~~~
  mm.c: In function ‘put_page_type_preemptible’:
  mm.c:3090:33: error: ‘PTF_preemptible’ undeclared (first use in this function)
       return _put_page_type(page, PTF_preemptible, NULL);
                                   ^~~~~~~~~~~~~~~
  mm.c: In function ‘put_old_guest_table’:
  mm.c:3108:25: error: ‘PTF_preemptible’ undeclared (first use in this function)
                           PTF_preemptible |
                           ^~~~~~~~~~~~~~~
  mm.c:3110:27: error: ‘PTF_partial_set’ undeclared (first use in this function)
                             PTF_partial_set : 0 ),
                             ^~~~~~~~~~~~~~~

mm.c: In function ‘put_page_type_preemptible’:
mm.c:3091:1: error: control reaches end of non-void function [-Werror=return-type]
}
^
cc1: all warnings being treated as errors

Reposition the definitions to be outside of the #ifdef CONFIG_PV

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

---
 xen/arch/x86/mm.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
xen/arch/x86/mm.c +2 -2
index 79c3e4c473..57f22775ac 100644
@@ -1063,8 +1063,6 @@ get_page_from_l1e(
     return -EBUSY;
 }
 
-#ifdef CONFIG_PV
-
 /*
  * The following flags are used to specify behavior of various get and
  * put commands.  The first is also stored in page->partial_flags to
@@ -1077,6 +1075,8 @@ get_page_from_l1e(
 #define PTF_defer                 (1 << 3)
 #define PTF_retain_ref_on_restart (1 << 4)
 
+#ifdef CONFIG_PV
+
 static int get_page_and_type_from_mfn(
     mfn_t mfn, unsigned long type, struct domain *d,
     unsigned int flags)
Signature · 7 lines
2.11.0


_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel
Reviewed-by on v1 1/1
#1 lore raw
Quoted 29 lines · Andrew Cooper

PTF_* are declared within CONFIG_PV, and used outside:

mm.c: In function ‘_put_page_type’:
mm.c:2819:32: error: ‘PTF_preemptible’ undeclared (first use in this function)

       bool preemptible = flags & PTF_preemptible;
                                  ^~~~~~~~~~~~~~~
  mm.c:2819:32: note: each undeclared identifier is reported only once for each
  function it appears in
  mm.c:2842:24: error: ‘PTF_partial_set’ undeclared (first use in this function)
           if ( !(flags & PTF_partial_set) )
                          ^~~~~~~~~~~~~~~
  mm.c: In function ‘put_page_type_preemptible’:
  mm.c:3090:33: error: ‘PTF_preemptible’ undeclared (first use in this function)
       return _put_page_type(page, PTF_preemptible, NULL);
                                   ^~~~~~~~~~~~~~~
  mm.c: In function ‘put_old_guest_table’:
  mm.c:3108:25: error: ‘PTF_preemptible’ undeclared (first use in this function)
                           PTF_preemptible |
                           ^~~~~~~~~~~~~~~
  mm.c:3110:27: error: ‘PTF_partial_set’ undeclared (first use in this function)
                             PTF_partial_set : 0 ),
                             ^~~~~~~~~~~~~~~

mm.c: In function ‘put_page_type_preemptible’:
mm.c:3091:1: error: control reaches end of non-void function [-Werror=return-type]
}
^
cc1: all warnings being treated as errors

Quoted 3 lines

Reposition the definitions to be outside of the #ifdef CONFIG_PV

_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel

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

PTF_* are declared within CONFIG_PV, and used outside:

mm.c: In function ‘_put_page_type’:
mm.c:2819:32: error: ‘PTF_preemptible’ undeclared (first use in this function)

        bool preemptible = flags & PTF_preemptible;
                                   ^~~~~~~~~~~~~~~
   mm.c:2819:32: note: each undeclared identifier is reported only once for each
   function it appears in
   mm.c:2842:24: error: ‘PTF_partial_set’ undeclared (first use in this function)
            if ( !(flags & PTF_partial_set) )
                           ^~~~~~~~~~~~~~~
   mm.c: In function ‘put_page_type_preemptible’:
   mm.c:3090:33: error: ‘PTF_preemptible’ undeclared (first use in this function)
        return _put_page_type(page, PTF_preemptible, NULL);
                                    ^~~~~~~~~~~~~~~
   mm.c: In function ‘put_old_guest_table’:
   mm.c:3108:25: error: ‘PTF_preemptible’ undeclared (first use in this function)
                            PTF_preemptible |
                            ^~~~~~~~~~~~~~~
   mm.c:3110:27: error: ‘PTF_partial_set’ undeclared (first use in this function)
                              PTF_partial_set : 0 ),
                              ^~~~~~~~~~~~~~~
   mm.c: In function ‘put_page_type_preemptible’:
   mm.c:3091:1: error: control reaches end of non-void function
   [-Werror=return-type]
    }
    ^
Quoted 5 lines

cc1: all warnings being treated as errors

Reposition the definitions to be outside of the #ifdef CONFIG_PV

Juergen

_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel