[Bug 239493] signal SIGABRT in .__sys_thr_kill () from /lib/libc.so.7 on r350103 ppc64

bugzilla-noreply at freebsd.org bugzilla-noreply at freebsd.org
Sun Jul 28 16:54:10 UTC 2019


https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=239493

--- Comment #3 from Conrad Meyer <cem at freebsd.org> ---
In fact, a similar issue was discussed on a 2017 GMP thread.[1]

The problematic aspect is:

(In reply to Dennis Clarke from comment #0)
> int main () {
>   unsigned long *r, *r2;
> ...
>   r = malloc (10000 * sizeof (unsigned long));
>...
>   if (r[2048] != 0 || r[2049] != 0 || r[2050] != 0 || r[2051] != 0 ||
>       r[2052] != 0 || r[2053] != 0 || r[2054] != 0)
>     abort ();

malloc() does not guarantee allocated memory is zero.  A better test is to use
memset(r, 0, ....) or calloc() in place of malloc().  The GMP thread provided
this solution as well.

[1]: https://gmplib.org/list-archives/gmp-devel/2017-January/004517.html

-- 
You are receiving this mail because:
You are the assignee for the bug.


More information about the freebsd-bugs mailing list