From nobody Thu May 16 04:03:55 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) client-ip=209.132.183.28; envelope-from=libvir-list-bounces@redhat.com; helo=mx1.redhat.com; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass(p=none dis=none) header.from=redhat.com Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by mx.zohomail.com with SMTPS id 1530598068763769.1435329823308; Mon, 2 Jul 2018 23:07:48 -0700 (PDT) Received: from smtp.corp.redhat.com (int-mx11.intmail.prod.int.phx2.redhat.com [10.5.11.26]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id C610B307CF4A; Tue, 3 Jul 2018 06:07:46 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.20]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 77CA9300193B; Tue, 3 Jul 2018 06:07:46 +0000 (UTC) Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by colo-mx.corp.redhat.com (Postfix) with ESMTP id 01A8C18037ED; Tue, 3 Jul 2018 06:07:44 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.rdu2.redhat.com [10.11.54.6]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id w635vfTh022424 for ; Tue, 3 Jul 2018 01:57:41 -0400 Received: by smtp.corp.redhat.com (Postfix) id 067B12156880; Tue, 3 Jul 2018 05:57:41 +0000 (UTC) Received: from localhost.localdomain (ovpn-204-103.brq.redhat.com [10.40.204.103]) by smtp.corp.redhat.com (Postfix) with ESMTP id 860AB2166BA9 for ; Tue, 3 Jul 2018 05:57:40 +0000 (UTC) From: Michal Privoznik To: libvir-list@redhat.com Date: Tue, 3 Jul 2018 07:57:37 +0200 Message-Id: X-Scanned-By: MIMEDefang 2.78 on 10.11.54.6 X-loop: libvir-list@redhat.com Subject: [libvirt] [PATCH] qemuOpenFileAs: Lose bypassSecurityDriver X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.12 Precedence: junk List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.84 on 10.5.11.26 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.44]); Tue, 03 Jul 2018 06:07:47 +0000 (UTC) X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" This argument is not used anymore. The only function that is passing non-NULL (qemuDomainSaveMemory) does not actually care for the value (after 23087cfdb) and every other caller just passes NULL anyway. Signed-off-by: Michal Privoznik Reviewed-by: John Ferlan --- src/qemu/qemu_driver.c | 32 +++++++++----------------------- 1 file changed, 9 insertions(+), 23 deletions(-) diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c index 825b2b27e6..9a35e04a85 100644 --- a/src/qemu/qemu_driver.c +++ b/src/qemu/qemu_driver.c @@ -152,7 +152,7 @@ static int qemuDomainManagedSaveLoad(virDomainObjPtr vm, static int qemuOpenFileAs(uid_t fallback_uid, gid_t fallback_gid, bool dynamicOwnership, const char *path, int oflags, - bool *needUnlink, bool *bypassSecurityDriver); + bool *needUnlink); =20 static int qemuGetDHCPInterfaces(virDomainPtr dom, virDomainObjPtr vm, @@ -2984,9 +2984,6 @@ qemuCompressGetCommand(virQEMUSaveFormat compression) * @path: path to file to open * @oflags: flags for opening/creation of the file * @needUnlink: set to true if file was created by this function - * @bypassSecurityDriver: optional pointer to a boolean that will be set t= o true - * if security driver operations are pointless (due= to - * NFS mount) * * Internal function to properly create or open existing files, with * ownership affected by qemu driver setup and domain DAC label. @@ -3001,8 +2998,7 @@ qemuOpenFile(virQEMUDriverPtr driver, virDomainObjPtr vm, const char *path, int oflags, - bool *needUnlink, - bool *bypassSecurityDriver) + bool *needUnlink) { int ret =3D -1; virQEMUDriverConfigPtr cfg =3D virQEMUDriverGetConfig(driver); @@ -3021,7 +3017,7 @@ qemuOpenFile(virQEMUDriverPtr driver, goto cleanup; =20 ret =3D qemuOpenFileAs(user, group, dynamicOwnership, - path, oflags, needUnlink, bypassSecurityDriver); + path, oflags, needUnlink); =20 cleanup: return ret; @@ -3031,12 +3027,11 @@ static int qemuOpenFileAs(uid_t fallback_uid, gid_t fallback_gid, bool dynamicOwnership, const char *path, int oflags, - bool *needUnlink, bool *bypassSecurityDriver) + bool *needUnlink) { struct stat sb; bool is_reg =3D true; bool need_unlink =3D false; - bool bypass_security =3D false; unsigned int vfoflags =3D 0; int fd =3D -1; int path_shared =3D virFileIsSharedFS(path); @@ -3134,19 +3129,11 @@ qemuOpenFileAs(uid_t fallback_uid, gid_t fallback_g= id, path); goto cleanup; } - - /* Since we had to setuid to create the file, and the fstype - is NFS, we assume it's a root-squashing NFS share, and that - the security driver stuff would have failed anyway */ - - bypass_security =3D true; } } cleanup: if (needUnlink) *needUnlink =3D need_unlink; - if (bypassSecurityDriver) - *bypassSecurityDriver =3D bypass_security; return fd; =20 error: @@ -3198,7 +3185,6 @@ qemuDomainSaveMemory(virQEMUDriverPtr driver, unsigned int flags, qemuDomainAsyncJob asyncJob) { - bool bypassSecurityDriver =3D false; bool needUnlink =3D false; int ret =3D -1; int fd =3D -1; @@ -3218,7 +3204,7 @@ qemuDomainSaveMemory(virQEMUDriverPtr driver, } fd =3D qemuOpenFile(driver, vm, path, O_WRONLY | O_TRUNC | O_CREAT | directFlag, - &needUnlink, &bypassSecurityDriver); + &needUnlink); if (fd < 0) goto cleanup; =20 @@ -3249,7 +3235,7 @@ qemuDomainSaveMemory(virQEMUDriverPtr driver, if (qemuFileWrapperFDClose(vm, wrapperFd) < 0) goto cleanup; =20 - if ((fd =3D qemuOpenFile(driver, vm, path, O_WRONLY, NULL, NULL)) < 0 = || + if ((fd =3D qemuOpenFile(driver, vm, path, O_WRONLY, NULL)) < 0 || virQEMUSaveDataFinish(data, &fd, path) < 0) goto cleanup; =20 @@ -3809,7 +3795,7 @@ doCoreDump(virQEMUDriverPtr driver, * created. */ if ((fd =3D qemuOpenFile(driver, vm, path, O_CREAT | O_TRUNC | O_WRONLY | directFlag, - NULL, NULL)) < 0) + NULL)) < 0) goto cleanup; =20 if (!(wrapperFd =3D virFileWrapperFdNew(&fd, path, flags))) @@ -6419,7 +6405,7 @@ qemuDomainSaveImageOpen(virQEMUDriverPtr driver, if (!(caps =3D virQEMUDriverGetCapabilities(driver, false))) goto error; =20 - if ((fd =3D qemuOpenFile(driver, NULL, path, oflags, NULL, NULL)) < 0) + if ((fd =3D qemuOpenFile(driver, NULL, path, oflags, NULL)) < 0) goto error; if (bypass_cache && !(*wrapperFd =3D virFileWrapperFdNew(&fd, path, @@ -11863,7 +11849,7 @@ qemuDomainStorageOpenStat(virQEMUDriverPtr driver, { if (virStorageSourceIsLocalStorage(src)) { if ((*ret_fd =3D qemuOpenFile(driver, vm, src->path, O_RDONLY, - NULL, NULL)) < 0) + NULL)) < 0) return -1; =20 if (fstat(*ret_fd, ret_sb) < 0) { --=20 2.16.4 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list