From nobody Sun Feb 8 17:47:08 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 205.139.110.61 as permitted sender) client-ip=205.139.110.61; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-delivery-1.mimecast.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 205.139.110.61 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=1589216159; cv=none; d=zohomail.com; s=zohoarc; b=CQRIxVE/9vjqFx0UFamyYmdzcZaHaV4ToyOmBz/KMEDQ5kJL4lsFWFKn2htqN2K7eeN0sK7b1uuWhErKg3I/Lv15uZOhLwdgVB+KgxjYC6O0UaOLFpIO9Xy+aQYkMZCBrKA93szOAJwtqOYKwZUA2dmCbZf70CrYc1FJ0Bk6Amk= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1589216159; 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=gPx3YDAhZWrFF7890VdnpRmnDVgdmS2F/06VSYnGMLM=; b=Be8QqtuSR8QkleZt//QhjdLRNtmKpYlMxHhG89NDciYrDUNlC1pTQWawIcX6DTB3GgojWOwn7J4L1D+buQbkzfkDfTYDWnbXxa7ig7/x1qDHRHW2uBIqeizIwgmWAmMhu0PgR97lcUSlfM4+Ka1ORWeG83t9p9TYKne7S3U89G4= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 205.139.110.61 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-1.mimecast.com (us-smtp-2.mimecast.com [205.139.110.61]) by mx.zohomail.com with SMTPS id 1589216159664491.3530277297598; Mon, 11 May 2020 09:55:59 -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-426-wjuI4DRqO2OFMUvbVU6S0A-1; Mon, 11 May 2020 12:55:54 -0400 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 80B6CEC1A0; Mon, 11 May 2020 16:55:49 +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 41D507527E; Mon, 11 May 2020 16:55:49 +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 C54264E561; Mon, 11 May 2020 16:55:48 +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 04BGtlCQ016610 for ; Mon, 11 May 2020 12:55:47 -0400 Received: by smtp.corp.redhat.com (Postfix) id D6D8B610AF; Mon, 11 May 2020 16:55:47 +0000 (UTC) Received: from localhost.localdomain.com (unknown [10.40.208.39]) by smtp.corp.redhat.com (Postfix) with ESMTP id 49A0360C05 for ; Mon, 11 May 2020 16:55:47 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1589216157; 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=gPx3YDAhZWrFF7890VdnpRmnDVgdmS2F/06VSYnGMLM=; b=PqfEyU17ztOqq0wIY7NdJveaxFZU0dMEmcY+HaEQvxsFQRqko1DaXgfUmcVAf3/T9oXWBg lYmrKVLeraPDGODPv4qfxHYIMM9igOcjkT1F6v6VNzxupUOgQcVuhTd60X54KMRUimlMGH iNfckReNExe9IfX2kCc0+IAm7WCqLhk= X-MC-Unique: wjuI4DRqO2OFMUvbVU6S0A-1 From: Peter Krempa To: libvir-list@redhat.com Subject: [PATCH 1/5] storage_file: create: Create new images with write permission bit Date: Mon, 11 May 2020 18:55:38 +0200 Message-Id: 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 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.11 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) Content-Type: text/plain; charset="utf-8" The 'Create' API of the two storage file backends is used only on code-paths where we need to format the image after creating an empty file. Since the DAC security driver only modifies the owner of the file and not the mode we need to create all files which are going to be formatted with the write bit set for the user. Signed-off-by: Peter Krempa Reviewed-by: J=C3=A1n Tomko --- src/storage/storage_file_fs.c | 6 +----- src/storage/storage_file_gluster.c | 6 +----- 2 files changed, 2 insertions(+), 10 deletions(-) diff --git a/src/storage/storage_file_fs.c b/src/storage/storage_file_fs.c index 0d3f134765..8aafd58992 100644 --- a/src/storage/storage_file_fs.c +++ b/src/storage/storage_file_fs.c @@ -84,13 +84,9 @@ virStorageFileBackendFileInit(virStorageSourcePtr src) static int virStorageFileBackendFileCreate(virStorageSourcePtr src) { - mode_t mode =3D S_IRUSR; VIR_AUTOCLOSE fd =3D -1; - if (!src->readonly) - mode |=3D S_IWUSR; - - if ((fd =3D virFileOpenAs(src->path, O_WRONLY | O_TRUNC | O_CREAT, mod= e, + if ((fd =3D virFileOpenAs(src->path, O_WRONLY | O_TRUNC | O_CREAT, S_I= RUSR | S_IWUSR, src->drv->uid, src->drv->gid, 0)) < 0) { errno =3D -fd; return -1; diff --git a/src/storage/storage_file_gluster.c b/src/storage/storage_file_= gluster.c index f389a94437..608f93d2f6 100644 --- a/src/storage/storage_file_gluster.c +++ b/src/storage/storage_file_gluster.c @@ -152,13 +152,9 @@ virStorageFileBackendGlusterCreate(virStorageSourcePtr= src) { virStorageFileBackendGlusterPrivPtr priv =3D src->drv->priv; glfs_fd_t *fd =3D NULL; - mode_t mode =3D S_IRUSR; - - if (!src->readonly) - mode |=3D S_IWUSR; if (!(fd =3D glfs_creat(priv->vol, src->path, - O_CREAT | O_TRUNC | O_WRONLY, mode))) + O_CREAT | O_TRUNC | O_WRONLY, S_IRUSR | S_IWUSR)= )) return -1; ignore_value(glfs_close(fd)); --=20 2.26.2