[erlang-questions] R13B01: erts_cpu_info_update() "int mib;" + sysctl call trashes stack
Tue Jul 28 18:00:04 CEST 2009
Michael Turner writes:
> I'm trying to build R13B01. I was getting seg faults on erlexec.
> Bringing it up in gdb just gave me "No stack."
> Hours (and *hours*) later: I've traced it to the following in
> int mib;
> size_t len;
> Yes, that's legal (according to gcc, anyway). Even useful for some
> In this context, however, it should be "int mib;" The problem is
> that there are assignments to mib and mib immediately following,
> clobbering some context.
> So, uh . . . this is the questions list, so I have a question after all:
> where do I report this as a bug? And suggest this fix? And all that?
> I'm pretty new to this.
On what platform does this code get compiled? I would have expected
recent GCCs to complain about the out-of-bounds indexing, but perhaps
it doesn't get compiled on Linux.
Anyway, you have indeed found a real bug. The code in question is
Proper bug reporting procedure is to send an email to the erlang-bugs
mailing list, together with Erlang version information, platform information
(in case the bug is platform specific), and whatever analysis you've done
or test cases you've written. Suggested code changes should be in `patch -p1'
form as produced by `diff -up` or its equivalent. For this particular case,
it should look as follows:
--- otp_src_R13B01/erts/lib_src/common/erl_misc_utils.c.~1~ 2009-06-05 14:53:41.000000000 +0200
+++ otp_src_R13B01/erts/lib_src/common/erl_misc_utils.c 2009-07-28 17:53:03.000000000 +0200
@@ -172,7 +172,7 @@ erts_cpu_info_update(erts_cpu_info_t *cp
#elif defined(HAVE_SYS_SYSCTL_H) && defined(CTL_HW) && (defined(HW_NCPU) \
- int mib;
+ int mib;
More information about the erlang-questions