Skip to contentSkip to conversation

Allow to build virtiofsd without the entire tools

PATCH Applied Wainer dos Santos Moschetta 5 participants 9 messages Feb 1, 2021 – Feb 16, 2021 Arm/Amlogic Meson SoC support

lore
Share & tools
lore
#0 lore raw

cover Allow to build virtiofsd without the entire tools

Not too long ago (QEMU 5.0) it was possible to configure with --disable-tools and still have virtiofsd built. With the recent port of the build system to Meson, it is now built together with the tools though.

The Kata Containers [1] project build QEMU with --disable-tools to decrease the attack surface, apart from the fact that tools (except for virtiofsd) aren't used at all. So the ability to build only virtiofsd is appreciated.

On commit cece116c939 it was introduced the --enable-virtiofsd option. One might think that option will enable the virtiofsd build regardless of --disable-tools but it isn't the current behavior. So the patch that I am sending allows to disable all tools but virtiofsd.

Side note: in a private chat with Stefan Hajnoczi he come up with the idea that perhaps --disable-tools could be like --without-default-features where one can add back on feature-by-feature basis. This is outside the scope of this series but I thought in sharing because IMHO it is deserves a discussion.

[1] https://katacontainers.io

Wainer dos Santos Moschetta (1):
virtiofsd: Allow to build it without the tools

 tools/meson.build | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)
Signature · 1 line
2.29.2
#1 lore raw

PATCH 1/1 virtiofsd: Allow to build it without the tools

This changed the Meson build script to allow virtiofsd be built even though the tools build is disabled, thus honoring the --enable-virtiofsd option.

---
 tools/meson.build | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)
tools/meson.build +5 -2
index fdce66857d..3e5a0abfa2 100644
@@ -10,8 +10,11 @@ if get_option('virtiofsd').enabled()
       error('virtiofsd requires Linux')
     elif not seccomp.found() or not libcap_ng.found()
       error('virtiofsd requires libcap-ng-devel and seccomp-devel')
-    elif not have_tools or 'CONFIG_VHOST_USER' not in config_host
-      error('virtiofsd needs tools and vhost-user support')
+    elif 'CONFIG_VHOST_USER' not in config_host
+      error('virtiofsd needs vhost-user support')
+    else
+      # Disabled all the tools but virtiofsd.
+      have_virtiofsd = true
     endif
   endif
 elif get_option('virtiofsd').disabled() or not have_system
Signature · 1 line
2.29.2
Reviewed-by Misono Tomohiro on v1 1/1
#2 lore raw

RE: [PATCH 1/1] virtiofsd: Allow to build it without the tools

Quoted 7 lines

Subject: [PATCH 1/1] virtiofsd: Allow to build it without the tools

This changed the Meson build script to allow virtiofsd be built even though the tools build is disabled, thus honoring the --enable-virtiofsd option.

I misunderstood that virtiofsd builds somehow depends on tools build at that time. Thanks for fixing. I did quick build test.

#3 lore raw

Re: [PATCH 1/1] virtiofsd: Allow to build it without the tools

Quoted 9 lines · On 2/2/21 2:55 AM, [email protected] wrote:
Quoted 7 lines

Subject: [PATCH 1/1] virtiofsd: Allow to build it without the tools

This changed the Meson build script to allow virtiofsd be built even though the tools build is disabled, thus honoring the --enable-virtiofsd option.

I misunderstood that virtiofsd builds somehow depends on tools build at that time. Thanks for fixing. I did quick build test.

Thanks for the review and test!

If not needed a v2 for this patch, please could the maintainer add to the commit message:

Fixes cece116c939d219070b250338439c2d16f94e3da (configure: add option for virtiofsd)

- Wainer

Quoted 3 lines
#4 lore raw

Re: [PATCH 1/1] virtiofsd: Allow to build it without the tools

Quoted 11 lines · * Wainer dos Santos Moschetta ([email protected]) wrote:
Quoted 9 lines · On 2/2/21 2:55 AM, [email protected] wrote:
Quoted 7 lines

Subject: [PATCH 1/1] virtiofsd: Allow to build it without the tools

This changed the Meson build script to allow virtiofsd be built even though the tools build is disabled, thus honoring the --enable-virtiofsd option.

I misunderstood that virtiofsd builds somehow depends on tools build at that time. Thanks for fixing. I did quick build test.

Quoted 7 lines

Thanks for the review and test!

