BUG in tty_open when using containers and ptrace

Grzegorz Nosek root at localdomain.pl
Sat Jul 11 13:01:33 PDT 2009

On Sat, Jul 11, 2009 at 09:30:55PM +0200, Grzegorz Nosek wrote:
> With the following (whitespace-damaged etc.) patch applied I can no longer
> oops the kernel but there are several issues:
> 1. A warning occurs (after several dozen start/shutdown cycles):
> Warning: dev (pts0) tty->count(2) != #fd's(1) in tty_release_dev
> So refcounting is still broken and this patch possibly just papers over
> the real bug.
> 2. There's a memory leak somewhere (don't know if it was there before as
> the system hadn't survived long enough to test that) guesstimated at
> several KB per container cycle; building with kmemleak to see what
> happens.
> 3. After adding tons of debug statements I saw that the TTY objects
> weren't always freed immediately after container shutdown but were
> somehow batched (e.g. a single container shut down would cause two or
> three previous containers' tty objects to be freed). Increasing the
> delay between subsequent cycles from 3 to 10 seconds didn't seem to
> affect the batching. On an otherwise unpatched kernel, the crashes
> happened right after the 'batched' cleanups.

Talking to myself (again), kmemleak doesn't report anything (apart from
a few unrelated early-init warnings) but running the startup/shutdown loop
on tty1 causes totally crazy behaviour on every VT I used. By "totally
crazy" I mean not responding properly to arrow keys, backspace etc., but
printing stuff like ^[B for arrows and a dot for backspace. Note: this
happened _most_ of the time but not _all_ (navigating shell history was
fun). Even the shell started to misbehave as I tried to execute:
echo 3 > drop_caches
and the shell helpfully said:
3 > drop_caches

Any ideas, anyone?

Best regards,
 Grzegorz Nosek

More information about the Containers mailing list