From: Edward Cree <ecree@solarflare.com>
To: Ben Hutchings <ben@decadent.org.uk>, <tglx@linutronix.de>
Cc: <linux-kernel@vger.kernel.org>, <psodagud@codeaurora.org>
Subject: Re: [PATCH] genirq: fix reference leaks on irq affinity notifiers
Date: Tue, 17 Mar 2020 10:58:10 +0000 [thread overview]
Message-ID: <a527a4bb-fdc4-815d-8852-674767b9dd1d@solarflare.com> (raw)
In-Reply-To: <17c4273e4f72ebdf1ca838d75fc6ed93fcdc7287.camel@decadent.org.uk>
On 15/03/2020 20:29, Ben Hutchings wrote:
> ...since the pending work item holds a reference to the notification
> state, it's still not clear to me why or whether "genirq: Prevent use-
> after-free and work list corruption" was needed.
Yeah, I think that commit was bogus. The email thread[1] doesn't
exactly inspire confidence either. I think the submitter just didn't
realise that there was a ref corresponding to the work; AFAICT there's
no way the alleged "work list corruption" could happen.
> If it's reasonable to cancel_work_sync() when removing a notifier, I
> think we can remove the kref and call the release function directly.
I'd prefer to stick to the smaller fix for -rc and stable. But if you
want to remove the kref for -next, I'd be happy to Ack that patch.
Btw, we (sfc linux team) think there's still a use-after-free issue in
the cpu_rmap lib, as follows:
1) irq_cpu_rmap_add creates a glue and notifier, adds glue to rmap->obj
2) someone else does irq_set_affinity_notifier.
This causes cpu_rmap's notifier (old_notify) to get released, and so
irq_cpu_rmap_release kfrees glue. But it's still in rmap->obj
3) free_irq_cpu_rmap loops over obj, finds the glue, tries to clear its
notifier.
Now one could say that this UAF is academic, since having two bits of
code trying to register notifiers for the same IRQ is broken anyway
(in this case, the rmap would stop getting updated, because the
"someone else" stole the notifier).
But I thought I'd bring it up in case it's halfway relevant.
-ed
[1] https://lore.kernel.org/lkml/1553119211-29761-1-git-send-email-psodagud@codeaurora.org/T/#u
next prev parent reply other threads:[~2020-03-17 10:58 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-03-13 20:33 Edward Cree
2020-03-15 20:29 ` Ben Hutchings
2020-03-17 10:58 ` Edward Cree [this message]
2020-03-17 14:56 ` Ben Hutchings
2020-03-17 19:25 ` Thomas Gleixner
2020-03-21 16:38 ` [tip: irq/urgent] genirq: Fix " tip-bot2 for Edward Cree
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=a527a4bb-fdc4-815d-8852-674767b9dd1d@solarflare.com \
--to=ecree@solarflare.com \
--cc=ben@decadent.org.uk \
--cc=linux-kernel@vger.kernel.org \
--cc=psodagud@codeaurora.org \
--cc=tglx@linutronix.de \
/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
all inboxes | Powered by JetHome®