lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <20210128120130.50aa9a74@eldfell>
Date:   Thu, 28 Jan 2021 12:01:30 +0200
From:   Pekka Paalanen <ppaalanen@...il.com>
To:     Christian König <christian.koenig@....com>
Cc:     Michal Hocko <mhocko@...e.com>, Jann Horn <jannh@...gle.com>,
        "open list:DOCUMENTATION" <linux-doc@...r.kernel.org>,
        Szabolcs Nagy <szabolcs.nagy@....com>,
        dri-devel@...ts.freedesktop.org, Andrei Vagin <avagin@...il.com>,
        Kalesh Singh <kaleshsingh@...gle.com>, Hui Su <sh_def@....com>,
        Michel Lespinasse <walken@...gle.com>,
        Jonathan Corbet <corbet@....net>,
        Mauro Carvalho Chehab <mchehab+huawei@...nel.org>,
        Jeffrey Vander Stoep <jeffv@...gle.com>,
        Daniel Jordan <daniel.m.jordan@...cle.com>,
        kernel-team <kernel-team@...roid.com>,
        Alexey Dobriyan <adobriyan@...il.com>,
        Linux Media Mailing List <linux-media@...r.kernel.org>,
        Kees Cook <keescook@...omium.org>,
        linaro-mm-sig@...ts.linaro.org,
        linux-fsdevel <linux-fsdevel@...r.kernel.org>,
        Bernd Edlinger <bernd.edlinger@...mail.de>,
        Suren Baghdasaryan <surenb@...gle.com>,
        Alexey Gladkov <gladkov.alexey@...il.com>,
        kernel list <linux-kernel@...r.kernel.org>,
        Minchan Kim <minchan@...nel.org>,
        Yafang Shao <laoar.shao@...il.com>,
        "Eric W. Biederman" <ebiederm@...ssion.com>,
        Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
        Hridya Valsaraju <hridya@...gle.com>,
        Andrew Morton <akpm@...ux-foundation.org>,
        Linux API <linux-api@...r.kernel.org>
Subject: Re: [PATCH] procfs/dmabuf: Add /proc/<pid>/task/<tid>/dmabuf_fds

On Wed, 27 Jan 2021 12:01:55 +0100
Christian König <christian.koenig@....com> wrote:

> Somewhat correct. This interface here really doesn't make sense since 
> the file descriptor representation of DMA-buf is only meant to be used 
> for short term usage.
> 
> E.g. the idea is that you can export a DMA-buf fd from your device 
> driver, transfer that to another process and then import it again into a 
> device driver.
> 
> Keeping a long term reference to a DMA-buf fd sounds like a design bug 
> in userspace to me.

Except keeping the fd is exactly what userspace must do if it wishes to
re-use the buffer without passing a new fd over IPC again. Particularly
Wayland compositors need to keep the client buffer dmabuf fd open after
receiving it, so that they can re-import it to EGL to ensure updated
contents are correctly flushed as EGL has no other API for it.

That is my vague understanding, and what Weston implements. You can say
it's a bad userspace API design in EGL, but what else can we do?

However, in the particular case of Wayland, the shared dmabufs should
be accounted to the Wayland client process. OOM-killing the client
process will eventually free the dmabuf, also the Wayland server
references to it. Killing the Wayland server (compositor, display
server) OTOH is something that should not be done as long as there are
e.g. Wayland clients to be killed.

Unfortunately(?), Wayland clients do not have a reason to keep the
dmabuf fd open themselves, so they probably close it as soon as it has
been sent to a display server. So the process that should be OOM-killed
does not have an open fd for the dmabuf (but probably has something
else, but not an mmap for CPU). Buffer re-use in Wayland does not
require re-sending the dmabuf fd over IPC.

(In general, dmabufs are never mmapped for CPU. They are accessed by
devices.)


Thanks,
pq

Content of type "application/pgp-signature" skipped

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