From nobody Fri Dec 19 14:28:34 2025 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 170.10.133.124 as permitted sender) client-ip=170.10.133.124; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-delivery-124.mimecast.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 170.10.133.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1694427562; cv=none; d=zohomail.com; s=zohoarc; b=ZZUVn6vA8/wyp9lQ7HLIsEJ9AGLfMAg6jeZV2sxupqcpfKioWAyvBDDZ4XdJSthQ6OdeX3VcSQuSh63kZItWxe9/n7ZJsv+2sZ7ih8wDjkyaY0YBZAYs2X2sD6L8U+UgOwMki5HcFHrkp8P4B9wZnk9F1CNPhc+zUeStrVV99Cg= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1694427562; h=Content-Type:Content-Transfer-Encoding:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=1DKWzmbV6opst0O20pIlyogJVfTC0mc4gFeuDD2w9yo=; b=VxI8eZFfwH7Sa7S7G2cORiEnrZZZDWNz1572ylGXK5Ww0FWxnAOpeOMTMHdlKhw1ELKVCpQHFwNmCorfhKeQeLcQQ/Lf/zTFnyL65Wjmi8Qom/vnZAkNpZMRL92jNlU8gURVumdjTyG97rNWkdfAq2gi8PjbLGUI21OmHCNyJJw= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 170.10.133.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by mx.zohomail.com with SMTPS id 1694427562748593.7454899007098; Mon, 11 Sep 2023 03:19:22 -0700 (PDT) Received: from mimecast-mx02.redhat.com (mx-ext.redhat.com [66.187.233.73]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-326-toJsOXh3OHWnvF_knWTt-A-1; Mon, 11 Sep 2023 06:19:12 -0400 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.rdu2.redhat.com [10.11.54.1]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id AEA4129DD986; Mon, 11 Sep 2023 10:19:05 +0000 (UTC) Received: from mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com [10.30.29.100]) by smtp.corp.redhat.com (Postfix) with ESMTP id 9538A40C2064; Mon, 11 Sep 2023 10:19:05 +0000 (UTC) Received: from mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (localhost [IPv6:::1]) by mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (Postfix) with ESMTP id EC48919465BA; Mon, 11 Sep 2023 10:18:38 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.rdu2.redhat.com [10.11.54.3]) by mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (Postfix) with ESMTP id E56CD1946587 for ; Mon, 11 Sep 2023 10:18:37 +0000 (UTC) Received: by smtp.corp.redhat.com (Postfix) id CF99110F1BE8; Mon, 11 Sep 2023 10:18:37 +0000 (UTC) Received: from maggie.brq.redhat.com (unknown [10.43.2.46]) by smtp.corp.redhat.com (Postfix) with ESMTP id 71EBF10F1BE7 for ; Mon, 11 Sep 2023 10:18:37 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1694427561; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:list-id:list-help: list-unsubscribe:list-subscribe:list-post; bh=1DKWzmbV6opst0O20pIlyogJVfTC0mc4gFeuDD2w9yo=; b=B7CceoFq1DMXxyvJYWATxRVbWVgj0yp4HhDO0f5GSbIigLWEazYGq2WfgILSJw5UqUoHUf ZrI+50lw1KJV33XRlLztZihyJQiuHA4bDsAlDnxI2r+UP3r1go60OlGau2k2sECPr0gWK0 B0tVx73bxT5D0AXv/TK9S5AQPi+nhwo= X-MC-Unique: toJsOXh3OHWnvF_knWTt-A-1 X-Original-To: libvir-list@listman.corp.redhat.com From: Michal Privoznik To: libvir-list@redhat.com Subject: [PATCH 1/2] lxc_container: Check retval of capng_get_caps_process() Date: Mon, 11 Sep 2023 12:18:29 +0200 Message-ID: <660227b3ccbabffee07b1625bfa553a7c8cd2ea8.1694427342.git.mprivozn@redhat.com> In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.1 on 10.11.54.3 X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.29 Precedence: list List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: libvir-list-bounces@redhat.com Sender: "libvir-list" X-Scanned-By: MIMEDefang 3.1 on 10.11.54.1 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1694427564151100001 Content-Type: text/plain; charset="utf-8"; x-default="true" Added in v0.6.5~14 the call to capng_get_caps_process() inside of lxcContainerDropCapabilities() is not really explained in the commit message. But looking into the libcap-ng sources it's to initialize the internal state of the library. But with recent libcap-ng commit [1] (which some bleeding edge distros - like Fedora rawhide - already picked up) the function has been marked as 'warn unused result'. Well, check for its retval then. 1: https://github.com/stevegrubb/libcap-ng/commit/a0743c335c9a16a2fda9b2512= 0a5523742119e47 Signed-off-by: Michal Privoznik --- src/lxc/lxc_container.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/lxc/lxc_container.c b/src/lxc/lxc_container.c index 21220661f7..4c37fcd012 100644 --- a/src/lxc/lxc_container.c +++ b/src/lxc/lxc_container.c @@ -1725,7 +1725,13 @@ static int lxcContainerDropCapabilities(virDomainDef= *def, CAP_SYSLOG, CAP_WAKE_ALARM}; =20 - capng_get_caps_process(); + /* Init the internal state of capng */ + if ((ret =3D capng_get_caps_process()) < 0) { + virReportError(VIR_ERR_INTERNAL_ERROR, + _("Failed to get current process capabilities %1$d"= ), + ret); + return -1; + } =20 /* Make sure we drop everything if required by the user */ if (policy =3D=3D VIR_DOMAIN_CAPABILITIES_POLICY_DENY) --=20 2.41.0