Skip to contentSkip to conversation

qemu: Use capstone version included via git submodule

PATCH In review Jon Szymaniak 3 participants 6 messages Jun 25, 2018 – Jul 2, 2018 2 messages not in the archive

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 qemu: Use capstone version included via git submodule

An optional dependency upon the capstone disassembler was introduced in QEMU v2.11.0-rc0. The necessary version of capstone is included in the QEMU repository as a git submodule.

The QEMU configure script uses pkg-config to determine if an installation of capstone already exists on the system, and defaults to this, if found. However, there does not appear to be any capstone version or API compatibility checks.

To avoid any potential version conflicts or API incompatibility issues in the future, use the --enable-capstone=git argument to force the use of the capstone version included by QEMU as a git submodule.

---
 meta/recipes-devtools/qemu/qemu.inc | 1 +
 1 file changed, 1 insertion(+)
meta/recipes-devtools/qemu/qemu.inc +1 -0
index 094a975177..37f8398967 100644
@@ -23,6 +23,7 @@ EXTRA_OECONF = " \
     --libexecdir=${libexecdir} \
     --localstatedir=${localstatedir} \
     --with-confsuffix=/${BPN} \
+    --enable-capstone=git \
     --disable-strip \
     --disable-werror \
     --target-list=${@get_qemu_target_list(d)} \
Signature · 1 line
2.14.1
#1 lore raw

On Mon, Jun 25, 2018 at 1:50 PM, Jon Szymaniak <[email protected]

Quoted 6 lines

wrote:

An optional dependency upon the capstone disassembler was introduced in QEMU v2.11.0-rc0. The necessary version of capstone is included in the QEMU repository as a git submodule.

Quoted 9 lines

The QEMU configure script uses pkg-config to determine if an installation of capstone already exists on the system, and defaults to this, if found. However, there does not appear to be any capstone version or API compatibility checks.

To avoid any potential version conflicts or API incompatibility issues in the future, use the --enable-capstone=git argument to force the use of the capstone version included by QEMU as a git submodule.

How exactly does that work when the default qemu recipe is a tar.bz2 download ?

We can't have the recipe going out to the 'net and fetching / downloading source code .. and looking at the option, that appears to be what it would do. Or maybe I'm missing where the code is being fetched into place.

This is something that looks like it could be controlled via packageconfig, or similar mechanism, versus being hard coded into the configure line.

Also, the patch is missing your Signed-off-by:

Cheers,

Bruce

Quoted 26 lines
---
 meta/recipes-devtools/qemu/qemu.inc | 1 +
 1 file changed, 1 insertion(+)
meta/recipes-devtools/qemu/qemu.inc +1 -1
index 094a975177..37f8398967 100644
@@ -23,6 +23,7 @@ EXTRA_OECONF = " \
     --libexecdir=${libexecdir} \
     --localstatedir=${localstatedir} \
     --with-confsuffix=/${BPN} \
+    --enable-capstone=git \
     --disable-strip \
     --disable-werror \
     --target-list=${@get_qemu_target_list(d)} \
--

2.14.1

--
_______________________________________________
Openembedded-core mailing list
[email protected]
http://lists.openembedded.org/mailman/listinfo/openembedded-core

Signature · 2 lines
"Thou shalt not follow the NULL pointer, for chaos and madness await thee
at its end"

A message that is not in the archive (sent off-list or not yet received): CANge7vXk5XKAwmZEtfww0F0tUvOUyiE=sR3OsJoRZX3P-3kf=A@mail.gmail.com

#3 lore raw

PATCH 1/1 qemu: Use capstone version included via git submodule

I'm sorry for the duplicate email Bruce. Resending because I failed to include the list.

Quoted 14 lines · Bruce Ashfield
Quoted 10 lines · Jon Szymaniak

An optional dependency upon the capstone disassembler was introduced in QEMU v2.11.0-rc0. The necessary version of capstone is included in the QEMU repository as a git submodule.

The QEMU configure script uses pkg-config to determine if an installation of capstone already exists on the system, and defaults to this, if found. However, there does not appear to be any capstone version or API compatibility checks.

Quoted 7 lines
Quoted 3 lines

To avoid any potential version conflicts or API incompatibility issues in the future, use the --enable-capstone=git argument to force the use of the capstone version included by QEMU as a git submodule.

How exactly does that work when the default qemu recipe is a tar.bz2 download ?

The tar.bz2 fetched by the current recipe actually contains a git repo, with the capstone submodule already present in this archive.

Quoted 3 lines

We can't have the recipe going out to the 'net and fetching / downloading source code .. and looking at the option, that appears to be what it would do. Or maybe I'm missing where the code is being fetched into place.

Understood and agreed. I don't *think* it's actually going out and fetching anything, but I would certainly need to double check this.

Nonetheless, what I've proposed here doesn't seem like the right approach to pursue anyway...

Quoted 2 lines

This is something that looks like it could be controlled via packageconfig, or similar mechanism, versus being hard coded into the configure line.

I had been noticing that the $pkg_config invocation of qemu's configure script (line 4594) was picking up the bleeding edge version of capstone installed on my build machine, which I had been actively hacking on for something unrelated. Ultimately the issues I was experiencing with this were a case of PEBKAC. However, this new-ish capstone dependency still struck me as something worth having another pair of eyes on to avoid future headaches down the road.

The --enable-capstone=git configuration appeared to be the only exposed option to skip the $pkg_config invocation in 4592-4612 and still allow lines 4616-4627 to pick up the submodule.

Usually, if one does not have capstone installed on their build system, this appears to fall back to using the included git submodule.

Reflecting on it further -- what I've proposed here is a gross hack. Ultimately I just wanted to ensure that the capstone dependency shipped in the tar.bz2 is always what's used, assuming that's what the QEMU team tested and deemed adequate.

How would you advise moving forward with a packageconfig solution? Does it seem like some change is required to prevent the QEMU configure script from diving into the build hosts pkg-config path, or is this the desired behavior?

What do you think about instead patching the configure script to just set the default to capstone=internal?

Quoted 1 line

Also, the patch is missing your Signed-off-by:

Whoops! Noted, thank you! :)

#4 lore raw
Quoted 2 lines · Jon Szymaniak

What do you think about instead patching the configure script to just set the default to capstone=internal?

I'm just glancing at the configure and don't have time right now to test, but wouldn't --enable-capstone=git --disable-git-update do the right thing?

Ross

A message that is not in the archive (sent off-list or not yet received): CANge7vXsQa9n7A8+W11vXwiz=_b2ndVKs2pp660TjjSN96F6Lg@mail.gmail.com

#6 lore raw
Quoted 3 lines · Jon Szymaniak

Alternatively, if the capstone dissembler only provides value when debugging qemu itself (as opposed to regular OE/Yocto use-cases), should we just use "--disable-capstone" ?

If that's true, then yes.

Ross

#7 lore raw
Quoted 6 lines · Ross
Quoted 3 lines · Jon Szymaniak

Alternatively, if the capstone dissembler only provides value when debugging qemu itself (as opposed to regular OE/Yocto use-cases), should we just use "--disable-capstone" ?

If that's true, then yes.

agreed.

Bruce

Quoted 2 lines

Ross

Signature · 2 lines
"Thou shalt not follow the NULL pointer, for chaos and madness await
thee at its end"