If not needed a v2 for this patch, please could the maintainer add to the commit message:

Fixes cece116c939d219070b250338439c2d16f94e3da (configure: add option for

virtiofsd)

OK, I cna add that; I'll take it through virtiofs next time I need to do a pull.

Quoted 5 lines

- Wainer

Quoted 3 lines
Signature · 1 line
Dr. David Alan Gilbert / [email protected] / Manchester, UK
#5 lore raw

Re: [PATCH 1/1] virtiofsd: Allow to build it without the tools

In reply to Wainer dos Santos Moschetta
Quoted 11 lines · * Wainer dos Santos Moschetta ([email protected]) wrote:
Quoted 9 lines · On 2/2/21 2:55 AM, [email protected] wrote:
Quoted 7 lines

Subject: [PATCH 1/1] virtiofsd: Allow to build it without the tools

This changed the Meson build script to allow virtiofsd be built even though the tools build is disabled, thus honoring the --enable-virtiofsd option.

I misunderstood that virtiofsd builds somehow depends on tools build at that time. Thanks for fixing. I did quick build test.

Quoted 7 lines

Thanks for the review and test!

If not needed a v2 for this patch, please could the maintainer add to the commit message:

Fixes cece116c939d219070b250338439c2d16f94e3da (configure: add option for

virtiofsd)

Queued with that line added to the commit message

Quoted 7 lines

- Wainer

Quoted 3 lines
Signature · 1 line
Dr. David Alan Gilbert / [email protected] / Manchester, UK
Reviewed-by on v1 1/1
#6 lore raw

Re: [PATCH 1/1] virtiofsd: Allow to build it without the tools

In reply to Wainer dos Santos Moschetta
Quoted 8 lines · Wainer dos Santos Moschetta

This changed the Meson build script to allow virtiofsd be built even though the tools build is disabled, thus honoring the --enable-virtiofsd option.

---
 tools/meson.build | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)
#7 lore raw
In reply to Wainer dos Santos Moschetta

Il lun 1 feb 2021, 22:15 Wainer dos Santos Moschetta <[email protected]> ha scritto:

Quoted 8 lines

Not too long ago (QEMU 5.0) it was possible to configure with --disable-tools
and still have virtiofsd built. With the recent port of the build system to Meson, it is now built together with the tools though.

The Kata Containers [1] project build QEMU with --disable-tools to decrease the
attack surface

---enable-tools only adds separate executables, therefore it can't add to the attack surface of the emulators. So this is misleading.

That said, it does make sense to let --enable-virtiofsd override --disable-tools, and the same in the other direction too.

Paolo

Side note: in a private chat with Stefan Hajnoczi he come up with the idea

Quoted 18 lines

that perhaps --disable-tools could be like --without-default-features where one can add back on feature-by-feature basis. This is outside the scope of this
series but I thought in sharing because IMHO it is deserves a discussion.

[1] https://katacontainers.io

Wainer dos Santos Moschetta (1):
virtiofsd: Allow to build it without the tools

 tools/meson.build | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

--
2.29.2

#8 lore raw

Hi,

Quoted 10 lines · Paolo Bonzini

Il lun 1 feb 2021, 22:15 Wainer dos Santos Moschetta <[email protected] <mailto:[email protected]>> ha scritto:

Not too long ago (QEMU 5.0) it was possible to configure with --disable-tools
and still have virtiofsd built. With the recent port of the build system to
Meson, it is now built together with the tools though.

Quoted 7 lines

The Kata Containers [1] project build QEMU with --disable-tools to decrease the
attack surface

---enable-tools only adds separate executables, therefore it can't add to the attack surface of the emulators. So this is misleading.

You are right, Paolo, thanks for the comment. I meant to say the project avoid installing unneeded binaries on the system, extra files which may be subject to CVEs and force a sysadmin to handle them. I hope this clarifies my point.

Thanks!

Wainer

Quoted 27 lines

That said, it does make sense to let --enable-virtiofsd override --disable-tools, and the same in the other direction too.

Paolo

Side note: in a private chat with Stefan Hajnoczi he come up with the idea
that perhaps --disable-tools could be like --without-default-features where
one can add back on feature-by-feature basis. This is outside the scope of this
series but I thought in sharing because IMHO it is deserves a discussion.

[1] https://katacontainers.io <https://katacontainers.io>

Wainer dos Santos Moschetta (1):
  virtiofsd: Allow to build it without the tools

 tools/meson.build | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

--
2.29.2