kern/119129: [libc] __stack_chk_guard setup is bogus in
src/lib/libc/sys/stack_protector.c
Antoine Brodin
antoine.brodin at laposte.net
Sun Dec 30 03:30:03 PST 2007
The following reply was made to PR kern/119129; it has been noted by GNATS.
From: Antoine Brodin <antoine.brodin at laposte.net>
To: bug-followup at FreeBSD.org
Cc:
Subject: Re: kern/119129: [libc] __stack_chk_guard setup is bogus in
src/lib/libc/sys/stack_protector.c
Date: Sun, 30 Dec 2007 12:21:47 +0100
This is a multi-part message in MIME format.
--Multipart=_Sun__30_Dec_2007_12_21_47_+0100_99Kj1udS0jrX1iLD
Content-Type: text/plain; charset=US-ASCII
Content-Transfer-Encoding: 7bit
Here is a patch, tested on i386 only.
I tried to mimic what OpenBSD does.
--Multipart=_Sun__30_Dec_2007_12_21_47_+0100_99Kj1udS0jrX1iLD
Content-Type: text/x-diff;
name="kern_mib.c.diff"
Content-Disposition: attachment;
filename="kern_mib.c.diff"
Content-Transfer-Encoding: 7bit
Index: kern_mib.c
===================================================================
RCS file: /home/ncvs/src/sys/kern/kern_mib.c,v
retrieving revision 1.85
diff -u -p -r1.85 kern_mib.c
--- kern_mib.c 4 Dec 2007 12:28:07 -0000 1.85
+++ kern_mib.c 30 Dec 2007 10:48:44 -0000
@@ -153,14 +153,18 @@ SYSCTL_INT(_hw, HW_PAGESIZE, pagesize, C
static int
sysctl_kern_arnd(SYSCTL_HANDLER_ARGS)
{
- u_long val;
+ char buf[256];
+ size_t len;
- arc4rand(&val, sizeof(val), 0);
- return (sysctl_handle_long(oidp, &val, 0, req));
+ len = req->oldlen;
+ if (len > sizeof(buf))
+ len = sizeof(buf);
+ arc4rand(buf, len, 0);
+ return (SYSCTL_OUT(req, buf, len));
}
-SYSCTL_PROC(_kern, KERN_ARND, arandom, CTLFLAG_RD,
- 0, 0, sysctl_kern_arnd, "L", "arc4rand");
+SYSCTL_PROC(_kern, KERN_ARND, arandom, CTLTYPE_OPAQUE | CTLFLAG_RD,
+ NULL, 0, sysctl_kern_arnd, "", "arc4rand");
static int
sysctl_hw_physmem(SYSCTL_HANDLER_ARGS)
--Multipart=_Sun__30_Dec_2007_12_21_47_+0100_99Kj1udS0jrX1iLD--
More information about the freebsd-bugs
mailing list