Subject: kern/6987: ktrace writes partially uninitialized data to file
To: None <gnats-bugs@gnats.netbsd.org>
From: None <arnej@math.ntnu.no>
List: netbsd-bugs
Date: 02/11/1999 17:05:29
>Number: 6987
>Category: kern
>Synopsis: ktrace writes partially uninitialized data to file
>Confidential: no
>Severity: non-critical
>Priority: low
>Responsible: kern-bug-people (Kernel Bug People)
>State: open
>Class: sw-bug
>Submitter-Id: net
>Arrival-Date: Thu Feb 11 08:20:01 1999
>Last-Modified:
>Originator: Arne H. Juul
>Organization:
Norwegian University of Technology and Science
>Release: NetBSD-current as of Thu Feb 11 16:56:26 CET 1999
>Environment:
System: NetBSD leon.math.ntnu.no 1.3I NetBSD 1.3I (LEON) #0: Sat Jan 2 16:31:23 PST 1999 arnej@leon.math.ntnu.no:/usr/src/sys/arch/i386/compile/LEON i386
>Description:
When a process request kernel tracing, the kernel allocates
memory with MALLOC, then writes it to the requested file after
filling it with data. However, if some of the fields are not
completely filled they will contain random uninitialized junk.
This isn't a problem in practice, but still the buffers
should be initialized IMHO.
>How-To-Repeat:
Inspect code and ktrace.out file.
>Fix:
This patch only fixes the ktr_header struct, where I see this
effect clearly. I'm unsure whether all the other MALLOCs in kern_ktrace
need a following memset also.
--- kern_ktrace.c.orig Sat Sep 12 13:10:51 1998
+++ kern_ktrace.c Thu Feb 11 14:37:19 1999
@@ -103,6 +103,7 @@
MALLOC(kth, struct ktr_header *, sizeof(struct ktr_header),
M_TEMP, M_WAITOK);
+ memset(kth, 0, sizeof(struct ktr_header));
kth->ktr_type = type;
microtime(&kth->ktr_time);
kth->ktr_pid = p->p_pid;
>Audit-Trail:
>Unformatted: