Skip to contentSkip to conversation

pids_free double free.

DISCUSSION Dave Jones 2 participants 2 messages Nov 20, 2015 cgroup

lore
Share & tools
lore

Dave Jones

author
#0 lore raw

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

maintainer
#1 lore raw

Hello, Dave.

Quoted 14 lines · Dave Jones

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..

Quoted 8 lines

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.

Signature · 1 line
tejun