All of lore.kernel.org
 help / color / mirror / Atom feed
From: Benjamin Marzinski <bmarzins@redhat.com>
To: Martin Wilck <mwilck@suse.com>
Cc: dm-devel@redhat.com
Subject: Re: [dm-devel] [RFC PATCH] libmultipath: prevent DSO unloading with astray checker threads
Date: Tue, 24 Nov 2020 14:33:39 -0600	[thread overview]
Message-ID: <20201124203339.GD3103@octiron.msp.redhat.com> (raw)
In-Reply-To: <39c3227eb6fc8c9edb0f8927b180005e5b4ff445.camel@suse.com>

On Fri, Nov 06, 2020 at 06:32:16PM +0100, Martin Wilck wrote:
> On Thu, 2020-11-05 at 18:41 -0600, Benjamin Marzinski wrote:
> > 
> > I can't make this segfault. So that looks good, but it does need
> > libmultipath.version updated to include checker_thread_entry()
> 
> Great news, thanks. Well the library version stuff hasn't been
> committed yet anyway, this was against Christophe's current base.

Actually, I ran into a different segfault with this patch.

While the tur checker's libcheck_check() function is run under locking,
so the device cannot be removed, The thread it creates is not. This
means that it is possible for the device to get removed after
libcheck_check() runs, but before checker_thread_entry() runs. In this
case, when checker_thread_entry() is finally run, the passed in checker
structure would already have been freed, causing a segfault.  I have
been able to easily reproduce this in the case where multipath device
creation failed in the kernel.

I'm pretty sure that the checker class needs its ref count increased
before the thread is created, and the thread inself must only access the
context, which should include a pointer to the class.

-Ben

> 
> @Christophe, any chance to move forward with the merge?
> (then we can go ahead with this patch later, too...)
> 
> Martin
> 

--
dm-devel mailing list
dm-devel@redhat.com
https://www.redhat.com/mailman/listinfo/dm-devel


  parent reply	other threads:[~2020-11-24 20:33 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-11-05 11:49 [dm-devel] [RFC PATCH] libmultipath: prevent DSO unloading with astray checker threads mwilck
2020-11-06  0:41 ` Benjamin Marzinski
2020-11-06 17:32   ` Martin Wilck
2020-11-08  0:06     ` Xose Vazquez Perez
2020-11-24 20:33     ` Benjamin Marzinski [this message]
2020-11-24 20:59       ` Martin Wilck

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=20201124203339.GD3103@octiron.msp.redhat.com \
    --to=bmarzins@redhat.com \
    --cc=dm-devel@redhat.com \
    --cc=mwilck@suse.com \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.