Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 24 Sep 2014 20:24:41 -0500
From:      Bryan Drewery <bdrewery@FreeBSD.org>
To:        current@FreeBSD.org
Subject:   memguard(9) panics in proc_reap with vm.memguard.options=3
Message-ID:  <54236ED9.5040005@FreeBSD.org>

index | next in thread | raw e-mail

[-- Attachment #1 --]
> #11 0xffffffff80976e12 in vmem_xfree (vm=0xffffffff816d2200, addr=18446741889258000384, size=0) at /usr/src/sys/kern/subr_vmem.c:1237
> #12 0xffffffff80bafbe0 in memguard_free (ptr=<value optimized out>) at /usr/src/sys/vm/memguard.c:421
> #13 0xffffffff80904191 in free (addr=0xfffffe03648a9000, mtp=<value optimized out>) at /usr/src/sys/kern/kern_malloc.c:554
> #14 0xffffffff808e733f in proc_reap (td=<value optimized out>, p=0xfffff80bf043c000, status=<value optimized out>, options=<value optimized out>) at /usr/src/sys/kern/kern_exit.c:882
> #15 0xffffffff808e784a in proc_to_reap (td=0xfffff8021d499000, p=0xfffff80bf043c000, idtype=<value optimized out>, id=<value optimized out>, status=0xfffffe35559bc914, options=55,

The assert is "size > 0".

I enabled vm.memguard.options=3 while the system was running. From
reading is_memguard_addr() I assume it should be safe to do so. Only new
allocations should be passed through memguard_free().  This panic seems
to happen easily.

This comment in sys/vm/memguard.c memguard_free() makes me think
something is stale:

> /*
>  * This requires carnal knowledge of the implementation of
>  * kmem_free(), but since we've already replaced kmem_malloc()
>  * above, it's not really any worse.  We want to use the
>  * vm_map lock to serialize updates to memguard_wasted, since
>  * we had the lock at increment.
>  */
> kmem_unback(kmem_object, addr, size);
> if (sizev > size)
>         addr -= PAGE_SIZE;
> vmem_xfree(memguard_arena, addr, sizev);

By the way, I can't get the kernel to even boot with
vm.memguard.options=3. It panics very early in device probing IIRC.

-- 
Regards,
Bryan Drewery


[-- Attachment #2 --]
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.10 (MingW32)

iQEcBAEBAgAGBQJUI27ZAAoJEDXXcbtuRpfP02MH+wTIaIYWKq5ZgmDH4coZgJAQ
oJLyskOl9Im97CHakXrE2whcrLvTtEtSr8bhWPVKmuSGZLTZsevgAt4d1UEhzJA/
86WjHgNJmRJWQzdUidvpxlKJFCmmuwUgxBKMq0sa8TlNfrq2NcX1+zGXX4TZYaM7
7hQY91xUmQldYZ9UoJJ6T1mB/63/ZKAV+jqaw8mwhlyEsU7XZDcZ828k7/ipIZdx
42HzKYh8SsI3nWraTqMGvYLjV6sZu7AR+F90ftSnCn1l+GMFBFaSwr16JYnea4I2
HXE0KGx8KEXxSL27rJkqa3oenwqAhBlGRZ/C4FQwjvYVqbd7fIjA/qa3dqbxcUc=
=an3J
-----END PGP SIGNATURE-----
home | help

Want to link to this message? Use this
URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?54236ED9.5040005>