tools: Support to use abi-dumper on libraries
cover tools: Support to use abi-dumper on libraries
The first 6 patches are fixes to build with the -Og optimisation level, which is an expectation of abi-dumper and a good idea generally. There are 2 definite bugfixes, and 4 of more questionable usefulness. All fixes are simple.
The next patch switches to -Og by default. This is potentially risky - I've fixed up all build failures that Gitlab CI can spot, but I don't guarentee that I've fixed all of them. However, it only affects debug builds - release builds are unchanged, and we're before -RC1 so have plenty of time to react to any fallout.
The final 3 patches arrange for abi-dumper to run if it is available in the build environment. This is strictly optional, has no effect if abi-dumper isn't in the build environment, and writes out one extra file if present.
With this tooling place, we can now add support to OSSTest to check for ABI breakges in builds.
Andrew Cooper (10):
tools/xl: Fix exit code for xl vkbattach
tools/libxg: Fix uninitialised variable in write_x86_cpu_policy_records() tools/libxg: Fix uninitialised variable in meminit()
tools/libxl: Fix uninitialised variable in libxl__domain_get_device_model_uid() tools/libxl: Fix uninitialised variable in libxl__write_stub_dmargs() stubdom/xenstored: Fix uninitialised variables in lu_read_state()
tools: Use -Og for debug builds when available
tools: Check for abi-dumper in ./configure
tools/libs: Add rule to generate headers.lst
tools/libs: Write out an ABI analysis when abi-dumper is available
config/Tools.mk.in | 1 + tools/Rules.mk | 5 +++-- tools/configure | 41 +++++++++++++++++++++++++++++++++++++ tools/configure.ac | 1 + tools/libs/.gitignore | 1 + tools/libs/guest/xg_dom_arm.c | 2 +- tools/libs/guest/xg_sr_common_x86.c | 6 ++++++ tools/libs/libs.mk | 18 +++++++++++++++- tools/libs/light/libxl_dm.c | 6 ++---- tools/xenstore/xenstored_control.c | 2 +- tools/xl/xl_vkb.c | 3 ++- 11 files changed, 76 insertions(+), 10 deletions(-) create mode 100644 tools/libs/.gitignore
Signature · 1 line
2.11.0
PATCH 1/10 tools/xl: Fix exit code for `xl vkbattach`
Various version of gcc, when compiling with -Og, complain:
xl_vkb.c: In function 'main_vkbattach':
xl_vkb.c:79:12: error: 'rc' may be used uninitialized in this function [-Werror=maybe-uninitialized]
79 | return rc;
| ^~The dryrun_only path really does leave rc uninitalised. Introduce a done label for success paths to use.
---
CC: Ian Jackson <[email protected]>
CC: Wei Liu <[email protected]>
CC: Anthony PERARD <[email protected]>
--- tools/xl/xl_vkb.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
tools/xl/xl_vkb.c +2 -1
@@ -64,7 +64,7 @@ int main_vkbattach(int argc, char **argv)char *json =libxl_device_vkb_to_json (ctx, &vkb);printf ("vkb: %s\n" , json);free (json); - goto out; + goto done; }if (libxl_device_vkb_add (ctx, domid, &vkb,0 )) {
@@ -72,6 +72,7 @@ int main_vkbattach(int argc, char **argv) rc =ERROR_FAIL ; goto out; } +done: rc =0 ; out:
Signature · 1 line
2.11.0
Re: [PATCH 01/10] tools/xl: Fix exit code for `xl vkbattach`
Andrew Cooper writes ("[PATCH 01/10] tools/xl: Fix exit code for xl vkbattach"):
Quoted 4 lines
Various version of gcc, when compiling with -Og, complain:
xl_vkb.c: In function 'main_vkbattach':
xl_vkb.c:79:12: error: 'rc' may be used uninitialized in this function [-Werror=maybe-uninitialized]
Quoted 8 lines
79 | return rc; | ^~The
dryrun_onlypath really does leave rc uninitalised. Introduce a done label for success paths to use.Fixes a15166af7c3 ("xl: add vkb config parser and CLI")Signed-off-by Andrew Cooper <[email protected]>
Re: [PATCH 01/10] tools/xl: Fix exit code for `xl vkbattach`
In reply to Andrew CooperAndrew Cooper writes ("[PATCH 01/10] tools/xl: Fix exit code for xl vkbattach"):
Quoted 4 lines
Various version of gcc, when compiling with -Og, complain:
xl_vkb.c: In function 'main_vkbattach':
xl_vkb.c:79:12: error: 'rc' may be used uninitialized in this function [-Werror=maybe-uninitialized]
Quoted 8 lines
79 | return rc; | ^~The
dryrun_onlypath really does leave rc uninitalised. Introduce a done label for success paths to use.Fixes a15166af7c3 ("xl: add vkb config parser and CLI")Signed-off-by Andrew Cooper <[email protected]>
PATCH 2/10 tools/libxg: Fix uninitialised variable in write_x86_cpu_policy_records()
In reply to Andrew CooperVarious version of gcc, when compiling with -Og, complain:
xg_sr_common_x86.c: In function 'write_x86_cpu_policy_records':
xg_sr_common_x86.c:92:12: error: 'rc' may be used uninitialized in this function [-Werror=maybe-uninitialized]
92 | return rc;
| ^~The complaint is legitimate, and can occur with unexpected behaviour of two related hypercalls in combination with a libc which permits zero-length malloc()s.
Have an explicit rc = 0 on the success path, and make the MSRs record error handling consistent with the CPUID record before it.
---
CC: Ian Jackson <[email protected]>
CC: Wei Liu <[email protected]>
--- tools/libs/guest/xg_sr_common_x86.c | 6 ++++++ 1 file changed, 6 insertions(+)
tools/libs/guest/xg_sr_common_x86.c +6 -0
@@ -83,7 +83,13 @@ int write_x86_cpu_policy_records(struct xc_sr_context *ctx) msrs.length = nr_msrs *sizeof (xen_msr_entry_t);if ( msrs.length ) + { rc =write_record (ctx, &msrs); +if ( rc ) + goto out; + } + + rc =0 ; out:free (cpuid.data);
Signature · 1 line
2.11.0
Re: [PATCH 02/10] tools/libxg: Fix uninitialised variable in write_x86_cpu_policy_records()
Quoted 11 lines · Andrew Cooper
Various version of gcc, when compiling with -Og, complain:
xg_sr_common_x86.c: In function 'write_x86_cpu_policy_records':
xg_sr_common_x86.c:92:12: error: 'rc' may be used uninitialized in this function [-Werror=maybe-uninitialized]92 | return rc; | ^~The complaint is legitimate, and can occur with unexpected behaviour of two related hypercalls in combination with a libc which permits zero-length malloc()s.
Quoted 5 lines
Have an explicit rc = 0 on the success path, and make the MSRs record error handling consistent with the CPUID record before it.
Fixes f6b2b8ec53d ("libxc/save: Write X86_{CPUID,MSR}_DATA records")Signed-off-by Andrew Cooper <[email protected]>
Re: [PATCH 02/10] tools/libxg: Fix uninitialised variable in write_x86_cpu_policy_records()
In reply to Andrew CooperAndrew Cooper writes ("[PATCH 02/10] tools/libxg: Fix uninitialised variable in write_x86_cpu_policy_records()"):
Quoted 2 lines
Fixes f6b2b8ec53d ("libxc/save: Write X86_{CPUID,MSR}_DATA records")Signed-off-by Andrew Cooper <[email protected]>
PATCH 3/10 tools/libxg: Fix uninitialised variable in meminit()
In reply to Andrew CooperVarious version of gcc, when compiling with -Og, complain:
xg_dom_arm.c: In function 'meminit':
xg_dom_arm.c:420:19: error: 'p2m_size' may be used uninitialized in this function [-Werror=maybe-uninitialized]
420 | dom->p2m_size = p2m_size;
| ~~~~~~~~~~~~~~^~~~~~~~~~---
CC: Ian Jackson <[email protected]>
CC: Wei Liu <[email protected]>
CC: Stefano Stabellini <[email protected]>
CC: Julien Grall <[email protected]>
Julien/Stefano: I can't work out how this variable is supposed to work, and the fact that it isn't a straight accumulation across the RAM banks looks suspect.
--- tools/libs/guest/xg_dom_arm.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
tools/libs/guest/xg_dom_arm.c +1 -1
@@ -373,7 +373,7 @@ static int meminit(struct xc_dom_image *dom)const uint64_t modsize = dtb_size + ramdisk_size;const uint64_t ram128mb = bankbase[0 ] + (128 <<20 ); -xen_pfn_t p2m_size; +xen_pfn_t p2m_size =0 ;uint64_t bank0end;assert (dom->rambase_pfn <<XC_PAGE_SHIFT == bankbase[0 ]);
Signature · 1 line
2.11.0
Re: [PATCH 03/10] tools/libxg: Fix uninitialised variable in meminit()
Hi Andrew,
Quoted 8 lines · Andrew Cooper
Various version of gcc, when compiling with -Og, complain:
xg_dom_arm.c: In function 'meminit':xg_dom_arm.c:420:19: error: 'p2m_size' may be used uninitialized in this function [-Werror=maybe-uninitialized] 420 | dom->p2m_size = p2m_size; | ~~~~~~~~~~~~~~^~~~~~~~~~Signed-off-by Andrew Cooper <[email protected]>
This was reported nearly 3 years ago (see [1]) and it is pretty sad this was never merged :(.
Quoted 9 lines
---
CC: Ian Jackson <[email protected]>
CC: Wei Liu <[email protected]>
CC: Stefano Stabellini <[email protected]>
CC: Julien Grall <[email protected]>Julien/Stefano: I can't work out how this variable is supposed to work, and the fact that it isn't a straight accumulation across the RAM banks looks suspect.
It looks buggy, but the P2M is never used on Arm. In fact, you sent a patch a year ago to drop it (see [2]). It would be nice to revive it.
Quoted 10 lines
--- tools/libs/guest/xg_dom_arm.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)tools/libs/guest/xg_dom_arm.c +0
-0
tools/libs/guest/xg_dom_arm.c static int meminit(struct xc_dom_image *dom) · line 379
Quoted 8 lines
tools/libs/guest/xg_dom_arm.c +1
-1@@ -373,7 +373,7 @@ static int meminit(struct xc_dom_image *dom)const uint64_t modsize = dtb_size + ramdisk_size;const uint64_t ram128mb = bankbase[0 ] + (128 <<20 ); -xen_pfn_t p2m_size; +xen_pfn_t p2m_size =0 ;uint64_t bank0end;assert (dom->rambase_pfn <<XC_PAGE_SHIFT == bankbase[0 ]);
If your original series is too risky for 4.15, I would consider to remote p2m_size completely and always 0 dom->p2m_size.
Cheers,
[1] https://lore.kernel.org/xen-devel/[email protected]/
[2] https://patchwork.kernel.org/project/xen-devel/patch/[email protected]/
Signature · 1 line
Julien Grall
Re: [PATCH 03/10] tools/libxg: Fix uninitialised variable in meminit()
Quoted 11 lines · Julien Grall
Hi Andrew,
Quoted 8 lines · Andrew Cooper
Various version of gcc, when compiling with -Og, complain:
xg_dom_arm.c: In function 'meminit':
xg_dom_arm.c:420:19: error: 'p2m_size' may be used uninitialized in this function [-Werror=maybe-uninitialized]
420 |dom->p2m_size=p2m_size;
| ~~~~~~~~~~~~~~^~~~~~~~~~
Quoted 4 lines
Quoted 1 line
Signed-off-by Andrew Cooper <[email protected]>This was reported nearly 3 years ago (see [1]) and it is pretty sad this was never merged :(.
:( We've got far too many patches which fall through the cracks like this.
Quoted 7 lines
Quoted 7 lines
---
CC: Ian Jackson <[email protected]>
CC: Wei Liu <[email protected]>
CC: Stefano Stabellini <[email protected]>
CC: Julien Grall <[email protected]>
Quoted 8 lines
Quoted 5 lines
Julien/Stefano: I can't work out how this variable is supposed to work, and
the fact that it isn't a straight accumulation across the RAM banks looks
suspect.It looks buggy, but the P2M is never used on Arm. In fact, you sent a patch a year ago to drop it (see [2]). It would be nice to revive it.
That series was committed more than a year ago - ee21f10d70^..97e34ad22d
- and tbh, I'd forgotten about it.
In light of that, I think I'll just delete the p2m_size references here. It's easy to prove correctness via inspection, and removes a dubious construct entirely.
~Andrew
PATCH 3/10 tools/libxg: Drop stale p2m logic from ARM's meminit()
In reply to Andrew CooperVarious version of gcc, when compiling with -Og, complain:
xg_dom_arm.c: In function 'meminit':
xg_dom_arm.c:420:19: error: 'p2m_size' may be used uninitialized in this function [-Werror=maybe-uninitialized]
420 | dom->p2m_size = p2m_size;
| ~~~~~~~~~~~~~~^~~~~~~~~~This is actually entirely stale code since ee21f10d70^..97e34ad22d which removed the 1:1 identity p2m for translated domains.
Drop the write of d->p2m_size, and the p2m_size local variable. Reposition the p2m_size field in struct xc_dom_image and correct some stale documentation.
This change really ought to have been part of the original cleanup series.
No actual change to how ARM domains are constructed.
---
CC: Ian Jackson <[email protected]>
CC: Wei Liu <[email protected]>
CC: Stefano Stabellini <[email protected]>
CC: Julien Grall <[email protected]>
v2:
* Delete stale p2m_size infrastructure.
--- tools/include/xenguest.h | 5 ++--- tools/libs/guest/xg_dom_arm.c | 5 ----- 2 files changed, 2 insertions(+), 8 deletions(-)
tools/include/xenguest.h +2 -3
@@ -145,6 +145,7 @@ struct xc_dom_image {* eventually copied into guest context. */ xen_pfn_t *pv_p2m; +xen_pfn_t p2m_size;/* number of pfns covered by pv_p2m */ /* physical memory *
@@ -154,12 +155,10 @@ struct xc_dom_image {* * An ARM guest has GUEST_RAM_BANKS regions of RAM, with * rambank_size[i] pages in each. The lowest RAM address -* (corresponding to the base of the p2m arrays above) is stored -* in rambase_pfn. +* is stored in rambase_pfn. */ xen_pfn_t rambase_pfn;xen_pfn_t total_pages; -xen_pfn_t p2m_size;/* number of pfns covered by p2m */ struct xc_dom_phys *phys_pages;#if defined (__arm__) || defined(__aarch64__)xen_pfn_t rambank_size[GUEST_RAM_BANKS ];
tools/libs/guest/xg_dom_arm.c +0 -5
@@ -373,7 +373,6 @@ static int meminit(struct xc_dom_image *dom)const uint64_t modsize = dtb_size + ramdisk_size;const uint64_t ram128mb = bankbase[0 ] + (128 <<20 ); -xen_pfn_t p2m_size;uint64_t bank0end;assert (dom->rambase_pfn <<XC_PAGE_SHIFT == bankbase[0 ]);
@@ -409,16 +408,12 @@ static int meminit(struct xc_dom_image *dom) ramsize -= banksize; - p2m_size = ( bankbase[i] + banksize - bankbase[0 ] ) >>XC_PAGE_SHIFT ; - dom->rambank_size[i] = banksize >>XC_PAGE_SHIFT ; }assert (dom->rambank_size[0 ] !=0 );assert (ramsize ==0 );/* Too much RAM is rejected above */ - dom->p2m_size = p2m_size; -/* setup initial p2m and allocate guest memory */ for ( i =0 ; i <GUEST_RAM_BANKS && dom->rambank_size[i]; i++ ) {
Signature · 1 line
2.11.0
Re: [PATCH v1.1 03/10] tools/libxg: Drop stale p2m logic from ARM's meminit()
Andrew Cooper writes ("[PATCH v1.1 03/10] tools/libxg: Drop stale p2m logic from ARM's meminit()"):
Quoted 14 lines
Various version of gcc, when compiling with -Og, complain:
xg_dom_arm.c: In function 'meminit':
xg_dom_arm.c:420:19: error: 'p2m_size' may be used uninitialized in this function [-Werror=maybe-uninitialized]420 | dom->p2m_size = p2m_size; | ~~~~~~~~~~~~~~^~~~~~~~~~This is actually entirely stale code since ee21f10d70^..97e34ad22d which removed the 1:1 identity p2m for translated domains.
Drop the write of
d->p2m_size, and thep2m_sizelocal variable. Reposition thep2m_sizefield in structxc_dom_imageand correct some stale documentation.
Quoted 5 lines
This change really ought to have been part of the original cleanup series.
No actual change to how ARM domains are constructed.
Signed-off-by Andrew Cooper <[email protected]>
Re: [PATCH v1.1 03/10] tools/libxg: Drop stale p2m logic from ARM's meminit()
In reply to Andrew CooperHi Andrew,
Quoted 14 lines · Andrew Cooper
Various version of gcc, when compiling with -Og, complain:
xg_dom_arm.c: In function 'meminit':xg_dom_arm.c:420:19: error: 'p2m_size' may be used uninitialized in this function [-Werror=maybe-uninitialized] 420 | dom->p2m_size = p2m_size; | ~~~~~~~~~~~~~~^~~~~~~~~~This is actually entirely stale code since ee21f10d70^..97e34ad22d which removed the 1:1 identity p2m for translated domains.
Drop the write of
d->p2m_size, and thep2m_sizelocal variable. Reposition thep2m_sizefield in structxc_dom_imageand correct some stale documentation.
Quoted 5 lines
This change really ought to have been part of the original cleanup series.
No actual change to how ARM domains are constructed.
Signed-off-by Andrew Cooper <[email protected]>
Cheers,
Quoted 69 lines
---
CC: Ian Jackson <[email protected]>
CC: Wei Liu <[email protected]>
CC: Stefano Stabellini <[email protected]>
CC: Julien Grall <[email protected]>v2:
* Delete stalep2m_sizeinfrastructure.--- tools/include/xenguest.h | 5 ++--- tools/libs/guest/xg_dom_arm.c | 5 ----- 2 files changed, 2 insertions(+), 8 deletions(-)tools/include/xenguest.h +2
-3@@ -145,6 +145,7 @@ struct xc_dom_image {* eventually copied into guest context. */ xen_pfn_t *pv_p2m; +xen_pfn_t p2m_size;/* number of pfns covered by pv_p2m */ /* physical memory * @@ -154,12 +155,10 @@ struct xc_dom_image {* * An ARM guest has GUEST_RAM_BANKS regions of RAM, with * rambank_size[i] pages in each. The lowest RAM address -* (corresponding to the base of the p2m arrays above) is stored -* in rambase_pfn. +* is stored in rambase_pfn. */ xen_pfn_t rambase_pfn;xen_pfn_t total_pages; -xen_pfn_t p2m_size;/* number of pfns covered by p2m */ struct xc_dom_phys *phys_pages;#if defined (__arm__) || defined(__aarch64__)xen_pfn_t rambank_size[GUEST_RAM_BANKS ];tools/libs/guest/xg_dom_arm.c +0
-5@@ -373,7 +373,6 @@ static int meminit(struct xc_dom_image *dom)const uint64_t modsize = dtb_size + ramdisk_size;const uint64_t ram128mb = bankbase[0 ] + (128 <<20 ); -xen_pfn_t p2m_size;uint64_t bank0end;assert (dom->rambase_pfn <<XC_PAGE_SHIFT == bankbase[0 ]);@@ -409,16 +408,12 @@ static int meminit(struct xc_dom_image *dom) ramsize -= banksize; - p2m_size = ( bankbase[i] + banksize - bankbase[0 ] ) >>XC_PAGE_SHIFT ; - dom->rambank_size[i] = banksize >>XC_PAGE_SHIFT ; }assert (dom->rambank_size[0 ] !=0 );assert (ramsize ==0 );/* Too much RAM is rejected above */ - dom->p2m_size = p2m_size; -/* setup initial p2m and allocate guest memory */ for ( i =0 ; i <GUEST_RAM_BANKS && dom->rambank_size[i]; i++ ) {
Signature · 1 line
Julien Grall
PATCH 4/10 tools/libxl: Fix uninitialised variable in libxl__domain_get_device_model_uid()
In reply to Andrew CooperVarious version of gcc, when compiling with -Og, complain:
libxl_dm.c: In function 'libxl__domain_get_device_model_uid':
libxl_dm.c:256:12: error: 'kill_by_uid' may be used uninitialized in this function [-Werror=maybe-uninitialized]
256 | if (kill_by_uid)
| ^The logic is sufficiently complicated I can't figure out if the complain is legitimate or not. There is exactly one path wanting kill_by_uid set to true, so default it to false and drop the existing workaround for this problem at other optimisation levels.
---
CC: Ian Jackson <[email protected]>
CC: Wei Liu <[email protected]>
CC: Anthony PERARD <[email protected]>
--- tools/libs/light/libxl_dm.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-)
tools/libs/light/libxl_dm.c +1 -3
@@ -128,7 +128,7 @@ static int libxl__domain_get_device_model_uid(libxl__gc *gc,int rc;char *user;uid_t intended_uid =-1 ; -bool kill_by_uid; +bool kill_by_uid = false;/* Only qemu-upstream can run as a different uid */ if (b_info->device_model_version !=LIBXL_DEVICE_MODEL_VERSION_QEMU_XEN )
@@ -176,7 +176,6 @@ static int libxl__domain_get_device_model_uid(libxl__gc *gc,LOGD (DEBUG , guest_domid,"dm_restrict disabled, starting QEMU as root" ); user =NULL ;/* Should already be null, but just in case */ - kill_by_uid = false;/* Keep older versions of gcc happy */ rc =0 ; goto out; }
@@ -227,7 +226,6 @@ static int libxl__domain_get_device_model_uid(libxl__gc *gc,LOGD (WARN , guest_domid,"Could not find user %s, falling back to %s" ,LIBXL_QEMU_USER_RANGE_BASE ,LIBXL_QEMU_USER_SHARED ); intended_uid = user_base->pw_uid; - kill_by_uid = false; rc =0 ; goto out; }
Signature · 1 line
2.11.0
Re: [PATCH 04/10] tools/libxl: Fix uninitialised variable in libxl__domain_get_device_model_uid()
Andrew Cooper writes ("[PATCH 04/10] tools/libxl: Fix uninitialised variable in libxl__domain_get_device_model_uid()"):
Quoted 4 lines
The logic is sufficiently complicated I can't figure out if the complain is legitimate or not. There is exactly one path wanting
kill_by_uidset to true, so default it to false and drop the existing workaround for this problem at other optimisation levels.
The place where it's used is here:
if (!rc && user) {
state->dm_runas = user;
if (kill_by_uid)
state->dm_kill_uid = GCSPRINTF("%ld",...This is gated by !rc. So for this to be used uninitialised, we'd have to get here with rc==0 but uninitialised kill_by_uid.
The label out is preceded by a nonzero assignment to rc.
All the goto out are preceded by either (i) nonzero assignment to rc, or (ii) assignment to kill_by_uid and setting rc=0.
So the compiler is wrong.
If only we had sum types.
In the absence of sum types I suggest the following restructuring:
Change all the rc = ERROR...; goto out; to goto err and make goto out be the success path only.
Ian.
PATCH v2 4/10 tools/libxl: Fix uninitialised variable in libxl__domain_get_device_model_uid()
In reply to Andrew CooperVarious version of gcc, when compiling with -Og, complain:
libxl_dm.c: In function 'libxl__domain_get_device_model_uid':
libxl_dm.c:256:12: error: 'kill_by_uid' may be used uninitialized in this function [-Werror=maybe-uninitialized]
256 | if (kill_by_uid)
| ^The logic is very tangled. Split the out and err labels apart, using out for success cases only.
assert() that rc is 0 in the success case. This allows for the removal of the if (!rc) nesting in the out path, which reduces the cyclomatic complexity, which is the root cause of false positive maybe-uninitialised warnings.
This also allows for dropping of the two paths setting kill_by_uid to false to work around this warning at other optimisation levels.
---
CC: Ian Jackson <[email protected]>
CC: Wei Liu <[email protected]>
CC: Anthony PERARD <[email protected]>
v2:
* Split the out and err paths.
--- tools/libs/light/libxl_dm.c | 33 +++++++++++++++++---------------- 1 file changed, 17 insertions(+), 16 deletions(-)
tools/libs/light/libxl_dm.c +17 -16
@@ -135,8 +135,8 @@ static int libxl__domain_get_device_model_uid(libxl__gc *gc,return 0 ;/* -* From this point onward, all paths should go through the `out` -* label. The invariants should be: +* From this point onward, all paths should go through the `out` (success) +* or `err` (failure) labels. The invariants should be: * - rc may be 0, or an error code. * - if rc is an error code, user and intended_uid are ignored. * - if rc is 0, user may be set or not set.
@@ -153,13 +153,13 @@ static int libxl__domain_get_device_model_uid(libxl__gc *gc,if (user) { rc =userlookup_helper_getpwnam (gc, user, &user_pwbuf, &user_base);if (rc) - goto out; + goto err;if (!user_base) {LOGD (ERROR , guest_domid,"Couldn't find device_model_user %s" , user); rc =ERROR_INVAL ; - goto out; + goto err; } intended_uid = user_base->pw_uid;
@@ -176,7 +176,6 @@ static int libxl__domain_get_device_model_uid(libxl__gc *gc,LOGD (DEBUG , guest_domid,"dm_restrict disabled, starting QEMU as root" ); user =NULL ;/* Should already be null, but just in case */ - kill_by_uid = false;/* Keep older versions of gcc happy */ rc =0 ; goto out; }
@@ -188,7 +187,7 @@ static int libxl__domain_get_device_model_uid(libxl__gc *gc, rc =userlookup_helper_getpwnam (gc,LIBXL_QEMU_USER_RANGE_BASE , &user_pwbuf, &user_base);if (rc) - goto out; + goto err;if (user_base) {struct passwd *user_clash, user_clash_pwbuf;
@@ -196,14 +195,14 @@ static int libxl__domain_get_device_model_uid(libxl__gc *gc, rc =userlookup_helper_getpwuid (gc, intended_uid, &user_clash_pwbuf, &user_clash);if (rc) - goto out; + goto err;if (user_clash) {LOGD (ERROR , guest_domid,"wanted to use uid %ld (%s + %d) but that is user %s !" , (long )intended_uid,LIBXL_QEMU_USER_RANGE_BASE , guest_domid, user_clash->pw_name); rc =ERROR_INVAL ; - goto out; + goto err; }LOGD (DEBUG , guest_domid,"using uid %ld" , (long )intended_uid);
@@ -222,12 +221,11 @@ static int libxl__domain_get_device_model_uid(libxl__gc *gc, user =LIBXL_QEMU_USER_SHARED ; rc =userlookup_helper_getpwnam (gc, user, &user_pwbuf, &user_base);if (rc) - goto out; + goto err;if (user_base) {LOGD (WARN , guest_domid,"Could not find user %s, falling back to %s" ,LIBXL_QEMU_USER_RANGE_BASE ,LIBXL_QEMU_USER_SHARED ); intended_uid = user_base->pw_uid; - kill_by_uid = false; rc =0 ; goto out; }
@@ -240,23 +238,26 @@ static int libxl__domain_get_device_model_uid(libxl__gc *gc,"Could not find user %s or range base pseudo-user %s, cannot restrict" , LIBXL_QEMU_USER_SHARED, LIBXL_QEMU_USER_RANGE_BASE); rc =ERROR_INVAL ; + goto err; out: +assert (rc ==0 ); +/* First, do a root check if appropriate */ -if (!rc) { -if (user && intended_uid ==0 ) { -LOGD (ERROR , guest_domid,"intended_uid is 0 (root)!" ); - rc =ERROR_INVAL ; - } +if (user && intended_uid ==0 ) { +LOGD (ERROR , guest_domid,"intended_uid is 0 (root)!" ); + rc =ERROR_INVAL ; + goto err; }/* Then do the final set, if still appropriate */ -if (!rc && user) { +if (user) { state->dm_runas = user;if (kill_by_uid) state->dm_kill_uid =GCSPRINTF ("%ld" , (long )intended_uid); } + err:return rc; }
Signature · 1 line
2.11.0
Re: [PATCH v2 04/10] tools/libxl: Fix uninitialised variable in libxl__domain_get_device_model_uid()
Andrew Cooper writes ("[PATCH v2 04/10] tools/libxl: Fix uninitialised variable in libxl__domain_get_device_model_uid()"):
Quoted 5 lines
Various version of gcc, when compiling with -Og, complain:
libxl_dm.c: In function 'libxl__domain_get_device_model_uid':
libxl_dm.c:256:12: error: 'kill_by_uid' may be used uninitialized in this function [-Werror=maybe-uninitialized]256 | if (kill_by_uid)
...
tools/libs/light/libxl_dm.c static int libxl__domain_get_device_model_uid(libxl__gc *gc, · line 180
Quoted 7 lines
tools/libs/light/libxl_dm.c +0
-1@@ -176,7 +176,6 @@ static int libxl__domain_get_device_model_uid(libxl__gc *gc,LOGD (DEBUG , guest_domid,"dm_restrict disabled, starting QEMU as root" ); user =NULL ;/* Should already be null, but just in case */ - kill_by_uid = false;/* Keep older versions of gcc happy */ rc =0 ; goto out;
Uhhhhh. I think this and the other one seem to be stray hunks which each introduce a new uninitialised variable bug ?
Isn.
Ian Jackson
Reviewed-byRe: [PATCH v2 04/10] tools/libxl: Fix uninitialised variable in libxl__domain_get_device_model_uid()
Ian Jackson writes ("Re: [PATCH v2 04/10] tools/libxl: Fix uninitialised variable in libxl__domain_get_device_model_uid()"):
Quoted 2 lines
Uhhhhh. I think this and the other one seem to be stray hunks which each introduce a new uninitialised variable bug ?
I now think (following irc discussion) that I was wrong about this.
Use of intended_uid is conditional on user being set. This is very confusing. This code is simulating a sum type. If only we had sum types.
I think, given how confusing this is, that I would like another careful review before I give my release-ack.
Ian.
PATCH 5/10 tools/libxl: Fix uninitialised variable in libxl__write_stub_dmargs()
In reply to Andrew CooperVarious version of gcc, when compiling with -Og, complain:
libxl_dm.c: In function ‘libxl__write_stub_dmargs’:
libxl_dm.c:2166:16: error: ‘dmargs’ may be used uninitialized in this function [-Werror=maybe-uninitialized]
rc = libxl__xs_write_checked(gc, t, path, dmargs);
~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~It can't, but only because of how the is_linux_stubdom checks line up.
---
CC: Ian Jackson <[email protected]>
CC: Wei Liu <[email protected]>
CC: Anthony PERARD <[email protected]>
--- tools/libs/light/libxl_dm.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
tools/libs/light/libxl_dm.c +1 -1
@@ -2099,7 +2099,7 @@ static int libxl__write_stub_dmargs(libxl__gc *gc, {struct xs_permissions roperm[2 ];xs_transaction_t t =XBT_NULL ; -char *dmargs; +char *dmargs =NULL ;int rc; roperm[0 ].id =0 ;
Signature · 1 line
2.11.0
Re: [PATCH 05/10] tools/libxl: Fix uninitialised variable in libxl__write_stub_dmargs()
Andrew Cooper writes ("[PATCH 05/10] tools/libxl: Fix uninitialised variable in libxl__write_stub_dmargs()"):
Quoted 8 lines
Various version of gcc, when compiling with -Og, complain:
libxl_dm.c: In function ‘libxl__write_stub_dmargs’:
libxl_dm.c:2166:16: error: ‘dmargs’ may be used uninitialized in this function [-Werror=maybe-uninitialized]rc = libxl__xs_write_checked(gc, t, path, dmargs); ~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~It can't, but only because of how the
is_linux_stubdomchecks line up.
Re: [PATCH 05/10] tools/libxl: Fix uninitialised variable in libxl__write_stub_dmargs()
In reply to Andrew CooperAndrew Cooper writes ("[PATCH 05/10] tools/libxl: Fix uninitialised variable in libxl__write_stub_dmargs()"):
Quoted 6 lines
Various version of gcc, when compiling with -Og, complain:
libxl_dm.c: In function ‘libxl__write_stub_dmargs’:
libxl_dm.c:2166:16: error: ‘dmargs’ may be used uninitialized in this function [-Werror=maybe-uninitialized]rc = libxl__xs_write_checked(gc, t, path, dmargs); ~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
PATCH 6/10 stubdom/xenstored: Fix uninitialised variables in lu_read_state()
In reply to Andrew CooperVarious version of gcc, when compiling with -Og, complain:
xenstored_control.c: In function ‘lu_read_state’:
xenstored_control.c:540:11: error: ‘state.size’ is used uninitialized in this function [-Werror=uninitialized]
if (state.size == 0)
~~~~~^~~~~
xenstored_control.c:543:6: error: ‘state.buf’ may be used uninitialized in
this function [-Werror=maybe-uninitialized]
pre = state.buf;
~~~~^~~~~~~~~~~
xenstored_control.c:550:23: error: ‘state.buf’ may be used uninitialized in
this function [-Werror=maybe-uninitialized]
(void *)head - state.buf < state.size;
~~~~~^~~~
xenstored_control.c:550:35: error: ‘state.size’ may be used uninitialized in
this function [-Werror=maybe-uninitialized]
(void *)head - state.buf < state.size;
~~~~~^~~~~Interestingly, this is only in the stubdom build. I can't identify any relevant differences vs the regular tools build.
---
CC: Ian Jackson <[email protected]>
CC: Wei Liu <[email protected]>
CC: Juergen Gross <[email protected]>
--- tools/xenstore/xenstored_control.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
tools/xenstore/xenstored_control.c +1 -1
@@ -530,7 +530,7 @@ static const char *lu_dump_state(const void *ctx, struct connection *conn)void lu_read_state (void ) { -struct lu_dump_state state; +struct lu_dump_state state = {};struct xs_state_record_header *head;void *ctx =talloc_new (NULL );/* Work context for subfunctions. */ struct xs_state_preamble *pre;
Signature · 1 line
2.11.0
Re: [PATCH 06/10] stubdom/xenstored: Fix uninitialised variables in lu_read_state()
Quoted 20 lines · Andrew Cooper
Various version of gcc, when compiling with -Og, complain:
xenstored_control.c: In function ‘lu_read_state’:xenstored_control.c:540:11: error: ‘state.size’ is used uninitialized in this function [-Werror=uninitialized] if (state.size == 0) ~~~~~^~~~~ xenstored_control.c:543:6: error: ‘state.buf’ may be used uninitialized in this function [-Werror=maybe-uninitialized] pre = state.buf; ~~~~^~~~~~~~~~~ xenstored_control.c:550:23: error: ‘state.buf’ may be used uninitialized in this function [-Werror=maybe-uninitialized] (void *)head - state.buf < state.size; ~~~~~^~~~ xenstored_control.c:550:35: error: ‘state.size’ may be used uninitialized in this function [-Werror=maybe-uninitialized] (void *)head - state.buf < state.size; ~~~~~^~~~~
Quoted 2 lines
Interestingly, this is only in the stubdom build. I can't identify any relevant differences vs the regular tools build.
But me. :-)
lu_get_dump_state() is empty for the stubdom case (this will change when LU is implemented for stubdom, too). In the daemon case this function is setting all the fields which are relevant.
Quoted 2 lines
Signed-off-by Andrew Cooper <[email protected]>
Juergen
Re: [PATCH 06/10] stubdom/xenstored: Fix uninitialised variables in lu_read_state()
Quoted 25 lines · Jürgen Groß
Quoted 24 lines · Andrew Cooper
Various version of gcc, when compiling with -Og, complain:
xenstored_control.c: In function ‘lu_read_state’:
xenstored_control.c:540:11: error: ‘state.size’ is used uninitialized in this
function [-Werror=uninitialized]
if (state.size == 0)
~~~~~^~~~~
xenstored_control.c:543:6: error: ‘state.buf’ may be used uninitialized in
this function [-Werror=maybe-uninitialized]
pre = state.buf;
~~~~^~~~~~~~~~~
xenstored_control.c:550:23: error: ‘state.buf’ may be used uninitialized in
this function [-Werror=maybe-uninitialized]
(void *)head - state.buf < state.size; ~~~~~^~~~ xenstored_control.c:550:35: error: ‘state.size’ may be used uninitialized in
this function [-Werror=maybe-uninitialized]
(void *)head - state.buf < state.size; ~~~~~^~~~~
Quoted 8 lines
Quoted 2 lines
Interestingly, this is only in the stubdom build. I can't identify any relevant differences vs the regular tools build.
But me. :-)
lu_get_dump_state()is empty for the stubdom case (this will change when LU is implemented for stubdom, too). In the daemon case this function is setting all the fields which are relevant.
So I spotted that. This instance of lu_read_state() is already within the ifdefary, so doesn't get to see the empty stub (I think).
Also, I'd expect the compiler to complain at -O2 if it spotted that code.
Quoted 5 lines
Quoted 3 lines
Signed-off-by Andrew Cooper <[email protected]>Reviewed-by Juergen Gross <[email protected]>
Thanks,
~Andrew
Re: [PATCH 06/10] stubdom/xenstored: Fix uninitialised variables in lu_read_state()
Quoted 29 lines · Andrew Cooper
Quoted 28 lines · Jürgen Groß
Quoted 26 lines · Andrew Cooper
Various version of gcc, when compiling with -Og, complain:
xenstored_control.c: In function ‘lu_read_state’:
xenstored_control.c:540:11: error: ‘state.size’ is used
uninitialized in this
function [-Werror=uninitialized]
if (state.size == 0)
~~~~~^~~~~
xenstored_control.c:543:6: error: ‘state.buf’ may be used
uninitialized in
this function [-Werror=maybe-uninitialized]
pre = state.buf;
~~~~^~~~~~~~~~~
xenstored_control.c:550:23: error: ‘state.buf’ may be used
uninitialized in
this function [-Werror=maybe-uninitialized]
(void *)head - state.buf < state.size; ~~~~~^~~~ xenstored_control.c:550:35: error: ‘state.size’ may be used
uninitialized in
this function [-Werror=maybe-uninitialized]
(void *)head - state.buf < state.size; ~~~~~^~~~~Interestingly, this is only in the stubdom build. I can't identify any relevant differences vs the regular tools build.
Quoted 8 lines
Quoted 5 lines
But me. :-)
lu_get_dump_state()is empty for the stubdom case (this will change when LU is implemented for stubdom, too). In the daemon case this function is setting all the fields which are relevant.So I spotted that. This instance of
lu_read_state()is already within the ifdefary, so doesn't get to see the empty stub (I think).
There is only one instance of lu_read_state().
Juergen
Re: [PATCH 06/10] stubdom/xenstored: Fix uninitialised variables in lu_read_state()
Quoted 39 lines · Jürgen Groß
Quoted 38 lines · Andrew Cooper
Quoted 36 lines · Jürgen Groß
Quoted 24 lines · Andrew Cooper
Various version of gcc, when compiling with -Og, complain:
xenstored_control.c: In function ‘lu_read_state’:
xenstored_control.c:540:11: error: ‘state.size’ is used uninitialized in this
function [-Werror=uninitialized]
if (state.size == 0)
~~~~~^~~~~
xenstored_control.c:543:6: error: ‘state.buf’ may be used uninitialized in
this function [-Werror=maybe-uninitialized]
pre = state.buf;
~~~~^~~~~~~~~~~
xenstored_control.c:550:23: error: ‘state.buf’ may be used uninitialized in
this function [-Werror=maybe-uninitialized]
(void *)head - state.buf < state.size; ~~~~~^~~~ xenstored_control.c:550:35: error: ‘state.size’ may be used uninitialized in
this function [-Werror=maybe-uninitialized]
(void *)head - state.buf < state.size; ~~~~~^~~~~Quoted 3 lines
Interestingly, this is only in the stubdom build. I can't identify any
relevant differences vs the regular tools build.But me. :-)
lu_get_dump_state()is empty for the stubdom case (this will change when
LU is implemented for stubdom, too). In the daemon case this function is
setting all the fields which are relevant.
Quoted 4 lines
Quoted 2 lines
So I spotted that. This instance of
lu_read_state()is already within the ifdefary, so doesn't get to see the empty stub (I think).There is only one instance of
lu_read_state().
Ahh - I got the NO_LIVE_UPDATE and __MINIOS__ ifdefary inverted. (It is very confusing to follow).
I'll reword the commit message, but leave the fix the same.
~Andrew
PATCH 6/10 stubdom/xenstored: Fix uninitialised variables in lu_read_state()
In reply to Andrew CooperVarious version of gcc, when compiling with -Og, complain:
xenstored_control.c: In function ‘lu_read_state’:
xenstored_control.c:540:11: error: ‘state.size’ is used uninitialized in this function [-Werror=uninitialized]
if (state.size == 0)
~~~~~^~~~~
xenstored_control.c:543:6: error: ‘state.buf’ may be used uninitialized in
this function [-Werror=maybe-uninitialized]
pre = state.buf;
~~~~^~~~~~~~~~~
xenstored_control.c:550:23: error: ‘state.buf’ may be used uninitialized in
this function [-Werror=maybe-uninitialized]
(void *)head - state.buf < state.size;
~~~~~^~~~
xenstored_control.c:550:35: error: ‘state.size’ may be used uninitialized in
this function [-Werror=maybe-uninitialized]
(void *)head - state.buf < state.size;
~~~~~^~~~~for the stubdom build. This is because lu_get_dump_state() is a no-op stub in MiniOS, and state really is operated on uninitialised.
---
CC: Ian Jackson <[email protected]>
CC: Wei Liu <[email protected]>
CC: Juergen Gross <[email protected]>
v2:
* Reword commit message.
--- tools/xenstore/xenstored_control.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
tools/xenstore/xenstored_control.c +1 -1
@@ -530,7 +530,7 @@ static const char *lu_dump_state(const void *ctx, struct connection *conn)void lu_read_state (void ) { -struct lu_dump_state state; +struct lu_dump_state state = {};struct xs_state_record_header *head;void *ctx =talloc_new (NULL );/* Work context for subfunctions. */ struct xs_state_preamble *pre;
Signature · 1 line
2.11.0
Re: [PATCH 06/10] stubdom/xenstored: Fix uninitialised variables in lu_read_state()
In reply to Andrew CooperAndrew Cooper writes ("[PATCH 06/10] stubdom/xenstored: Fix uninitialised variables in lu_read_state()"):
Quoted 20 lines
Various version of gcc, when compiling with -Og, complain:
xenstored_control.c: In function ‘lu_read_state’:
xenstored_control.c:540:11: error: ‘state.size’ is used uninitialized in this function [-Werror=uninitialized]if (state.size == 0) ~~~~~^~~~~ xenstored_control.c:543:6: error: ‘state.buf’ may be used uninitialized in this function [-Werror=maybe-uninitialized] pre = state.buf; ~~~~^~~~~~~~~~~ xenstored_control.c:550:23: error: ‘state.buf’ may be used uninitialized in this function [-Werror=maybe-uninitialized] (void *)head - state.buf < state.size; ~~~~~^~~~ xenstored_control.c:550:35: error: ‘state.size’ may be used uninitialized in this function [-Werror=maybe-uninitialized] (void *)head - state.buf < state.size; ~~~~~^~~~~
Quoted 2 lines
Interestingly, this is only in the stubdom build. I can't identify any relevant differences vs the regular tools build.
#ifdef __MINIOS__
static void lu_get_dump_state(struct lu_dump_state *state)
{
}So the compiler is right to complain that
lu_get_dump_state(&state);
if (state.size == 0)
barf_perror("No state found after live-update");this will use state.size uninitialised.
It's probably just luck that this works at all, if it does, anywhere...
Ian.
PATCH 7/10 tools: Use -Og for debug builds when available
In reply to Andrew CooperThe recommended optimisation level for debugging is -Og, and is what tools such as gdb prefer. In practice, it equates to -01 with a few specific optimisations turned off.
abi-dumper in particular wants the libraries it inspects in this form.
---
CC: Ian Jackson <[email protected]>
CC: Wei Liu <[email protected]>
CC: Juergen Gross <[email protected]>
--- tools/Rules.mk | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-)
tools/Rules.mk +3 -2
@@ -106,8 +106,9 @@ endif CFLAGS_libxenlight += $(CFLAGS_libxenctrl) ifeq ($(debug),y) -# Disable optimizations -CFLAGS += -O0 -fno-omit-frame-pointer +# Use -Og if available, -O0 otherwise +dbg_opt_level := $(call cc-option,$(CC),-Og,-O0) +CFLAGS += $(dbg_opt_level) -fno-omit-frame-pointer # But allow an override to -O0 in case Python enforces -D_FORTIFY_SOURCE=<n>. PY_CFLAGS += $(PY_NOOPT_CFLAGS) else
Signature · 1 line
2.11.0
Re: [PATCH 07/10] tools: Use -Og for debug builds when available
Quoted 7 lines · Andrew Cooper
The recommended optimisation level for debugging is -Og, and is what tools such as gdb prefer. In practice, it equates to -01 with a few specific optimisations turned off.
abi-dumper in particular wants the libraries it inspects in this form.
Signed-off-by Andrew Cooper <[email protected]>
tools/Rules.mk endif · line 111
Quoted 11 lines
tools/Rules.mk +3
-2@@ -106,8 +106,9 @@ endif CFLAGS_libxenlight += $(CFLAGS_libxenctrl) ifeq ($(debug),y) -# Disable optimizations -CFLAGS += -O0 -fno-omit-frame-pointer +# Use -Og if available, -O0 otherwise +dbg_opt_level := $(call cc-option,$(CC),-Og,-O0) +CFLAGS += $(dbg_opt_level) -fno-omit-frame-pointer
I wonder if we shouldn't do something similar for the hypervisor, where we use -O1 for debug builds right now. At least when DEBUG_INFO is also enabled, -Og may be better.
Jan
Re: [PATCH 07/10] tools: Use -Og for debug builds when available
Quoted 9 lines · Jan Beulich
Quoted 7 lines · Andrew Cooper
The recommended optimisation level for debugging is -Og, and is what tools such as gdb prefer. In practice, it equates to -01 with a few specific optimisations turned off.
abi-dumper in particular wants the libraries it inspects in this form.
Signed-off-by Andrew Cooper <[email protected]>Reviewed-by Jan Beulich <[email protected]>
Thanks,
Quoted 6 lines
Quoted 6 lines
tools/Rules.mk +0
-0@@ -106,8 +106,9 @@ endif CFLAGS_libxenlight += $(CFLAGS_libxenctrl)
Quoted 9 lines
tools/Rules.mk endif · line 111
Quoted 6 lines
tools/Rules.mk +3
-2ifeq ($(debug),y) -# Disable optimizations -CFLAGS += -O0 -fno-omit-frame-pointer +# Use -Og if available, -O0 otherwise +dbg_opt_level := $(call cc-option,$(CC),-Og,-O0) +CFLAGS += $(dbg_opt_level) -fno-omit-frame-pointerI wonder if we shouldn't do something similar for the hypervisor, where we use -O1 for debug builds right now. At least when
DEBUG_INFOis also enabled, -Og may be better.
I also made that work... its rather more invasive in terms of changes - all for "maybe uninitialised" warnings.
$ git diff e2bab84984^ --stat xen/Makefile | 3 ++- xen/arch/arm/domain_build.c | 2 +- xen/arch/x86/irq.c | 2 +- xen/arch/x86/mm/shadow/common.c | 2 +- xen/arch/x86/pv/shim.c | 6 +++--- xen/arch/x86/sysctl.c | 4 ++-- xen/common/efi/boot.c | 2 +- 7 files changed, 11 insertions(+), 10 deletions(-)
is what is required to make Gitlab happy. I was planning to defer it to 4.16 at this point.
~Andrew
Re: [PATCH 07/10] tools: Use -Og for debug builds when available
Quoted 30 lines · Andrew Cooper
Quoted 6 lines · Jan Beulich
Quoted 5 lines · Andrew Cooper
tools/Rules.mk +0
-0@@ -106,8 +106,9 @@ endif CFLAGS_libxenlight += $(CFLAGS_libxenctrl)Quoted 9 lines
tools/Rules.mk endif · line 111
Quoted 6 lines
tools/Rules.mk +3
-2ifeq ($(debug),y) -# Disable optimizations -CFLAGS += -O0 -fno-omit-frame-pointer +# Use -Og if available, -O0 otherwise +dbg_opt_level := $(call cc-option,$(CC),-Og,-O0) +CFLAGS += $(dbg_opt_level) -fno-omit-frame-pointerI wonder if we shouldn't do something similar for the hypervisor, where we use -O1 for debug builds right now. At least when
DEBUG_INFOis also enabled, -Og may be better.I also made that work... its rather more invasive in terms of changes - all for "maybe uninitialised" warnings.
$ git diff e2bab84984^ --stat xen/Makefile | 3 ++- xen/arch/arm/domain_build.c | 2 +- xen/arch/x86/irq.c | 2 +- xen/arch/x86/mm/shadow/common.c | 2 +- xen/arch/x86/pv/shim.c | 6 +++--- xen/arch/x86/sysctl.c | 4 ++-- xen/common/efi/boot.c | 2 +- 7 files changed, 11 insertions(+), 10 deletions(-)
Quoted 1 line
is what is required to make Gitlab happy.
Oh, good to know. Thanks!
Quoted 1 line
I was planning to defer it to 4.16 at this point.
Of course.
Jan
Ian Jackson
Acked-byRe: [PATCH 07/10] tools: Use -Og for debug builds when available
In reply to Jan BeulichJan Beulich writes ("Re: [PATCH 07/10] tools: Use -Og for debug builds when available"):
Quoted 10 lines · Andrew Cooper
Quoted 7 lines
The recommended optimisation level for debugging is -Og, and is what tools such as gdb prefer. In practice, it equates to -01 with a few specific optimisations turned off.
abi-dumper in particular wants the libraries it inspects in this form.
Signed-off-by Andrew Cooper <[email protected]>Reviewed-by Jan Beulich <[email protected]>
Re: [PATCH 07/10] tools: Use -Og for debug builds when available
In reply to Andrew CooperAndrew Cooper writes ("[PATCH 07/10] tools: Use -Og for debug builds when available"):
Quoted 5 lines
The recommended optimisation level for debugging is -Og, and is what tools such as gdb prefer. In practice, it equates to -01 with a few specific optimisations turned off.
abi-dumper in particular wants the libraries it inspects in this form.
I would prefer to have this in 4.15 now than to backport it later...
Ian.
PATCH 8/10 tools: Check for abi-dumper in ./configure
In reply to Andrew CooperThis will be optional. No functional change.
---
CC: Ian Jackson <[email protected]>
CC: Wei Liu <[email protected]>
CC: Juergen Gross <[email protected]>
--- config/Tools.mk.in | 1 + tools/configure | 41 +++++++++++++++++++++++++++++++++++++++++ tools/configure.ac | 1 + 3 files changed, 43 insertions(+)
config/Tools.mk.in +1 -0
@@ -19,6 +19,7 @@ BCC := @BCC@ IASL := @IASL@ AWK := @AWK@ FETCHER := @FETCHER@ +ABI_DUMPER := @ABI_DUMPER@ # Extra folder for libs/includes PREPEND_INCLUDES := @PREPEND_INCLUDES@
tools/configure +41 -0
53 lines not on this page · raw message
tools/configure.ac +1 -0
@@ -310,6 +310,7 @@ AC_PROG_CC AC_PROG_MAKE_SET AC_PROG_INSTALL AC_PATH_PROG([FLEX], [flex]) +AC_PATH_PROG([ABI_DUMPER], [abi-dumper]) AX_PATH_PROG_OR_FAIL([PERL], [perl]) AX_PATH_PROG_OR_FAIL([AWK], [awk])
Signature · 1 line
2.11.0
Re: [PATCH 08/10] tools: Check for abi-dumper in ./configure
Andrew Cooper writes ("[PATCH 08/10] tools: Check for abi-dumper in ./configure"):
Quoted 1 line
This will be optional. No functional change.
Re: [PATCH 08/10] tools: Check for abi-dumper in ./configure
In reply to Andrew CooperAndrew Cooper writes ("[PATCH 08/10] tools: Check for abi-dumper in ./configure"):
Quoted 1 line
This will be optional. No functional change.
PATCH 9/10 tools/libs: Add rule to generate headers.lst
In reply to Andrew Cooperabi-dumper needs a list of the public header files for shared objects, and only accepts this in the form of a file.
No functional change.
---
CC: Ian Jackson <[email protected]>
CC: Wei Liu <[email protected]>
CC: Juergen Gross <[email protected]>
--- tools/libs/.gitignore | 1 + tools/libs/libs.mk | 9 ++++++++- 2 files changed, 9 insertions(+), 1 deletion(-) create mode 100644 tools/libs/.gitignore
tools/libs/.gitignore new file +1 -0
@@ -0,0 +1 @@ +*/headers.lst
tools/libs/libs.mk +8 -1
@@ -76,6 +76,10 @@ endif headers.chk: $(AUTOINCS) +headers.lst: FORCE + @{ $(foreach h,$(LIBHEADERS),echo $(h);) } > [email protected] + @$(call move-if-changed,[email protected],$@) + libxen$(LIBNAME).map: echo 'VERS_$(MAJOR).$(MINOR) { global: *; };' >$@
@@ -118,9 +122,12 @@ TAGS: clean: rm -rf *.rpm $(LIB) *~ $(DEPS_RM) $(LIB_OBJS) $(PIC_OBJS) rm -f lib$(LIB_FILE_NAME).so.$(MAJOR).$(MINOR) lib$(LIB_FILE_NAME).so.$(MAJOR) - rm -f headers.chk + rm -f headers.chk headers.lst rm -f $(PKG_CONFIG) rm -f _paths.h .PHONY: distclean distclean: clean + +.PHONY: FORCE +FORCE:
Signature · 1 line
2.11.0
Re: [PATCH 09/10] tools/libs: Add rule to generate headers.lst
Andrew Cooper writes ("[PATCH 09/10] tools/libs: Add rule to generate headers.lst"):
Quoted 2 lines
abi-dumper needs a list of the public header files for shared objects, and only accepts this in the form of a file.
because it's not run by default, but...
tools/libs/libs.mk endif · line 80
Quoted 2 lines
tools/libs/libs.mk +2
-0+headers.lst: FORCE + @{ $(foreach h,$(LIBHEADERS),echo $(h);) } > [email protected]
Missing set -e. If the disk fills up temporarily you might get a partial file here...
tools/libs/libs.mk endif · line 81
Quoted 1 line
tools/libs/libs.mk +1
-0+ @$(call move-if-changed,[email protected],$@)
Ian.
PATCH v2 9/10 tools/libs: Add rule to generate headers.lst
In reply to Andrew Cooperabi-dumper needs a list of the public header files for shared objects, and only accepts this in the form of a file.
No functional change.
---
CC: Ian Jackson <[email protected]>
CC: Wei Liu <[email protected]>
CC: Juergen Gross <[email protected]>
v2:
* Use set -e to avoid truncated content on transient errors
--- tools/libs/.gitignore | 1 + tools/libs/libs.mk | 9 ++++++++- 2 files changed, 9 insertions(+), 1 deletion(-) create mode 100644 tools/libs/.gitignore
tools/libs/.gitignore new file +1 -0
@@ -0,0 +1 @@ +*/headers.lst
tools/libs/libs.mk +8 -1
@@ -76,6 +76,10 @@ endif headers.chk: $(AUTOINCS) +headers.lst: FORCE + @{ set -e; $(foreach h,$(LIBHEADERS),echo $(h);) } > [email protected] + @$(call move-if-changed,[email protected],$@) + libxen$(LIBNAME).map: echo 'VERS_$(MAJOR).$(MINOR) { global: *; };' >$@
@@ -118,9 +122,12 @@ TAGS: clean: rm -rf *.rpm $(LIB) *~ $(DEPS_RM) $(LIB_OBJS) $(PIC_OBJS) rm -f lib$(LIB_FILE_NAME).so.$(MAJOR).$(MINOR) lib$(LIB_FILE_NAME).so.$(MAJOR) - rm -f headers.chk + rm -f headers.chk headers.lst rm -f $(PKG_CONFIG) rm -f _paths.h .PHONY: distclean distclean: clean + +.PHONY: FORCE +FORCE:
Signature · 1 line
2.11.0
Re: [PATCH v2 09/10] tools/libs: Add rule to generate headers.lst
Andrew Cooper writes ("[PATCH v2 09/10] tools/libs: Add rule to generate headers.lst"):
Quoted 7 lines
abi-dumper needs a list of the public header files for shared objects, and only accepts this in the form of a file.
No functional change.
Signed-off-by Andrew Cooper <[email protected]>Release-Acked-by Ian Jackson <[email protected]>
PATCH 10/10 tools/libs: Write out an ABI analysis when abi-dumper is available
In reply to Andrew Cooper---
CC: Ian Jackson <[email protected]>
CC: Wei Liu <[email protected]>
CC: Juergen Gross <[email protected]>
--- tools/libs/libs.mk | 9 +++++++++ 1 file changed, 9 insertions(+)
tools/libs/libs.mk +9 -0
@@ -49,6 +49,8 @@ PKG_CONFIG_LOCAL := $(PKG_CONFIG_DIR)/$(PKG_CONFIG) LIBHEADER ?= $(LIB_FILE_NAME).h LIBHEADERS = $(foreach h, $(LIBHEADER), $(XEN_INCLUDE)/$(h)) +PKG_ABI := lib$(LIB_FILE_NAME).so.$(MAJOR).$(MINOR)-$(XEN_COMPILE_ARCH)-abi.dump + $(PKG_CONFIG_LOCAL): PKG_CONFIG_PREFIX = $(XEN_ROOT) $(PKG_CONFIG_LOCAL): PKG_CONFIG_INCDIR = $(XEN_INCLUDE) $(PKG_CONFIG_LOCAL): PKG_CONFIG_LIBDIR = $(CURDIR)
@@ -94,6 +96,13 @@ lib$(LIB_FILE_NAME).so.$(MAJOR): lib$(LIB_FILE_NAME).so.$(MAJOR).$(MINOR) lib$(LIB_FILE_NAME).so.$(MAJOR).$(MINOR): $(PIC_OBJS) libxen$(LIBNAME).map $(CC) $(LDFLAGS) $(PTHREAD_LDFLAGS) -Wl,$(SONAME_LDFLAG) -Wl,lib$(LIB_FILE_NAME).so.$(MAJOR) $(SHLIB_LDFLAGS) -o $@ $(PIC_OBJS) $(LDUSELIBS) $(APPEND_LDFLAGS) +# If abi-dumper is available, write out the ABI analysis +ifneq ($(ABI_DUMPER),) +libs: $(PKG_ABI) +$(PKG_ABI): lib$(LIB_FILE_NAME).so.$(MAJOR).$(MINOR) headers.lst + abi-dumper $< -o $@ -public-headers headers.lst -lver $(MAJOR).$(MINOR) +endif + .PHONY: install install: build $(INSTALL_DIR) $(DESTDIR)$(libdir)
Signature · 1 line
2.11.0
Re: [PATCH 10/10] tools/libs: Write out an ABI analysis when abi-dumper is available
tools/libs/libs.mk PKG_CONFIG_LOCAL := $(PKG_CONFIG_DIR)/$(PKG_CONFIG) · line 52
Quoted 7 lines · Andrew Cooper
tools/libs/libs.mk +1
-0@@ -49,6 +49,8 @@ PKG_CONFIG_LOCAL := $(PKG_CONFIG_DIR)/$(PKG_CONFIG) LIBHEADER ?= $(LIB_FILE_NAME).h LIBHEADERS = $(foreach h, $(LIBHEADER), $(XEN_INCLUDE)/$(h)) +PKG_ABI := lib$(LIB_FILE_NAME).so.$(MAJOR).$(MINOR)-$(XEN_COMPILE_ARCH)-abi.dump
Don't you mean $(XEN_TARGET_ARCH) here?
Jan
Re: [PATCH 10/10] tools/libs: Write out an ABI analysis when abi-dumper is available
Quoted 9 lines · Jan Beulich
tools/libs/libs.mk PKG_CONFIG_LOCAL := $(PKG_CONFIG_DIR)/$(PKG_CONFIG) · line 52
Quoted 7 lines · Andrew Cooper
tools/libs/libs.mk +1
-0@@ -49,6 +49,8 @@ PKG_CONFIG_LOCAL := $(PKG_CONFIG_DIR)/$(PKG_CONFIG) LIBHEADER ?= $(LIB_FILE_NAME).h LIBHEADERS = $(foreach h, $(LIBHEADER), $(XEN_INCLUDE)/$(h)) +PKG_ABI := lib$(LIB_FILE_NAME).so.$(MAJOR).$(MINOR)-$(XEN_COMPILE_ARCH)-abi.dumpDon't you mean $(XEN_TARGET_ARCH) here?
Yes, I do. Will fix up.
Thanks,
~Andrew
PATCH 10/10 tools/libs: Write out an ABI analysis when abi-dumper is available
In reply to Andrew Cooper---
CC: Ian Jackson <[email protected]>
CC: Wei Liu <[email protected]>
CC: Juergen Gross <[email protected]>
v2:
* Swap XEN_COMPILE_ARCH for XEN_TARGET_ARCH
* Swap abi-dumper for $(ABI_DUMPER)
--- tools/libs/libs.mk | 9 +++++++++ 1 file changed, 9 insertions(+)
tools/libs/libs.mk +9 -0
@@ -49,6 +49,8 @@ PKG_CONFIG_LOCAL := $(PKG_CONFIG_DIR)/$(PKG_CONFIG) LIBHEADER ?= $(LIB_FILE_NAME).h LIBHEADERS = $(foreach h, $(LIBHEADER), $(XEN_INCLUDE)/$(h)) +PKG_ABI := lib$(LIB_FILE_NAME).so.$(MAJOR).$(MINOR)-$(XEN_TARGET_ARCH)-abi.dump + $(PKG_CONFIG_LOCAL): PKG_CONFIG_PREFIX = $(XEN_ROOT) $(PKG_CONFIG_LOCAL): PKG_CONFIG_INCDIR = $(XEN_INCLUDE) $(PKG_CONFIG_LOCAL): PKG_CONFIG_LIBDIR = $(CURDIR)
@@ -94,6 +96,13 @@ lib$(LIB_FILE_NAME).so.$(MAJOR): lib$(LIB_FILE_NAME).so.$(MAJOR).$(MINOR) lib$(LIB_FILE_NAME).so.$(MAJOR).$(MINOR): $(PIC_OBJS) libxen$(LIBNAME).map $(CC) $(LDFLAGS) $(PTHREAD_LDFLAGS) -Wl,$(SONAME_LDFLAG) -Wl,lib$(LIB_FILE_NAME).so.$(MAJOR) $(SHLIB_LDFLAGS) -o $@ $(PIC_OBJS) $(LDUSELIBS) $(APPEND_LDFLAGS) +# If abi-dumper is available, write out the ABI analysis +ifneq ($(ABI_DUMPER),) +libs: $(PKG_ABI) +$(PKG_ABI): lib$(LIB_FILE_NAME).so.$(MAJOR).$(MINOR) headers.lst + $(ABI_DUMPER) $< -o $@ -public-headers headers.lst -lver $(MAJOR).$(MINOR) +endif + .PHONY: install install: build $(INSTALL_DIR) $(DESTDIR)$(libdir)
Signature · 1 line
2.11.0
Re: [PATCH 10/10] tools/libs: Write out an ABI analysis when abi-dumper is available
In reply to Andrew CooperAndrew Cooper writes ("[PATCH 10/10] tools/libs: Write out an ABI analysis when abi-dumper is available"):
Quoted 1 line
Signed-off-by Andrew Cooper <[email protected]>
Re: [PATCH 10/10] tools/libs: Write out an ABI analysis when abi-dumper is available
In reply to Andrew CooperAndrew Cooper writes ("[PATCH 10/10] tools/libs: Write out an ABI analysis when abi-dumper is available"):
Quoted 1 line
Signed-off-by Andrew Cooper <[email protected]>
...
tools/libs/libs.mk lib$(LIB_FILE_NAME).so.$(MAJOR): lib$(LIB_FILE_NAME).so.$(MAJOR).$(MINOR) · line 104
Quoted 6 lines
tools/libs/libs.mk +6
-0+# If abi-dumper is available, write out the ABI analysis +ifneq ($(ABI_DUMPER),) +libs: $(PKG_ABI) +$(PKG_ABI): lib$(LIB_FILE_NAME).so.$(MAJOR).$(MINOR) headers.lst + abi-dumper $< -o $@ -public-headers headers.lst -lver $(MAJOR).$(MINOR) +endif
Kind of annoying that we don't have a variable for
lib$(LIB_FILE_NAME).so.$(MAJOR).$(MINOR)