All of lore.kernel.org
 help / color / mirror / Atom feed
* pids_free double free.
@ 2015-11-20  4:18 Dave Jones
  2015-11-20 20:48   ` Tejun Heo
  0 siblings, 1 reply; 3+ messages in thread
From: Dave Jones @ 2015-11-20  4:18 UTC (permalink / raw)
  To: Linux Kernel; +Cc: Tejun Heo

One of my debian boxes got a systemd update. After rebooting,
I started seeing a use-after-free trace, followed by a lockup.

I have two slightly different traces from separate boots,
which may give some clue as to how it's getting free'd in two ways..

http://codemonkey.org.uk/junk/IMG_0474.jpg
http://codemonkey.org.uk/junk/IMG_0476.jpg

This isn't new, I booted back to 4.3, and hit slab debugging warnings
from the same code.  (At the least it was broken differently)

The WARN_ON referenced in the 2nd trace is this..

static void pids_cancel(struct pids_cgroup *pids, int num)
{
        /*  
         * A negative count (or overflow for that matter) is invalid,
         * and indicates a bug in the `pids` controller proper.
         */
        WARN_ON_ONCE(atomic64_add_negative(-num, &pids->counter));
}


	Dave

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: pids_free double free.
@ 2015-11-20 20:48   ` Tejun Heo
  0 siblings, 0 replies; 3+ messages in thread
From: Tejun Heo @ 2015-11-20 20:48 UTC (permalink / raw)
  To: Dave Jones; +Cc: Linux Kernel, cgroups

Hello, Dave.

On Thu, Nov 19, 2015 at 11:18:36PM -0500, Dave Jones wrote:
> One of my debian boxes got a systemd update. After rebooting,
> I started seeing a use-after-free trace, followed by a lockup.
> 
> I have two slightly different traces from separate boots,
> which may give some clue as to how it's getting free'd in two ways..
> 
> http://codemonkey.org.uk/junk/IMG_0474.jpg
> http://codemonkey.org.uk/junk/IMG_0476.jpg
> 
> This isn't new, I booted back to 4.3, and hit slab debugging warnings
> from the same code.  (At the least it was broken differently)
> 
> The WARN_ON referenced in the 2nd trace is this..
> 
> static void pids_cancel(struct pids_cgroup *pids, int num)
> {
>         /*  
>          * A negative count (or overflow for that matter) is invalid,
>          * and indicates a bug in the `pids` controller proper.
>          */
>         WARN_ON_ONCE(atomic64_add_negative(-num, &pids->counter));
> }

I *think* I know what's going on.  Zombies don't pin the css so if the
cgroup gets removed, the free path may end up operating on a css which
has already been freed.  Will look more into it.

Thanks.

-- 
tejun

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: pids_free double free.
@ 2015-11-20 20:48   ` Tejun Heo
  0 siblings, 0 replies; 3+ messages in thread
From: Tejun Heo @ 2015-11-20 20:48 UTC (permalink / raw)
  To: Dave Jones; +Cc: Linux Kernel, cgroups-u79uwXL29TY76Z2rM5mHXA

Hello, Dave.

On Thu, Nov 19, 2015 at 11:18:36PM -0500, Dave Jones wrote:
> One of my debian boxes got a systemd update. After rebooting,
> I started seeing a use-after-free trace, followed by a lockup.
> 
> I have two slightly different traces from separate boots,
> which may give some clue as to how it's getting free'd in two ways..
> 
> http://codemonkey.org.uk/junk/IMG_0474.jpg
> http://codemonkey.org.uk/junk/IMG_0476.jpg
> 
> This isn't new, I booted back to 4.3, and hit slab debugging warnings
> from the same code.  (At the least it was broken differently)
> 
> The WARN_ON referenced in the 2nd trace is this..
> 
> static void pids_cancel(struct pids_cgroup *pids, int num)
> {
>         /*  
>          * A negative count (or overflow for that matter) is invalid,
>          * and indicates a bug in the `pids` controller proper.
>          */
>         WARN_ON_ONCE(atomic64_add_negative(-num, &pids->counter));
> }

I *think* I know what's going on.  Zombies don't pin the css so if the
cgroup gets removed, the free path may end up operating on a css which
has already been freed.  Will look more into it.

Thanks.

-- 
tejun

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2015-11-20 20:48 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-11-20  4:18 pids_free double free Dave Jones
2015-11-20 20:48 ` Tejun Heo
2015-11-20 20:48   ` Tejun Heo

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.