[PATCH 0/2] qemuxml2argvtest: Don't exec '/usr/libexec/qemu/vhost-user/test-vhost-user-gpu'

Peter Krempa posted 2 patches 4 months, 2 weeks ago
Patches applied successfully (tree, apply log)
git fetch https://github.com/patchew-project/libvirt tags/patchew/cover.1702897199.git.pkrempa@redhat.com
src/qemu/qemu_vhost_user_gpu.c |  4 ++++
src/qemu/qemu_vhost_user_gpu.h |  2 +-
src/util/vircommand.h          |  4 ++--
tests/qemuxml2argvmock.c       | 28 ++++++++++++++++++++++++++++
4 files changed, 35 insertions(+), 3 deletions(-)
[PATCH 0/2] qemuxml2argvtest: Don't exec '/usr/libexec/qemu/vhost-user/test-vhost-user-gpu'
Posted by Peter Krempa 4 months, 2 weeks ago
'qemuExtVhostUserGPUPrepareDomain' breaks our design assumptions about
the 'PrepareDomain' step which should not touch anything on the host.

This patchset for now fixes the symptom by mocking the function and
poisons virFork and virCommandRun so that this doesn't happen in the
future.

Proper fix will require splitting the vhost-user GPU prepare step to
prepare the host-specific portion separately.

Peter Krempa (2):
  qemuxml2argvmock: Mock qemuExtVhostUserGPUPrepareDomain
  qemuxml2argvmock: Poison virCommandRun and virFork from test context

 src/qemu/qemu_vhost_user_gpu.c |  4 ++++
 src/qemu/qemu_vhost_user_gpu.h |  2 +-
 src/util/vircommand.h          |  4 ++--
 tests/qemuxml2argvmock.c       | 28 ++++++++++++++++++++++++++++
 4 files changed, 35 insertions(+), 3 deletions(-)

-- 
2.43.0
_______________________________________________
Devel mailing list -- devel@lists.libvirt.org
To unsubscribe send an email to devel-leave@lists.libvirt.org
Re: [PATCH 0/2] qemuxml2argvtest: Don't exec '/usr/libexec/qemu/vhost-user/test-vhost-user-gpu'
Posted by Michal Prívozník 4 months, 2 weeks ago
On 12/18/23 12:02, Peter Krempa wrote:
> 'qemuExtVhostUserGPUPrepareDomain' breaks our design assumptions about
> the 'PrepareDomain' step which should not touch anything on the host.
> 
> This patchset for now fixes the symptom by mocking the function and
> poisons virFork and virCommandRun so that this doesn't happen in the
> future.
> 
> Proper fix will require splitting the vhost-user GPU prepare step to
> prepare the host-specific portion separately.
> 
> Peter Krempa (2):
>   qemuxml2argvmock: Mock qemuExtVhostUserGPUPrepareDomain
>   qemuxml2argvmock: Poison virCommandRun and virFork from test context
> 
>  src/qemu/qemu_vhost_user_gpu.c |  4 ++++
>  src/qemu/qemu_vhost_user_gpu.h |  2 +-
>  src/util/vircommand.h          |  4 ++--
>  tests/qemuxml2argvmock.c       | 28 ++++++++++++++++++++++++++++
>  4 files changed, 35 insertions(+), 3 deletions(-)
> 

Reviewed-by: Michal Privoznik <mprivozn@redhat.com>

Michal
_______________________________________________
Devel mailing list -- devel@lists.libvirt.org
To unsubscribe send an email to devel-leave@lists.libvirt.org
Re: [PATCH 0/2] qemuxml2argvtest: Don't exec '/usr/libexec/qemu/vhost-user/test-vhost-user-gpu'
Posted by Michal Prívozník 4 months, 1 week ago
On 12/18/23 15:17, Michal Prívozník wrote:
> On 12/18/23 12:02, Peter Krempa wrote:
>> 'qemuExtVhostUserGPUPrepareDomain' breaks our design assumptions about
>> the 'PrepareDomain' step which should not touch anything on the host.
>>
>> This patchset for now fixes the symptom by mocking the function and
>> poisons virFork and virCommandRun so that this doesn't happen in the
>> future.
>>
>> Proper fix will require splitting the vhost-user GPU prepare step to
>> prepare the host-specific portion separately.
>>
>> Peter Krempa (2):
>>   qemuxml2argvmock: Mock qemuExtVhostUserGPUPrepareDomain
>>   qemuxml2argvmock: Poison virCommandRun and virFork from test context
>>
>>  src/qemu/qemu_vhost_user_gpu.c |  4 ++++
>>  src/qemu/qemu_vhost_user_gpu.h |  2 +-
>>  src/util/vircommand.h          |  4 ++--
>>  tests/qemuxml2argvmock.c       | 28 ++++++++++++++++++++++++++++
>>  4 files changed, 35 insertions(+), 3 deletions(-)
>>
> 
> Reviewed-by: Michal Privoznik <mprivozn@redhat.com>

I was wondering why 'meson test --setup acccess' did not catch this and
there are two reasons:

1) it doesn't check for exec(),
2) because of filewrapper, it's not really /usr/libexec/... we are
trying to exec, rather than
libvirt.git/tests/qemuvhostuserdata/usr/libexec/qemu/vhost-user/test-vhost-user-gpu
which is just a shell script.

I'll post patch for 1), might be worth removing the script from 2) too.

Michal
_______________________________________________
Devel mailing list -- devel@lists.libvirt.org
To unsubscribe send an email to devel-leave@lists.libvirt.org