svn commit: r273487 - head/sys/kern
Jean-Sébastien Pédron
dumbbell at FreeBSD.org
Thu Oct 23 12:50:07 UTC 2014
Hi!
The following change triggers a kernel trap 12 when env is NULL:
> @@ -260,8 +262,10 @@ void
> freeenv(char *env)
> {
>
> - if (dynamic_kenv)
> + if (dynamic_kenv) {
> + memset(env, 0, strlen(env));
> free(env, M_KENV);
> + }
> }
This happens very early in boot for me, just after the lines:
WARNING: WITNESS option enabled, expect reduced performance.
VT: running with driver "vga".
The attached simple patch fixes the problem.
What I don't know is if the same problem can occur in kern_unsetenv():
> @@ -437,6 +441,7 @@ kern_unsetenv(const char *name)
> kenvp[i++] = kenvp[j];
> kenvp[i] = NULL;
> mtx_unlock(&kenv_lock);
> + memset(oldenv, 0, strlen(oldenv));
> free(oldenv, M_KENV);
> return (0);
> }
--
Jean-Sébastien Pédron
-------------- next part --------------
A non-text attachment was scrubbed...
Name: kern_freeenv-trap12.patch
Type: text/x-patch
Size: 362 bytes
Desc: not available
URL: <http://lists.freebsd.org/pipermail/svn-src-all/attachments/20141023/9d04acb2/attachment.bin>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 949 bytes
Desc: OpenPGP digital signature
URL: <http://lists.freebsd.org/pipermail/svn-src-all/attachments/20141023/9d04acb2/attachment.sig>
More information about the svn-src-all
mailing list