From nobody Sun May 5 00:15:31 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 216.205.24.124 as permitted sender) client-ip=216.205.24.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 216.205.24.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=1615914413; cv=none; d=zohomail.com; s=zohoarc; b=NoraO8xrCC5F/59rsLfMUqKVmVQveA0923XBS0OpKFvsqSKtpZJ2JaKlJfuOzFzBUPHqplL9MrYLM38f9lztdOaIxM4FYGHF0u4XcEV1aLFUZAPI23Gg/WfTbO5pop84dqC3edWMOXU3c0CIBg6y5Ow8ctg9ONB7FoLQAcaBcPc= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1615914413; h=Content-Type:Content-Transfer-Encoding:Date:From:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Sender:Subject:To; bh=gA/s8CbrD1BHhjQAePy+bH8tvqC442NAbfTGqLlo/gE=; b=ff8b/Y32kfdKeiCrYbIfzAFVJo5iQfFx/EU514zgFxLgX196pDZl6OLYDPb9yh/SE+hX8hDDcRypJB24kSHZwHDEJmMpbXXOD0bfnlAjUEFU2yHIDHKwaDnpc7hyxa/rm10KjUR1kXFaJZSkv6WFMlbLN/88GsLdMC92uKxSIUc= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 216.205.24.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass header.from= (p=none dis=none) header.from= Return-Path: Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [216.205.24.124]) by mx.zohomail.com with SMTPS id 1615914413978754.9836538700685; Tue, 16 Mar 2021 10:06:53 -0700 (PDT) Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-323-3ZbE25IBMUKisqgFV8ftjg-1; Tue, 16 Mar 2021 13:06:48 -0400 Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 75C40817469; Tue, 16 Mar 2021 17:06:41 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.21]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 538D35D9D3; Tue, 16 Mar 2021 17:06:41 +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 161BBCF47; Tue, 16 Mar 2021 17:06:41 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 12GH6dE1009028 for ; Tue, 16 Mar 2021 13:06:39 -0400 Received: by smtp.corp.redhat.com (Postfix) id B1E8D5D9DE; Tue, 16 Mar 2021 17:06:39 +0000 (UTC) Received: from localhost.localdomain.com (ovpn-115-185.ams2.redhat.com [10.36.115.185]) by smtp.corp.redhat.com (Postfix) with ESMTP id D76B15D9D3; Tue, 16 Mar 2021 17:06:35 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1615914411; 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:list-id:list-help: list-unsubscribe:list-subscribe:list-post; bh=gA/s8CbrD1BHhjQAePy+bH8tvqC442NAbfTGqLlo/gE=; b=fDojiiizvMx4081YSrxeHhYFDPUdqUEuNbcobh1TiJ0asrQk6/lylDXqJ2Z82MRnKKT0EB SNW5IZAsMGIB2dFAmRnsTVD2BJ7vC5auyCyyl/8Vo6im8A/VmdpNUn+v9vTRgw4I5/5zdQ Dx83V/O37wE+QO3+MOmSY/W89O4Wkb0= X-MC-Unique: 3ZbE25IBMUKisqgFV8ftjg-1 From: =?UTF-8?q?Daniel=20P=2E=20Berrang=C3=A9?= To: libvir-list@redhat.com Subject: [libvirt PATCH] util: tell users that memory locking ulimit is too low for BPF Date: Tue, 16 Mar 2021 17:06:33 +0000 Message-Id: <20210316170633.159916-1-berrange@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 X-loop: libvir-list@redhat.com 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: , Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=libvir-list-bounces@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) If running libvirtd via systemd, it gets a 64 MB memlock limit, but if running from the shell it will only get 64 KB on a Fedora 33 system. The latter low limit causes any attempt to use BPF to fail and it is not obvious why. This improves the error message thus: # virsh -c lxc:/// start sh error: Failed to start domain 'sh' error: internal error: guest failed to start: Failure in libvirt_lxc startu= p: failed to initialize device BPF map; locked memory limit for libvirtd pr= obably needs to be raised: Operation not permitted Signed-off-by: Daniel P. Berrang=C3=A9 Reviewed-by: Pavel Hrdina --- src/util/vircgroupv2devices.c | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/src/util/vircgroupv2devices.c b/src/util/vircgroupv2devices.c index 71591be4c4..4bcc1d52fe 100644 --- a/src/util/vircgroupv2devices.c +++ b/src/util/vircgroupv2devices.c @@ -443,9 +443,17 @@ virCgroupV2DevicesCreateMap(size_t size) sizeof(uint32_t), size); =20 if (mapfd < 0) { - virReportSystemError(errno, "%s", - _("failed to initialize device BPF map")); - return -1; + if (errno =3D=3D EPERM) { + virReportSystemError(errno, "%s", + _("failed to initialize device BPF map; " + "locked memory limit for libvirtd proba= bly " + "needs to be raised")); + return -1; + } else { + virReportSystemError(errno, "%s", + _("failed to initialize device BPF map")); + return -1; + } } =20 return mapfd; --=20 2.30.2