Message ID | 20240905111153.786500-1-alex.bennee@linaro.org |
---|---|
State | New |
Headers | show |
Series | [RFC] deprecation: don't enable TCG plugins by default on 32 bit hosts | expand |
On Thu, 5 Sept 2024 at 12:13, Alex Bennée <alex.bennee@linaro.org> wrote: > > The existing plugins already liberally use host pointer stuffing for > passing user data which will fail when doing 64 bit guests on 32 bit > hosts. We should discourage this by officially deprecating support and > adding another nail to the 32 bit host coffin. > > Signed-off-by: Alex Bennée <alex.bennee@linaro.org> > --- > docs/about/deprecated.rst | 11 +++++++++++ > configure | 11 ++++++++++- > 2 files changed, 21 insertions(+), 1 deletion(-) > > diff --git a/docs/about/deprecated.rst b/docs/about/deprecated.rst > index 88f0f03786..8a4e249717 100644 > --- a/docs/about/deprecated.rst > +++ b/docs/about/deprecated.rst > @@ -184,6 +184,17 @@ be an effective use of its limited resources, and thus intends to discontinue > it. Since all recent x86 hardware from the past >10 years is capable of the > 64-bit x86 extensions, a corresponding 64-bit OS should be used instead. > > +TCG Plugin support not enabled by default on 32-bit hosts (since 9.2) > +''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''' > + > +While it is still possible to enable TCG plugin support for 32-bit > +hosts there are a number of potential pitfalls when instrumenting > +64-bit guests. The plugin APIs typically pass most addresses as > +uint64_t but practices like encoding that address in a host pointer > +for passing as user-data will loose data. As most software analysis "lose" > +benefits from having plenty of host memory it seems reasonable to > +encourage users to use 64 bit builds of QEMU for analysis work > +whatever targets they are instrumenting. > diff --git a/configure b/configure > index d08b71f14b..8acb311527 100755 > --- a/configure > +++ b/configure > @@ -424,6 +424,7 @@ fi > # Note that this case should only have supported host CPUs, not guests. > # Please keep it sorted and synchronized with meson.build's host_arch. > host_arch= > +host_bits=64 > linux_arch= > case "$cpu" in > aarch64) > @@ -434,12 +435,14 @@ case "$cpu" in > armv*b|armv*l|arm) > cpu=arm > host_arch=arm > + host_bits=32 > linux_arch=arm > ;; > > i386|i486|i586|i686) > cpu="i386" > host_arch=i386 > + host_bits=32 > linux_arch=x86 > CPU_CFLAGS="-m32" > ;; This is pretty awkward. We should only put stuff into this "switch per CPU architecture" where we absolutely cannot automatically determine it. Host bitness can be automatically determined (see what the compiler has set __SIZEOF_POINTER__ to), so we should do that. thanks -- PMM
On 5/9/24 13:11, Alex Bennée wrote: > The existing plugins already liberally use host pointer stuffing for > passing user data which will fail when doing 64 bit guests on 32 bit > hosts. We should discourage this by officially deprecating support and > adding another nail to the 32 bit host coffin. > > Signed-off-by: Alex Bennée <alex.bennee@linaro.org> > --- > docs/about/deprecated.rst | 11 +++++++++++ > configure | 11 ++++++++++- > 2 files changed, 21 insertions(+), 1 deletion(-) > @@ -480,11 +485,13 @@ case "$cpu" in > > riscv32 | riscv64) We need to split the riscv64 case. > host_arch=riscv > + host_bits=32 > linux_arch=riscv > ;;
diff --git a/docs/about/deprecated.rst b/docs/about/deprecated.rst index 88f0f03786..8a4e249717 100644 --- a/docs/about/deprecated.rst +++ b/docs/about/deprecated.rst @@ -184,6 +184,17 @@ be an effective use of its limited resources, and thus intends to discontinue it. Since all recent x86 hardware from the past >10 years is capable of the 64-bit x86 extensions, a corresponding 64-bit OS should be used instead. +TCG Plugin support not enabled by default on 32-bit hosts (since 9.2) +''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''' + +While it is still possible to enable TCG plugin support for 32-bit +hosts there are a number of potential pitfalls when instrumenting +64-bit guests. The plugin APIs typically pass most addresses as +uint64_t but practices like encoding that address in a host pointer +for passing as user-data will loose data. As most software analysis +benefits from having plenty of host memory it seems reasonable to +encourage users to use 64 bit builds of QEMU for analysis work +whatever targets they are instrumenting. System emulator CPUs -------------------- diff --git a/configure b/configure index d08b71f14b..8acb311527 100755 --- a/configure +++ b/configure @@ -424,6 +424,7 @@ fi # Note that this case should only have supported host CPUs, not guests. # Please keep it sorted and synchronized with meson.build's host_arch. host_arch= +host_bits=64 linux_arch= case "$cpu" in aarch64) @@ -434,12 +435,14 @@ case "$cpu" in armv*b|armv*l|arm) cpu=arm host_arch=arm + host_bits=32 linux_arch=arm ;; i386|i486|i586|i686) cpu="i386" host_arch=i386 + host_bits=32 linux_arch=x86 CPU_CFLAGS="-m32" ;; @@ -458,11 +461,13 @@ case "$cpu" in mips*) cpu=mips host_arch=mips + host_bits=32 linux_arch=mips ;; ppc) host_arch=ppc + host_bits=32 linux_arch=powerpc CPU_CFLAGS="-m32" ;; @@ -480,11 +485,13 @@ case "$cpu" in riscv32 | riscv64) host_arch=riscv + host_bits=32 linux_arch=riscv ;; s390) linux_arch=s390 + host_bits=32 CPU_CFLAGS="-m31" ;; s390x) @@ -495,6 +502,7 @@ case "$cpu" in sparc|sun4[cdmuv]) cpu=sparc + host_bits=32 CPU_CFLAGS="-m32 -mv8plus -mcpu=ultrasparc" ;; sparc64) @@ -505,6 +513,7 @@ case "$cpu" in x32) cpu="x86_64" host_arch=x86_64 + host_bits=32 linux_arch=x86 CPU_CFLAGS="-mx32" ;; @@ -1028,7 +1037,7 @@ if test "$static" = "yes" ; then fi plugins="no" fi -if test "$plugins" != "no"; then +if test "$plugins" != "no" && test host_bits = 64; then plugins=yes subdirs="$subdirs contrib/plugins" fi
The existing plugins already liberally use host pointer stuffing for passing user data which will fail when doing 64 bit guests on 32 bit hosts. We should discourage this by officially deprecating support and adding another nail to the 32 bit host coffin. Signed-off-by: Alex Bennée <alex.bennee@linaro.org> --- docs/about/deprecated.rst | 11 +++++++++++ configure | 11 ++++++++++- 2 files changed, 21 insertions(+), 1 deletion(-)