From nobody Mon Feb 9 05:20:57 2026 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 ARC-Seal: i=1; a=rsa-sha256; t=1556180427; cv=none; d=zoho.com; s=zohoarc; b=LVuSmUKCcaHX8MbvgyZMFE9RmUxYtrcvc+eJLpwtf8+gLpSSrqkCcuLL+ESLMHktI+43XARWB/BiezPlIstHs6jbh8NCPV+bMl/Jq4wFGh9wX24qjwRK9O27+G+DhM/HfYMhN1mUlwTKQAr2CG2cx0TmfHXAY7+tiwPTgMEwJMM= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1556180427; 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:ARC-Authentication-Results; bh=rbAB3ObA1Nwg2yCNq2zS6Fod3g0aRSe4nQFD5XYfmBc=; b=iGqmOQJVfA0vKbClp+qDdIbdlfi69QymYk2IQX8eObEFZ1+6AE+oIPvq6d1+6NdP4DIQO+Iu7C4hJ7ufy0ssxj86f6xFKMQz02oWMdkcmuPpfBU68s/x8YpL5gNuxWIT4jobYnXQLxeWsZ4FFF4uL/pUCgqMGwNnteNl4kwKmmQ= ARC-Authentication-Results: i=1; mx.zoho.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 header.from= (p=none dis=none) header.from= Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by mx.zohomail.com with SMTPS id 155618042710285.33913559731684; Thu, 25 Apr 2019 01:20:27 -0700 (PDT) Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.phx2.redhat.com [10.5.11.23]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 72A3D3002509; Thu, 25 Apr 2019 08:20:25 +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 48C4E165D3; Thu, 25 Apr 2019 08:20:25 +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 09B71181B9F5; Thu, 25 Apr 2019 08:20:25 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id x3P8K9w5013826 for ; Thu, 25 Apr 2019 04:20:09 -0400 Received: by smtp.corp.redhat.com (Postfix) id 2B6FC60BE5; Thu, 25 Apr 2019 08:20:09 +0000 (UTC) Received: from moe.brq.redhat.com (unknown [10.43.2.30]) by smtp.corp.redhat.com (Postfix) with ESMTP id A86B460C70 for ; Thu, 25 Apr 2019 08:20:08 +0000 (UTC) From: Michal Privoznik To: libvir-list@redhat.com Date: Thu, 25 Apr 2019 10:19:38 +0200 Message-Id: <53049b16e61097d7b527f89af30adb85ef4ce005.1556179410.git.mprivozn@redhat.com> In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 X-loop: libvir-list@redhat.com Subject: [libvirt] [PATCH v4 02/25] qemusecuritymock: Fix bit arithmetic 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-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.23 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.45]); Thu, 25 Apr 2019 08:20:25 +0000 (UTC) Content-Type: text/plain; charset="utf-8" One of the functions of this mock is that it spoofs chown() and stat() calls. But it is doing so in a clever way: it stores the new owner on chown() and reports it on subsequent stat(). This is done by using a 32bit unsigned integer where one half is used to store uid the other is for gid. Later, when stat() is called the integer is fetched and split into halves again. Well, my bit operation skills are poor and the code I've written does not do that properly. Signed-off-by: Michal Privoznik Reviewed-by: Daniel P. Berrang=C3=A9 --- tests/qemusecuritymock.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/qemusecuritymock.c b/tests/qemusecuritymock.c index d170e5da8f..1ca8bd721f 100644 --- a/tests/qemusecuritymock.c +++ b/tests/qemusecuritymock.c @@ -226,7 +226,7 @@ int virFileRemoveXAttr(const char *path, sb->st_gid =3D DEFAULT_GID; \ } else { \ /* Known path. Set values passed to chown() earlier */ \ - sb->st_uid =3D *val % 16; \ + sb->st_uid =3D *val & 0xffff; \ sb->st_gid =3D *val >> 16; \ } \ \ --=20 2.21.0 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list