From nobody Sun Apr 28 21:35:50 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 1521802989194164.89528612665094; Fri, 23 Mar 2018 04:03:09 -0700 (PDT) Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 559EE18B320; Fri, 23 Mar 2018 11:03:06 +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 3055560F8D; Fri, 23 Mar 2018 11:03:05 +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 81B6D181BA00; Fri, 23 Mar 2018 11:03:02 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.rdu2.redhat.com [10.11.54.3]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id w2NB2xD2014714 for ; Fri, 23 Mar 2018 07:03:00 -0400 Received: by smtp.corp.redhat.com (Postfix) id D9DB110B2B2B; Fri, 23 Mar 2018 11:02:59 +0000 (UTC) Received: from localhost.localdomain.com (unknown [10.42.22.189]) by smtp.corp.redhat.com (Postfix) with ESMTP id 6D95210B2B21; Fri, 23 Mar 2018 11:02:57 +0000 (UTC) From: =?UTF-8?q?Daniel=20P=2E=20Berrang=C3=A9?= To: libvir-list@redhat.com Date: Fri, 23 Mar 2018 11:02:54 +0000 Message-Id: <20180323110254.14589-1-berrange@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.78 on 10.11.54.3 X-loop: libvir-list@redhat.com Subject: [libvirt] [PATCH] remote: remove some __sun conditionals 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: , Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.29]); Fri, 23 Mar 2018 11:03:07 +0000 (UTC) X-ZohoMail: RSF_0 Z_629925259 SPT_0 The libvirtd daemon has some arbitrary logic to drop privileges, but only on Solaris platforms. This was added during Xen days, when Xen was the only driver running in libvirtd. There's no expectation or testing that this works with the new libxl stack, nor whether dropping privileges breaks any of the secondary drivers. Finally, we'll be splitting drivers out into their own independant daemons, so this won't be applicable to libvirtd in future anyway. The remote driver client meanwhile arbitrarily disables daemon auto-spawn when connecting as non-root, breaking a key feature of libvirt unprivileged connections. Since we've not had any contributions for Solaris since circa 2012 and we don't do any CI testing we should consider this platform unmaintained and thus reasonable to remove this cruft. If someone steps forward to maintain Solaris again, this code would need re-evaluating to come up with something more targetted. There's various __sun conditionals in the Xen driver code, but those are not touched. This is all for the legacy Xen driver, which will be entirely removed at some point in future, so not benefit to hacking out just the Solaris parts. Signed-off-by: Daniel P. Berrang=C3=A9 Reviewed-by: Andrea Bolognani --- src/remote/remote_daemon.c | 33 --------------------------------- src/remote/remote_driver.c | 2 -- 2 files changed, 35 deletions(-) diff --git a/src/remote/remote_daemon.c b/src/remote/remote_daemon.c index 2f9dfad443..31c6ce1b61 100644 --- a/src/remote/remote_daemon.c +++ b/src/remote/remote_daemon.c @@ -675,30 +675,6 @@ daemonVersion(const char *argv0) printf("%s (%s) %s\n", argv0, PACKAGE_NAME, PACKAGE_VERSION); } =20 -#ifdef __sun -static int -daemonSetupPrivs(void) -{ - chown("/var/run/libvirt", SYSTEM_UID, SYSTEM_UID); - - if (__init_daemon_priv(PU_RESETGROUPS | PU_CLEARLIMITSET, - SYSTEM_UID, SYSTEM_UID, PRIV_XVM_CONTROL, NULL)= ) { - VIR_ERROR(_("additional privileges are required")); - return -1; - } - - if (priv_set(PRIV_OFF, PRIV_ALLSETS, PRIV_FILE_LINK_ANY, PRIV_PROC_INF= O, - PRIV_PROC_SESSION, PRIV_PROC_EXEC, PRIV_PROC_FORK, NULL))= { - VIR_ERROR(_("failed to set reduced privileges")); - return -1; - } - - return 0; -} -#else -# define daemonSetupPrivs() 0 -#endif - =20 static void daemonShutdownHandler(virNetDaemonPtr dmn, siginfo_t *sig ATTRIBUTE_UNUSED, @@ -1336,15 +1312,6 @@ int main(int argc, char **argv) { goto cleanup; } =20 - /* Beyond this point, nothing should rely on using - * getuid/geteuid() =3D=3D 0, for privilege level checks. - */ - VIR_DEBUG("Dropping privileges (if required)"); - if (daemonSetupPrivs() < 0) { - ret =3D VIR_DAEMON_ERR_PRIVS; - goto cleanup; - } - daemonInitialize(); =20 remoteProcs[REMOTE_PROC_AUTH_LIST].needAuth =3D false; diff --git a/src/remote/remote_driver.c b/src/remote/remote_driver.c index f765c09416..34e5ced0a9 100644 --- a/src/remote/remote_driver.c +++ b/src/remote/remote_driver.c @@ -1350,7 +1350,6 @@ remoteConnectOpen(virConnectPtr conn, */ if (!conn->uri) { VIR_DEBUG("Auto-probe remote URI"); -#ifndef __sun if (geteuid() > 0) { VIR_DEBUG("Auto-spawn user daemon instance"); rflags |=3D VIR_DRV_OPEN_REMOTE_USER; @@ -1359,7 +1358,6 @@ remoteConnectOpen(virConnectPtr conn, STRNEQ(autostart, "0"))) rflags |=3D VIR_DRV_OPEN_REMOTE_AUTOSTART; } -#endif } =20 ret =3D doRemoteOpen(conn, priv, auth, conf, rflags); --=20 2.14.3 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list