Linux Perf Users
 help / color / mirror / Atom feed
From: Christian Brauner <brauner@kernel.org>
To: linux-perf-users@vger.kernel.org, linux-fsdevel@vger.kernel.org
Cc: Peter Zijlstra <peterz@infradead.org>,
	Ingo Molnar <mingo@redhat.com>,
	 Arnaldo Carvalho de Melo <acme@kernel.org>,
	Jann Horn <jannh@google.com>,
	 linux-kernel@vger.kernel.org,
	 "Christian Brauner (Amutable)" <brauner@kernel.org>,
	stable@vger.kernel.org
Subject: [PATCH 0/2] exec: two more sleepers in the way of exec
Date: Thu, 26 Nov 2026 12:45:36 +0100	[thread overview]
Message-ID: <20261126-work-exec-update_lock-leftovers-v1-0-1024b26792bc@kernel.org> (raw)

This fixes two more places where a task sleeps on something userspace
controls with a lock held that exec needs:

* PERF_EVENT_IOC_SET_FILTER looks up the files of address filters with
  the mutex of the perf context held and perf_event_exec() takes that
  mutex with exec_update_lock held. With a file like /proc/<pid>/exe the
  lookup takes exec_update_lock itself and deadlocks with exec.

* Without an MMU a read of /proc/<pid>/stat waits for the mmap lock with
  exec_update_lock held.

I don't have a machine with intel_pt at hand. The perf patch was tested
with a hack that gives the task clock address filters.

What's left in that ioctl is that it takes the mmap lock of the task
with the mutex held to find the mappings of the files.

Signed-off-by: Christian Brauner (Amutable) <brauner@kernel.org>
---
Christian Brauner (2):
      perf: look up address filter files without ctx->mutex held
      proc: call task_vsize() without exec_update_lock held

 fs/proc/array.c      | 13 +++++++++++--
 kernel/events/core.c | 36 ++++++++++++++++++++++++++----------
 2 files changed, 37 insertions(+), 12 deletions(-)
---
base-commit: 666539eecdf4db623f5e3c3e55cf9f2dfad24aa4
change-id: 20261125-work-exec-update_lock-leftovers-6778785ed04a


             reply	other threads:[~2026-11-26 11:45 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-26 11:45 Christian Brauner [this message]
2026-11-26 11:45 ` [PATCH 1/2] perf: look up address filter files without ctx->mutex held Christian Brauner
2026-11-26 11:45 ` [PATCH 2/2] proc: call task_vsize() without exec_update_lock held 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=20261126-work-exec-update_lock-leftovers-v1-0-1024b26792bc@kernel.org \
    --to=brauner@kernel.org \
    --cc=acme@kernel.org \
    --cc=jannh@google.com \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-perf-users@vger.kernel.org \
    --cc=mingo@redhat.com \
    --cc=peterz@infradead.org \
    --cc=stable@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