Skip to contentSkip to conversation

xen/Kconfig: livepatch-build-tools requires debug information

PATCH Superseded Roger Pau Monne 3 participants 10 messages Nov 7, 2024

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 xen/Kconfig: livepatch-build-tools requires debug information

The tools infrastructure used to build livepatches for Xen (livepatch-build-tools) consumes some DWARF debug information present in xen-syms to generate a livepatch (see livepatch-build script usage of readelf -wi).

The current Kconfig defaults however will enable LIVEPATCH without DEBUG_INFO on release builds, thus providing a default Kconfig selection that's not suitable for livepatch-build-tools even when LIVEPATCH support is enabled, because it's missing the DWARF debug section.

Fix by forcing the selection of DEBUG_INFO from LIVEPATCH.

---
 xen/common/Kconfig | 1 +
 1 file changed, 1 insertion(+)
xen/common/Kconfig +1 -0
index 90268d92499a..f3135f85034d 100644
@@ -420,6 +420,7 @@ config LIVEPATCH
 	default X86
 	depends on "$(XEN_HAS_BUILD_ID)" = "y"
 	select CC_SPLIT_SECTIONS
+	select DEBUG_INFO
 	help
 	  Allows a running Xen hypervisor to be dynamically patched using
 	  binary patches without rebooting. This is primarily used to binarily
Signature · 1 line
2.46.0
Reviewed-by on v1 1/1
#1 lore raw
Quoted 5 lines · Roger Pau Monne

The tools infrastructure used to build livepatches for Xen (livepatch-build-tools) consumes some DWARF debug information present in xen-syms to generate a livepatch (see livepatch-build script usage of readelf -wi).

Quoted 8 lines

The current Kconfig defaults however will enable LIVEPATCH without DEBUG_INFO on release builds, thus providing a default Kconfig selection that's not suitable for livepatch-build-tools even when LIVEPATCH support is enabled, because it's missing the DWARF debug section.

Fix by forcing the selection of DEBUG_INFO from LIVEPATCH.

Oops, yes.

Fixes tag ?

#2 lore raw
Quoted 13 lines · Andrew Cooper
Quoted 12 lines · Roger Pau Monne

The tools infrastructure used to build livepatches for Xen (livepatch-build-tools) consumes some DWARF debug information present in xen-syms to generate a livepatch (see livepatch-build script usage of readelf -wi).

The current Kconfig defaults however will enable LIVEPATCH without DEBUG_INFO on release builds, thus providing a default Kconfig selection that's not suitable for livepatch-build-tools even when LIVEPATCH support is enabled, because it's missing the DWARF debug section.

Fix by forcing the selection of DEBUG_INFO from LIVEPATCH.

Quoted 7 lines
Quoted 1 line

Oops, yes.

Fixes tag ?

Was borderline on adding one, but wasn't sure since it's strictly livepatch-build-tools that requires the DWARF data, but custom made livepatches (like the examples in tests) do not require such information.

Possibly:

Fixes 11ff40fa7bb5 ('xen/xsplice: Hypervisor implementation of XEN_XSPLICE_op')

Which is the commit that originally introduced the CONFIG_XSPLICE option.

Thanks, Roger.

#3 lore raw
Quoted 18 lines · Roger Pau Monné
Quoted 17 lines · Andrew Cooper
Quoted 5 lines · Roger Pau Monne

The tools infrastructure used to build livepatches for Xen (livepatch-build-tools) consumes some DWARF debug information present in xen-syms to generate a livepatch (see livepatch-build script usage of readelf -wi).

Quoted 8 lines

The current Kconfig defaults however will enable LIVEPATCH without DEBUG_INFO on release builds, thus providing a default Kconfig selection that's not suitable for livepatch-build-tools even when LIVEPATCH support is enabled, because it's missing the DWARF debug section.

Fix by forcing the selection of DEBUG_INFO from LIVEPATCH.

Oops, yes.

Quoted 8 lines
Quoted 3 lines

Fixes tag ?

Was borderline on adding one, but wasn't sure since it's strictly livepatch-build-tools that requires the DWARF data, but custom made livepatches (like the examples in tests) do not require such information.

At which point: Is "select" really appropriate then? Wouldn't it be more logical then to change DEBUG_INFO's default to take LIVEPATCH into account (still permitting people to turn debug info off if they know they won't need it)?

Jan

#4 lore raw
Quoted 28 lines · Jan Beulich
Quoted 18 lines · Roger Pau Monné
Quoted 17 lines · Andrew Cooper
Quoted 5 lines · Roger Pau Monne

The tools infrastructure used to build livepatches for Xen (livepatch-build-tools) consumes some DWARF debug information present in xen-syms to generate a livepatch (see livepatch-build script usage of readelf -wi).

Quoted 8 lines

The current Kconfig defaults however will enable LIVEPATCH without DEBUG_INFO on release builds, thus providing a default Kconfig selection that's not suitable for livepatch-build-tools even when LIVEPATCH support is enabled, because it's missing the DWARF debug section.

Fix by forcing the selection of DEBUG_INFO from LIVEPATCH.

Oops, yes.

Quoted 8 lines
Quoted 3 lines

Fixes tag ?

Was borderline on adding one, but wasn't sure since it's strictly livepatch-build-tools that requires the DWARF data, but custom made livepatches (like the examples in tests) do not require such information.

Quoted 4 lines

At which point: Is "select" really appropriate then? Wouldn't it be more logical then to change DEBUG_INFO's default to take LIVEPATCH into account (still permitting people to turn debug info off if they know they won't need it)?

At least right now the only way to build useful livepatches for Xen (not dummy tests) is using livepatch-build-tools (that requires DWARF sections). My concern with using the Fixes tag was that I don't know whether initially the DWARF info was needed or not, or maybe whether people used a different tool rather than livepatch-build-tools.

I don't mind changing, but I also don't think an hypervisor built with LIVEPATCH but without DEBUG_INFO is going to be useful to anyone given the requirements of the tools we provide to build livepatches.

Thanks, Roger.

#5 lore raw
Quoted 40 lines · Roger Pau Monné
Quoted 28 lines · Jan Beulich
Quoted 18 lines · Roger Pau Monné
Quoted 17 lines · Andrew Cooper
Quoted 5 lines · Roger Pau Monne

The tools infrastructure used to build livepatches for Xen (livepatch-build-tools) consumes some DWARF debug information present in xen-syms to generate a livepatch (see livepatch-build script usage of readelf -wi).

Quoted 8 lines

The current Kconfig defaults however will enable LIVEPATCH without DEBUG_INFO on release builds, thus providing a default Kconfig selection that's not suitable for livepatch-build-tools even when LIVEPATCH support is enabled, because it's missing the DWARF debug section.

Fix by forcing the selection of DEBUG_INFO from LIVEPATCH.

Oops, yes.

Quoted 8 lines
Quoted 3 lines

Fixes tag ?

Was borderline on adding one, but wasn't sure since it's strictly livepatch-build-tools that requires the DWARF data, but custom made livepatches (like the examples in tests) do not require such information.

Quoted 4 lines

At which point: Is "select" really appropriate then? Wouldn't it be more logical then to change DEBUG_INFO's default to take LIVEPATCH into account (still permitting people to turn debug info off if they know they won't need it)?

At least right now the only way to build useful livepatches for Xen (not dummy tests) is using livepatch-build-tools (that requires DWARF sections). My concern with using the Fixes tag was that I don't know whether initially the DWARF info was needed or not, or maybe whether people used a different tool rather than livepatch-build-tools.

Quoted 3 lines

I don't mind changing, but I also don't think an hypervisor built with LIVEPATCH but without DEBUG_INFO is going to be useful to anyone given the requirements of the tools we provide to build livepatches.

Well, okay, especially Andrew looks to be pretty strong about this. I don't want to stand in the way ...

Jan

#6 lore raw
In reply to Jan Beulich
Quoted 18 lines · Jan Beulich
Quoted 17 lines · Roger Pau Monné
Quoted 16 lines · Andrew Cooper
Quoted 5 lines · Roger Pau Monne

The tools infrastructure used to build livepatches for Xen (livepatch-build-tools) consumes some DWARF debug information present in xen-syms to generate a livepatch (see livepatch-build script usage of readelf -wi).

Quoted 8 lines

The current Kconfig defaults however will enable LIVEPATCH without DEBUG_INFO on release builds, thus providing a default Kconfig selection that's not suitable for livepatch-build-tools even when LIVEPATCH support is enabled, because it's missing the DWARF debug section.

Fix by forcing the selection of DEBUG_INFO from LIVEPATCH.

Oops, yes.

Quoted 7 lines
Quoted 7 lines
Quoted 3 lines

Fixes tag ?

Was borderline on adding one, but wasn't sure since it's strictly livepatch-build-tools that requires the DWARF data, but custom made livepatches (like the examples in tests) do not require such information.

Ok.  I guess it doesn't matter too much.

Quoted 4 lines

At which point: Is "select" really appropriate then? Wouldn't it be more logical then to change DEBUG_INFO's default to take LIVEPATCH into account (still permitting people to turn debug info off if they know they won't need it)?

I am very disinterested in letting people who think they can do livepatching without debug symbols shoot themselves in the foot like that.

It's only debugging symbols.   If people *really* think they know better, they can strip them themselves.

~Andrew

#7 lore raw
Quoted 34 lines · Andrew Cooper
Quoted 18 lines · Jan Beulich
Quoted 17 lines · Roger Pau Monné
Quoted 16 lines · Andrew Cooper
Quoted 5 lines · Roger Pau Monne

The tools infrastructure used to build livepatches for Xen (livepatch-build-tools) consumes some DWARF debug information present in xen-syms to generate a livepatch (see livepatch-build script usage of readelf -wi).

Quoted 8 lines

The current Kconfig defaults however will enable LIVEPATCH without DEBUG_INFO on release builds, thus providing a default Kconfig selection that's not suitable for livepatch-build-tools even when LIVEPATCH support is enabled, because it's missing the DWARF debug section.

Fix by forcing the selection of DEBUG_INFO from LIVEPATCH.

Oops, yes.

Quoted 7 lines
Quoted 7 lines
Quoted 3 lines

Fixes tag ?

Was borderline on adding one, but wasn't sure since it's strictly livepatch-build-tools that requires the DWARF data, but custom made livepatches (like the examples in tests) do not require such information.

Ok.  I guess it doesn't matter too much.

Quoted 4 lines

At which point: Is "select" really appropriate then? Wouldn't it be more logical then to change DEBUG_INFO's default to take LIVEPATCH into account (still permitting people to turn debug info off if they know they won't need it)?

Quoted 5 lines

I am very disinterested in letting people who think they can do livepatching without debug symbols shoot themselves in the foot like that.

It's only debugging symbols.   If people *really* think they know better, they can strip them themselves.

Besides my abstract concern, let me also add a concrete practical one. I'm sure you've noticed that xen.efi is _much_ slower to link with debug info than without, or than xen-syms. That's a consequence of how GNU ld (really:
libbfd) works internally. By not allowing DEBUG_INFO to stay off you're forcing me to either wait longer for every single one of my post-commit pre-push build tests, or to turn off LIVEPATCH there. The latter not really being a good idea.

Nevertheless, as said in reply to Roger: Go ahead if you absolutely think that's the only sensible way.

Jan

#8 lore raw
Quoted 46 lines · Jan Beulich
Quoted 32 lines · Andrew Cooper
Quoted 18 lines · Jan Beulich
Quoted 17 lines · Roger Pau Monné
Quoted 16 lines · Andrew Cooper
Quoted 5 lines · Roger Pau Monne

The tools infrastructure used to build livepatches for Xen (livepatch-build-tools) consumes some DWARF debug information present in xen-syms to generate a livepatch (see livepatch-build script usage of readelf -wi).

Quoted 8 lines

The current Kconfig defaults however will enable LIVEPATCH without DEBUG_INFO on release builds, thus providing a default Kconfig selection that's not suitable for livepatch-build-tools even when LIVEPATCH support is enabled, because it's missing the DWARF debug section.

Fix by forcing the selection of DEBUG_INFO from LIVEPATCH.

Oops, yes.

Quoted 7 lines
Quoted 7 lines
Quoted 3 lines

Fixes tag ?

Was borderline on adding one, but wasn't sure since it's strictly livepatch-build-tools that requires the DWARF data, but custom made livepatches (like the examples in tests) do not require such information.

Ok.  I guess it doesn't matter too much.

Quoted 4 lines

At which point: Is "select" really appropriate then? Wouldn't it be more logical then to change DEBUG_INFO's default to take LIVEPATCH into account (still permitting people to turn debug info off if they know they won't need it)?

Quoted 5 lines

I am very disinterested in letting people who think they can do livepatching without debug symbols shoot themselves in the foot like that.

It's only debugging symbols.   If people *really* think they know better, they can strip them themselves.

Besides my abstract concern, let me also add a concrete practical one. I'm sure you've noticed that xen.efi is _much_ slower to link with debug info than without, or than xen-syms. That's a consequence of how GNU ld (really:
libbfd) works internally. By not allowing DEBUG_INFO to stay off you're forcing me to either wait longer for every single one of my post-commit pre-push build tests, or to turn off LIVEPATCH there. The latter not really being a good idea.

Quoted 2 lines

Nevertheless, as said in reply to Roger: Go ahead if you absolutely think that's the only sensible way.

I had noticed that link was taking a long time.  I hadn't realised it was this specifically.

But to put this another way, you're arguing to intentionally avoid fixing a sharp corner, because there's a perf issue in Binutils.

I will note that it was you who forced the generation of xen.efi on everyone, even those who didn't want it, without any knob to turn it off.

~Andrew

#9 lore raw
Quoted 47 lines · Andrew Cooper
Quoted 46 lines · Jan Beulich
Quoted 32 lines · Andrew Cooper
Quoted 18 lines · Jan Beulich
Quoted 17 lines · Roger Pau Monné
Quoted 16 lines · Andrew Cooper
Quoted 5 lines · Roger Pau Monne

The tools infrastructure used to build livepatches for Xen (livepatch-build-tools) consumes some DWARF debug information present in xen-syms to generate a livepatch (see livepatch-build script usage of readelf -wi).

Quoted 8 lines

The current Kconfig defaults however will enable LIVEPATCH without DEBUG_INFO on release builds, thus providing a default Kconfig selection that's not suitable for livepatch-build-tools even when LIVEPATCH support is enabled, because it's missing the DWARF debug section.

Fix by forcing the selection of DEBUG_INFO from LIVEPATCH.

Oops, yes.

Quoted 7 lines
Quoted 7 lines
Quoted 3 lines

Fixes tag ?

Was borderline on adding one, but wasn't sure since it's strictly livepatch-build-tools that requires the DWARF data, but custom made livepatches (like the examples in tests) do not require such information.

Ok.  I guess it doesn't matter too much.

Quoted 4 lines

At which point: Is "select" really appropriate then? Wouldn't it be more logical then to change DEBUG_INFO's default to take LIVEPATCH into account (still permitting people to turn debug info off if they know they won't need it)?

Quoted 5 lines

I am very disinterested in letting people who think they can do livepatching without debug symbols shoot themselves in the foot like that.

It's only debugging symbols.   If people *really* think they know better, they can strip them themselves.

Besides my abstract concern, let me also add a concrete practical one. I'm sure you've noticed that xen.efi is _much_ slower to link with debug info than without, or than xen-syms. That's a consequence of how GNU ld (really:
libbfd) works internally. By not allowing DEBUG_INFO to stay off you're forcing me to either wait longer for every single one of my post-commit pre-push build tests, or to turn off LIVEPATCH there. The latter not really being a good idea.

Quoted 8 lines
Quoted 2 lines

Nevertheless, as said in reply to Roger: Go ahead if you absolutely think that's the only sensible way.

I had noticed that link was taking a long time.  I hadn't realised it was this specifically.

But to put this another way, you're arguing to intentionally avoid fixing a sharp corner, because there's a perf issue in Binutils.

I understand there is a sharp corner, yet recall I had suggested an alternative. People changing defaults are responsible for what they're doing, after all.

Quoted 2 lines

I will note that it was you who forced the generation of xen.efi on everyone, even those who didn't want it, without any knob to turn it off.

True, but if there's desire to turn it off, a knob can always be added. EFI support pre-dates the introduction of Kconfig by several years, iirc.

Jan