+2020-10-29 Mark Wielaard <mark@klomp.org>
+
+ * asm_align.c (__libasm_ensure_section_space): Use calloc, not
+ malloc to allocate extra space.
+
2020-07-19 Mark Wielaard <mark@klomp.org>
* libasmP.h: Include libebl.h after libasm.h.
/* This is the first block. */
size = MAX (2 * len, 960);
- asmscn->content = (struct AsmData *) malloc (sizeof (struct AsmData)
+ asmscn->content = (struct AsmData *) calloc (1, sizeof (struct AsmData)
+ size);
if (asmscn->content == NULL)
return -1;
size = MAX (2 *len, MIN (32768, 2 * asmscn->offset));
- newp = (struct AsmData *) malloc (sizeof (struct AsmData) + size);
+ newp = (struct AsmData *) calloc (1, sizeof (struct AsmData) + size);
if (newp == NULL)
return -1;
+2020-10-29 Mark Wielaard <mark@klomp.org>
+
+ * test-wrapper.sh: Determine whether the test is a script or not
+ and run binaries directly under valgrind.
+ * dwfl-bug-fd-leak.c (main): Call getrlimit before calling setrlimit.
+ * dwfl-proc-attach.c (main): Call dwfl_end, pthread_cancel and
+ pthread_join.
+ * vdsosyms.c (main): Call dwfl_end.
+
2020-10-30 Frank Ch. Eigler <fche@redhat.com>
PR26775
/* Set locale. */
(void) setlocale (LC_ALL, "");
- struct rlimit fd_limit = { .rlim_cur = 32, .rlim_max = 32 };
+ /* Get both the soft and hard limits first. The soft limit is what
+ will be enforced against the process. The hard limit is the max
+ that can be set for the soft limit. We don't want to lower it
+ because we might not be able to (under valgrind). */
+ struct rlimit fd_limit;
+ if (getrlimit (RLIMIT_NOFILE, &fd_limit) < 0)
+ error (2, errno, "getrlimit");
+ fd_limit.rlim_cur = 32;
if (setrlimit (RLIMIT_NOFILE, &fd_limit) < 0)
error (2, errno, "setrlimit");
if (dwfl_getthreads (dwfl, thread_callback, &threads) != DWARF_CB_OK)
error (-1, 0, "dwfl_getthreads failed: %s", dwfl_errmsg (-1));
+ dwfl_end (dwfl);
+
+ pthread_cancel (thread1);
+ pthread_cancel (thread2);
+ pthread_join (thread1, NULL);
+ pthread_join (thread2, NULL);
+
return (threads == 3) ? 0 : -1;
}
*.sh)
export built_library_path program_transform_name elfutils_testrun
export elfutils_tests_rpath
+ is_shell_script="yes"
;;
*)
if [ $elfutils_testrun = built ]; then
LD_LIBRARY_PATH="${libdir}:${libdir}/elfutils$old_path"
fi
export LD_LIBRARY_PATH
+ is_shell_script="no"
;;
esac
export VALGRIND_CMD
fi
-exec "$@"
+# When it is a run-*.sh script the VALGRIND_CMD will be passed on
+# otherwise we'll need to run the binary explicitly under valgrind.
+if [ "x$is_shell_script" == "xyes" ]; then
+ exec "$@"
+else
+ exec $VALGRIND_CMD "$@"
+fi
if (dwfl_getmodules (dwfl, module_callback, NULL, 0) != 0)
error (1, 0, "dwfl_getmodules: %s", dwfl_errmsg (-1));
+ dwfl_end (dwfl);
+
/* No symbols is ok, then we haven't seen the vdso at all on this arch. */
return vdso_syms >= 0 ? 0 : -1;
}