public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Borislav Petkov <bp@alien8.de>
To: Ravi Bangoria <ravi.bangoria@amd.com>
Cc: Peter Zijlstra <peterz@infradead.org>,
	nslusarek@gmx.net, Linus Torvalds <torvalds@linux-foundation.org>,
	x86@kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] perf: Fix sys_perf_event_open() race against self
Date: Wed, 16 Nov 2022 23:30:50 +0100	[thread overview]
Message-ID: <Y3Vkmvi2vib7fwHn@zn.tnic> (raw)
In-Reply-To: <700710fc-1ac1-1b39-0e63-eb86adb4b984@amd.com>

On Mon, May 23, 2022 at 04:03:29PM +0530, Ravi Bangoria wrote:
> On 21-May-22 12:08 AM, Peter Zijlstra wrote:
> > 
> > Norbert reported that it's possible to race sys_perf_event_open() such
> > that the looser ends up in another context from the group leader,
> > triggering many WARNs.
> > 
> > The move_group case checks for races against itself, but the
> > !move_group case doesn't, seemingly relying on the previous
> > group_leader->ctx == ctx check. However, that check is racy due to not
> > holding any locks at that time.
> > 
> > Therefore, re-check the result after acquiring locks and bailing
> > if they no longer match.
> > 
> > Additionally, clarify the not_move_group case from the
> > move_group-vs-move_group race.
> 
> Tested-by: Ravi Bangoria <ravi.bangoria@amd.com>
> 
> Below is a quick test to reproduce the issue. It triggers WARN_ON()
> as normal user. No warnings with the patch.

Shouldn't this test be in tools/perf/tests/ or so?

If that hasn't happened yet, I mean.

Thx.

-- 
Regards/Gruss,
    Boris.

https://people.kernel.org/tglx/notes-about-netiquette

  reply	other threads:[~2022-11-16 22:31 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-05-20 18:38 [PATCH] perf: Fix sys_perf_event_open() race against self Peter Zijlstra
2022-05-23 10:33 ` Ravi Bangoria
2022-11-16 22:30   ` Borislav Petkov [this message]
2022-11-17 10:33     ` Ravi Bangoria
2022-11-17 10:40       ` Borislav Petkov
2022-11-17 10:59         ` Ravi Bangoria
2022-11-17 11:59           ` Borislav Petkov
2022-11-17 13:38             ` Ravi Bangoria
2022-05-23 10:48 ` Mark Rutland

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=Y3Vkmvi2vib7fwHn@zn.tnic \
    --to=bp@alien8.de \
    --cc=linux-kernel@vger.kernel.org \
    --cc=nslusarek@gmx.net \
    --cc=peterz@infradead.org \
    --cc=ravi.bangoria@amd.com \
    --cc=torvalds@linux-foundation.org \
    --cc=x86@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