Skip to contentSkip to conversation

tools/libxc: Fix build of 32bit toolstacks on CentOS 5.x following XSA-125

PATCH In review Andrew Cooper 2 participants 16 messages Apr 13, 2015 – Jun 23, 2015

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 tools/libxc: Fix build of 32bit toolstacks on CentOS 5.x following XSA-125

gcc 4.1 of CentOS 5.x era does not like the typecheck in min() between uint64_t and unsigned long.

CC Konrad Rzeszutek Wilk <[email protected]>
CC Ian Campbell <[email protected]>
CC Ian Jackson <[email protected]>
CC Wei Liu <[email protected]>

---
This needs backporting to 4.5

---
 tools/libxc/xc_domain.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
tools/libxc/xc_domain.c +1 -1
index 95e3098..9434045 100644
@@ -2034,7 +2034,7 @@ int xc_domain_memory_mapping(
     max_batch_sz = nr_mfns;
     do
     {
-        nr = min(nr_mfns - done, max_batch_sz);
+        nr = min_t(unsigned long, nr_mfns - done, max_batch_sz);
         domctl.u.memory_mapping.nr_mfns = nr;
         domctl.u.memory_mapping.first_gfn = first_gfn + done;
         domctl.u.memory_mapping.first_mfn = first_mfn + done;
Signature · 1 line
1.7.10.4
#1 lore raw

PATCH 1/1 tools/libxc: Fix build of 32bit toolstacks on CentOS 5.x following XSA-125

gcc 4.1 of CentOS 5.x era does not like the typecheck in min() between uint64_t and unsigned long.

CC Konrad Rzeszutek Wilk <[email protected]>
CC Ian Campbell <[email protected]>
CC Ian Jackson <[email protected]>
CC Wei Liu <[email protected]>

---
This needs backporting to 4.2

---
 tools/libxc/xc_domain.c |   13 +++++--------
 1 file changed, 5 insertions(+), 8 deletions(-)
tools/libxc/xc_domain.c +5 -8
index 40ca771..6f93ebd 100644
@@ -1641,12 +1641,9 @@ int xc_map_domain_meminfo(xc_interface *xch, int domid,
     return -1;
 }
 
-#ifndef min
-#define min(X, Y) ({                             \
-            const typeof (X) _x = (X);           \
-            const typeof (Y) _y = (Y);           \
-            (void) (&_x == &_y);                 \
-            (_x < _y) ? _x : _y; })
+#ifndef min_t
+#define min_t(type,x,y) \
+    ({ type __x = (x); type __y = (y); __x < __y ? __x: __y; })
 #endif
 int xc_domain_memory_mapping(
     xc_interface *xch,
@@ -1669,7 +1666,7 @@ int xc_domain_memory_mapping(
     max_batch_sz = nr_mfns;
     do
     {
-        nr = min(nr_mfns - done, max_batch_sz);
+        nr = min_t(unsigned long, nr_mfns - done, max_batch_sz);
         domctl.u.memory_mapping.nr_mfns = nr;
         domctl.u.memory_mapping.first_gfn = first_gfn + done;
         domctl.u.memory_mapping.first_mfn = first_mfn + done;
@@ -1705,7 +1702,7 @@ int xc_domain_memory_mapping(
 
     return ret;
 }
-#undef min
+#undef min_t
 int xc_domain_ioport_mapping(
     xc_interface *xch,
     uint32_t domid,
Signature · 1 line
1.7.10.4
Acked-by on v1 1/1
#2 lore raw

Andrew Cooper writes ("[Xen-devel] [PATCH] [XEN-4.4] tools/libxc: Fix build of 32bit toolstacks on CentOS 5.x following XSA-125"):

Quoted 8 lines

gcc 4.1 of CentOS 5.x era does not like the typecheck in min() between uint64_t and unsigned long.

CC Konrad Rzeszutek Wilk <[email protected]>
CC Ian Campbell <[email protected]>
CC Ian Jackson <[email protected]>
CC Wei Liu <[email protected]>

FTR, this backport is itself:

And I have queued it.

Ian.

#3 lore raw
In reply to Andrew Cooper

Andrew Cooper writes ("[Xen-devel] [PATCH] [XEN-4.4] tools/libxc: Fix build of 32bit toolstacks on CentOS 5.x following XSA-125"):

Quoted 11 lines

gcc 4.1 of CentOS 5.x era does not like the typecheck in min() between uint64_t and unsigned long.

CC Konrad Rzeszutek Wilk <[email protected]>
CC Ian Campbell <[email protected]>
CC Ian Jackson <[email protected]>
CC Wei Liu <[email protected]>

---
This needs backporting to 4.2

This doesn't seem to apply to my staging-4.5.

Ian.

#4 lore raw
Quoted 10 lines · Ian Jackson

Andrew Cooper writes ("[Xen-devel] [PATCH] [XEN-4.4] tools/libxc: Fix build of 32bit toolstacks on CentOS 5.x following XSA-125"):

Quoted 9 lines

gcc 4.1 of CentOS 5.x era does not like the typecheck in min() between uint64_t and unsigned long.

CC Konrad Rzeszutek Wilk <[email protected]>
CC Ian Campbell <[email protected]>
CC Ian Jackson <[email protected]>
CC Wei Liu <[email protected]>
Quoted 5 lines
Quoted 2 lines

---
This needs backporting to 4.2

This doesn't seem to apply to my staging-4.5.

Ian.

It wont. This patch is for 4.4 and earlier. The previously-committed version for staging is a clean cherrypick back to 4.5

~Andrew

#5 lore raw
In reply to Ian Jackson

Ian Jackson writes ("Re: [Xen-devel] [PATCH] [XEN-4.4] tools/libxc: Fix build of 32bit toolstacks on CentOS 5.x following XSA-125"):

Quoted 10 lines

Andrew Cooper writes ("[Xen-devel] [PATCH] [XEN-4.4] tools/libxc: Fix build of 32bit toolstacks on CentOS 5.x following XSA-125"):

Quoted 9 lines

gcc 4.1 of CentOS 5.x era does not like the typecheck in min() between uint64_t and unsigned long.

CC Konrad Rzeszutek Wilk <[email protected]>
CC Ian Campbell <[email protected]>
CC Ian Jackson <[email protected]>
CC Wei Liu <[email protected]>
Quoted 4 lines
Quoted 2 lines

---
This needs backporting to 4.2

This doesn't seem to apply to my staging-4.5.

Sorry, I meant, to my staging-4.4.

Ian.

#6 lore raw
Quoted 11 lines · Ian Jackson

Ian Jackson writes ("Re: [Xen-devel] [PATCH] [XEN-4.4] tools/libxc: Fix build of 32bit toolstacks on CentOS 5.x following XSA-125"):

Quoted 10 lines

Andrew Cooper writes ("[Xen-devel] [PATCH] [XEN-4.4] tools/libxc: Fix build of 32bit toolstacks on CentOS 5.x following XSA-125"):

Quoted 9 lines

gcc 4.1 of CentOS 5.x era does not like the typecheck in min() between uint64_t and unsigned long.

CC Konrad Rzeszutek Wilk <[email protected]>
CC Ian Campbell <[email protected]>
CC Ian Jackson <[email protected]>
CC Wei Liu <[email protected]>
Quoted 4 lines
Quoted 3 lines
Quoted 2 lines

---
This needs backporting to 4.2

This doesn't seem to apply to my staging-4.5.

Sorry, I meant, to my staging-4.4.

You appear to have committed half of it as staging-4.4~2

~Andrew

#7 lore raw

Andrew Cooper writes ("Re: [Xen-devel] [PATCH] [XEN-4.4] tools/libxc: Fix build of 32bit toolstacks on CentOS 5.x following XSA-125"):

Quoted 4 lines · Ian Jackson
Quoted 1 line

Sorry, I meant, to my staging-4.4.

You appear to have committed half of it as staging-4.4~2

Nnnngg. Sorry. I think I am trying to do too many different things at once.

Ian.

#8 lore raw

Ian Jackson writes ("Re: [Xen-devel] [PATCH] [XEN-4.4] tools/libxc: Fix build of 32bit toolstacks on CentOS 5.x following XSA-125"):

Quoted 8 lines

Andrew Cooper writes ("Re: [Xen-devel] [PATCH] [XEN-4.4] tools/libxc: Fix build of 32bit toolstacks on CentOS 5.x following XSA-125"):

Quoted 4 lines · Ian Jackson
Quoted 1 line

Sorry, I meant, to my staging-4.4.

You appear to have committed half of it as staging-4.4~2

Nnnngg. Sorry. I think I am trying to do too many different things at once.

Now fixed.

Ian.

#9 lore raw
Quoted 10 lines · Ian Jackson

Ian Jackson writes ("Re: [Xen-devel] [PATCH] [XEN-4.4] tools/libxc: Fix build of 32bit toolstacks on CentOS 5.x following XSA-125"):

Quoted 6 lines

Andrew Cooper writes ("Re: [Xen-devel] [PATCH] [XEN-4.4] tools/libxc: Fix build of 32bit toolstacks on CentOS 5.x following XSA-125"):

Quoted 3 lines · Ian Jackson
Quoted 1 line

Sorry, I meant, to my staging-4.4.

You appear to have committed half of it as staging-4.4~2

Nnnngg. Sorry. I think I am trying to do too many different things at once.

Now fixed.

Ian.

Thanks.

~Andrew

#10 lore raw
In reply to Andrew Cooper

Andrew Cooper writes ("[Xen-devel] [PATCH] tools/libxc: Fix build of 32bit toolstacks on CentOS 5.x following XSA-125"):

Quoted 8 lines

gcc 4.1 of CentOS 5.x era does not like the typecheck in min() between uint64_t and unsigned long.

CC Konrad Rzeszutek Wilk <[email protected]>
CC Ian Campbell <[email protected]>
CC Ian Jackson <[email protected]>
CC Wei Liu <[email protected]>

As and when this is acked and pushed to #staging, we should update the advisory.

Quoted 1 line

This needs backporting to 4.5

To be clear, do you know whether this is a trivial cherry pick ?

Ian.

#11 lore raw
Quoted 9 lines · Ian Jackson

Andrew Cooper writes ("[Xen-devel] [PATCH] tools/libxc: Fix build of 32bit toolstacks on CentOS 5.x following XSA-125"):

Quoted 8 lines

gcc 4.1 of CentOS 5.x era does not like the typecheck in min() between uint64_t and unsigned long.

CC Konrad Rzeszutek Wilk <[email protected]>
CC Ian Campbell <[email protected]>
CC Ian Jackson <[email protected]>
CC Wei Liu <[email protected]>
Quoted 5 lines

As and when this is acked and pushed to #staging, we should update the advisory.

Quoted 1 line

This needs backporting to 4.5

To be clear, do you know whether this is a trivial cherry pick ?

It is trivial to cherrypick.

4.4 is the problematic case which I did the backport for separately, but then that is trivial to cherrypick back to 4.2

~Andrew

#12 lore raw

Ping on the patches themselves?

Quoted 26 lines · Andrew Cooper
Quoted 9 lines · Ian Jackson

Andrew Cooper writes ("[Xen-devel] [PATCH] tools/libxc: Fix build of 32bit toolstacks on CentOS 5.x following XSA-125"):

Quoted 8 lines

gcc 4.1 of CentOS 5.x era does not like the typecheck in min() between uint64_t and unsigned long.

CC Konrad Rzeszutek Wilk <[email protected]>
CC Ian Campbell <[email protected]>
CC Ian Jackson <[email protected]>
CC Wei Liu <[email protected]>
Quoted 5 lines

As and when this is acked and pushed to #staging, we should update the advisory.

Quoted 1 line

This needs backporting to 4.5

To be clear, do you know whether this is a trivial cherry pick ?

It is trivial to cherrypick.

4.4 is the problematic case which I did the backport for separately, but then that is trivial to cherrypick back to 4.2

~Andrew

_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xen.org/xen-devel

#13 lore raw

Ping again.

These should be included in 4.5.1

~Andrew

Quoted 34 lines · Andrew Cooper

Ping on the patches themselves?

Quoted 20 lines · Andrew Cooper
Quoted 9 lines · Ian Jackson

Andrew Cooper writes ("[Xen-devel] [PATCH] tools/libxc: Fix build of 32bit toolstacks on CentOS 5.x following XSA-125"):

Quoted 8 lines

gcc 4.1 of CentOS 5.x era does not like the typecheck in min() between uint64_t and unsigned long.

CC Konrad Rzeszutek Wilk <[email protected]>
CC Ian Campbell <[email protected]>
CC Ian Jackson <[email protected]>
CC Wei Liu <[email protected]>
Quoted 5 lines

As and when this is acked and pushed to #staging, we should update the advisory.

Quoted 1 line

This needs backporting to 4.5

To be clear, do you know whether this is a trivial cherry pick ?

It is trivial to cherrypick.

4.4 is the problematic case which I did the backport for separately, but then that is trivial to cherrypick back to 4.2

Quoted 6 lines

~Andrew

_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xen.org/xen-devel

_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xen.org/xen-devel

#14 lore raw

This patch is still needed in all branches which currently contain XSA-125, including staging.

~Andrew

Quoted 45 lines · Andrew Cooper

Ping again.

These should be included in 4.5.1

~Andrew

Quoted 25 lines · Andrew Cooper

Ping on the patches themselves?

Quoted 22 lines · Andrew Cooper
Quoted 9 lines · Ian Jackson

Andrew Cooper writes ("[Xen-devel] [PATCH] tools/libxc: Fix build of 32bit toolstacks on CentOS 5.x following XSA-125"):

Quoted 8 lines

gcc 4.1 of CentOS 5.x era does not like the typecheck in min() between uint64_t and unsigned long.

CC Konrad Rzeszutek Wilk <[email protected]>
CC Ian Campbell <[email protected]>
CC Ian Jackson <[email protected]>
CC Wei Liu <[email protected]>
Quoted 5 lines

As and when this is acked and pushed to #staging, we should update the advisory.

Quoted 1 line

This needs backporting to 4.5

To be clear, do you know whether this is a trivial cherry pick ?

It is trivial to cherrypick.

4.4 is the problematic case which I did the backport for separately, but then that is trivial to cherrypick back to 4.2

~Andrew

Quoted 8 lines
Quoted 4 lines

_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xen.org/xen-devel

_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xen.org/xen-devel

_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xen.org/xen-devel

Acked-by on v1 1/1
#15 lore raw
In reply to Andrew Cooper

Andrew Cooper writes ("[Xen-devel] [PATCH] tools/libxc: Fix build of 32bit toolstacks on CentOS 5.x following XSA-125"):

Quoted 2 lines

gcc 4.1 of CentOS 5.x era does not like the typecheck in min() between uint64_t and unsigned long.

I am about to apply this to staging and queue it for backport.

Ian.