All of lore.kernel.org
 help / color / mirror / Atom feed
From: Peter Maydell <peter.maydell@linaro.org>
To: Stefan Hajnoczi <stefanha@redhat.com>
Cc: Laurent Vivier <lvivier@redhat.com>,
	Kevin Wolf <kwolf@redhat.com>, Thomas Huth <thuth@redhat.com>,
	Qemu-block <qemu-block@nongnu.org>,
	QEMU Developers <qemu-devel@nongnu.org>,
	Coiby Xu <Coiby.Xu@gmail.com>, Gerd Hoffmann <kraxel@redhat.com>,
	Paolo Bonzini <pbonzini@redhat.com>
Subject: Re: [PATCH 2/3] vhost-user-blk-test: fix Coverity mkstemp(2) umask warning
Date: Sun, 30 May 2021 20:01:21 +0100	[thread overview]
Message-ID: <CAFEAcA8XA=+tL5194oKUkvraKd7ojPj2qdnjhRUsTZMndSbH6Q@mail.gmail.com> (raw)
In-Reply-To: <20210526091248.434459-3-stefanha@redhat.com>

On Wed, 26 May 2021 at 10:14, Stefan Hajnoczi <stefanha@redhat.com> wrote:
>
> The Linux man page for mkstemp(3) states:
>
>   In glibc versions 2.06 and earlier, the file is created with
>   permissions 0666, that is, read and write for all users.  This old
>   behavior may be a security risk, especially  since other UNIX flavors
>   use 0600, and somebody might overlook this detail when porting
>   programs. POSIX.1-2008 adds a requirement that the file be created
>   with mode 0600.
>
>   More generally, the POSIX specification of mkstemp() does not say
>   anything about file modes, so the application should make sure its
>   file mode creation mask (see umask(2)) is set appropriately before
>   calling mkstemp() (and mkostemp()).
>
> glibc 2.0.6 was released in 1997 and POSIX caught up in 2008. macOS and
> FreeBSD also use POSIX-compliant 0600 permissions.
>
> At this point the Coverity warning seems archaic and no longer useful,
> but go ahead and silence it.

We had a lot of these on other uses of mkstemp() in tests/ -- I
have been simply marking them as false-positive on the same grounds
that you cite above. I would suggest we do the same here rather
than having this one test do something different with mkstemp().

(If we really wanted to handle ancient glibc, we should do that
by having a qemu_mkstemp() or something. But it doesn't seem
worthwhile...)

thanks
-- PMM


  reply	other threads:[~2021-05-30 19:05 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-05-26  9:12 [PATCH 0/3] vhost-user-blk-test and vdagent Coverity fixes Stefan Hajnoczi
2021-05-26  9:12 ` [PATCH 1/3] vhost-user-blk-test: fix Coverity open(2) false positives Stefan Hajnoczi
2021-05-30 19:05   ` Peter Maydell
2021-06-01 15:36     ` Stefan Hajnoczi
2021-05-26  9:12 ` [PATCH 2/3] vhost-user-blk-test: fix Coverity mkstemp(2) umask warning Stefan Hajnoczi
2021-05-30 19:01   ` Peter Maydell [this message]
2021-06-01 15:36     ` Stefan Hajnoczi
2021-05-26  9:12 ` [PATCH 3/3] ui/vdagent: fix clipboard info memory leak in error path Stefan Hajnoczi
2021-05-28  7:06   ` Gerd Hoffmann

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='CAFEAcA8XA=+tL5194oKUkvraKd7ojPj2qdnjhRUsTZMndSbH6Q@mail.gmail.com' \
    --to=peter.maydell@linaro.org \
    --cc=Coiby.Xu@gmail.com \
    --cc=kraxel@redhat.com \
    --cc=kwolf@redhat.com \
    --cc=lvivier@redhat.com \
    --cc=pbonzini@redhat.com \
    --cc=qemu-block@nongnu.org \
    --cc=qemu-devel@nongnu.org \
    --cc=stefanha@redhat.com \
    --cc=thuth@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.