dri-devel Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Demi Marie Obenour <demiobenour@gmail.com>
To: Linux kernel mailing list <linux-kernel@vger.kernel.org>,
	dri-devel@lists.freedesktop.org, linux-fsdevel@vger.kernel.org
Subject: Possible newline injection into fdinfo
Date: Wed, 4 Mar 2026 01:53:42 -0500	[thread overview]
Message-ID: <08f230b4-8c01-45b8-9956-7cfb9f82eeff@gmail.com> (raw)


[-- Attachment #1.1.1: Type: text/plain, Size: 1422 bytes --]

I noticed potentially missing input sanitization in dma_buf_set_name(),
which is reachable from DMA_BUF_SET_NAME.  This allows inserting a name
containing a newline, which is then used to construct the contents of
/proc/PID/task/TID/fdinfo/FD.  This could confuse userspace programs
that access this data, possibly tricking them into thinking a file
descriptor is of a different type than it actually is.

Other code might have similar bugs.  For instance, there is code that
uses a sysfs path, a driver name, or a device name from /dev.  It is
possible to sanitize the first, and the second and third should come
from trusted sources within the kernel itself.  The last area where
I found a potential problem is BPF.  I don't know if this can happen.

I think this should be fixed by either sanitizing data on write
(by limiting the allowed characters in dma_buf_set_name()), on read
(by using one of the formats that escapes special characters), or both.

Is there a better way to identify that a file descriptor is of
a particular type, such as an eventfd?  fdinfo is subject to
bugs of this type, which might happen again.  readlink() reports
"anon_inode:[eventfd]" and S_IFMT reports a mode of 0, but but my
reading of the kernel source code is that neither is intended to be
stable uAPI.  Is there a better interface that can be used?
-- 
Sincerely,
Demi Marie Obenour (she/her/hers)




[-- Attachment #1.1.2: OpenPGP public key --]
[-- Type: application/pgp-keys, Size: 7253 bytes --]

[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

             reply	other threads:[~2026-03-04  6:53 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-03-04  6:53 Demi Marie Obenour [this message]
2026-03-04 13:03 ` Possible newline injection into fdinfo Christian Brauner
2026-03-04 18:57   ` Demi Marie Obenour
2026-03-05  8:34     ` Christian Brauner
2026-03-05 10:24       ` Demi Marie Obenour
2026-03-09 12:39         ` Christian Brauner

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=08f230b4-8c01-45b8-9956-7cfb9f82eeff@gmail.com \
    --to=demiobenour@gmail.com \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox