From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on dcvr.yhbt.net X-Spam-Level: X-Spam-ASN: AS17314 8.43.84.0/22 X-Spam-Status: No, score=-4.2 required=3.0 tests=AWL,BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,MAILING_LIST_MULTI, RCVD_IN_DNSWL_HI,SPF_HELO_PASS,SPF_PASS shortcircuit=no autolearn=ham autolearn_force=no version=3.4.2 Received: from sourceware.org (server2.sourceware.org [8.43.85.97]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by dcvr.yhbt.net (Postfix) with ESMTPS id 57EB31F8C6 for ; Fri, 2 Jul 2021 02:38:06 +0000 (UTC) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 6433B397302D for ; Fri, 2 Jul 2021 02:38:05 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 6433B397302D DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1625193485; bh=B4EuaGMnVIx5sfF5Zid+tBAoWQ5vm9UjK5unhBTh09I=; h=To:Subject:Date:In-Reply-To:References:List-Id:List-Unsubscribe: List-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To:Cc: From; b=nW14v74bqaeqDEfXbvoabE1wB+cLXAZbs1dj7C/53+J/ZkorWvU1Q50g+CfGLfCmv u98x9rlnwpKbSV5yEvZKJ1CNufYpgGOd7X36rwM9gkkeQVAbDMsT+0NcuJIkWFV3so mjenxtvOabzC3Dfb7XmEV89Wx0hQosPDD9tHFh6M= Received: from butterfly.birch.relay.mailchannels.net (butterfly.birch.relay.mailchannels.net [23.83.209.27]) by sourceware.org (Postfix) with ESMTPS id B53553973016 for ; Fri, 2 Jul 2021 02:36:18 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org B53553973016 X-Sender-Id: dreamhost|x-authsender|siddhesh@gotplt.org Received: from relay.mailchannels.net (localhost [127.0.0.1]) by relay.mailchannels.net (Postfix) with ESMTP id 7E4634825CB; Fri, 2 Jul 2021 02:36:17 +0000 (UTC) Received: from pdx1-sub0-mail-a42.g.dreamhost.com (100-101-162-64.trex.outbound.svc.cluster.local [100.101.162.64]) (Authenticated sender: dreamhost) by relay.mailchannels.net (Postfix) with ESMTPA id 87C6948258E; Fri, 2 Jul 2021 02:36:16 +0000 (UTC) X-Sender-Id: dreamhost|x-authsender|siddhesh@gotplt.org Received: from pdx1-sub0-mail-a42.g.dreamhost.com (pop.dreamhost.com [64.90.62.162]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384) by 100.101.162.64 (trex/6.3.3); Fri, 02 Jul 2021 02:36:17 +0000 X-MC-Relay: Neutral X-MailChannels-SenderId: dreamhost|x-authsender|siddhesh@gotplt.org X-MailChannels-Auth-Id: dreamhost X-Absorbed-Lonely: 715fba3606cea5c3_1625193377277_1926935416 X-MC-Loop-Signature: 1625193377277:1347949744 X-MC-Ingress-Time: 1625193377277 Received: from pdx1-sub0-mail-a42.g.dreamhost.com (localhost [127.0.0.1]) by pdx1-sub0-mail-a42.g.dreamhost.com (Postfix) with ESMTP id 8E25A897E3; Fri, 2 Jul 2021 02:36:14 +0000 (UTC) Received: from rhbox.intra.reserved-bit.com (unknown [1.186.101.110]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) (Authenticated sender: siddhesh@gotplt.org) by pdx1-sub0-mail-a42.g.dreamhost.com (Postfix) with ESMTPSA id 4AEAD897E4; Fri, 2 Jul 2021 02:36:10 +0000 (UTC) X-DH-BACKEND: pdx1-sub0-mail-a42 To: libc-alpha@sourceware.org Subject: [PATCH v3 02/10] Add mcheck tests to malloc Date: Fri, 2 Jul 2021 08:05:38 +0530 Message-Id: <20210702023546.3081774-3-siddhesh@sourceware.org> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210702023546.3081774-1-siddhesh@sourceware.org> References: <20210702023546.3081774-1-siddhesh@sourceware.org> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-BeenThere: libc-alpha@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Libc-alpha mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , From: Siddhesh Poyarekar via Libc-alpha Reply-To: Siddhesh Poyarekar Cc: fweimer@redhat.com Errors-To: libc-alpha-bounces+e=80x24.org@sourceware.org Sender: "Libc-alpha" Like malloc-check, add generic rules to run all tests in malloc by linking with libmcheck.a so as to provide coverage for mcheck(). Currently the following 12 tests fail: FAIL: malloc/tst-malloc-backtrace-mcheck FAIL: malloc/tst-malloc-fork-deadlock-mcheck FAIL: malloc/tst-malloc-stats-cancellation-mcheck FAIL: malloc/tst-malloc-tcache-leak-mcheck FAIL: malloc/tst-malloc-thread-exit-mcheck FAIL: malloc/tst-malloc-thread-fail-mcheck FAIL: malloc/tst-malloc-usable-static-mcheck FAIL: malloc/tst-malloc-usable-static-tunables-mcheck FAIL: malloc/tst-malloc-usable-tunables-mcheck FAIL: malloc/tst-malloc_info-mcheck FAIL: malloc/tst-memalign-mcheck FAIL: malloc/tst-posix_memalign-mcheck and they have been added to tests-exclude-mcheck for now to keep status quo. At least the last two can be attributed to bugs in mcheck() but I haven't fixed them here since they should be fixed by removing malloc hooks. Others need to be triaged to check if they're due to mcheck bugs or due to actual bugs. Reviewed-by: DJ Delorie --- Rules | 15 ++++++++++++++- malloc/Makefile | 35 +++++++++++++++++++++++++++++++++++ 2 files changed, 49 insertions(+), 1 deletion(-) diff --git a/Rules b/Rules index c6b635c3f7..ba13598df6 100644 --- a/Rules +++ b/Rules @@ -155,6 +155,7 @@ xtests: tests $(xtests-special) else tests: $(tests:%=3D$(objpfx)%.out) $(tests-internal:%=3D$(objpfx)%.out) = \ $(tests-container:%=3D$(objpfx)%.out) \ + $(tests-mcheck:%=3D$(objpfx)%-mcheck.out) \ $(tests-malloc-check:%=3D$(objpfx)%-malloc-check.out) \ $(tests-special) $(tests-printers-out) xtests: tests $(xtests:%=3D$(objpfx)%.out) $(xtests-special) @@ -166,7 +167,8 @@ ifeq ($(run-built-tests),no) tests-expected =3D else tests-expected =3D $(tests) $(tests-internal) $(tests-printers) \ - $(tests-container) $(tests-malloc-check:%=3D%-malloc-check) + $(tests-container) $(tests-malloc-check:%=3D%-malloc-check) \ + $(tests-mcheck:%=3D%-mcheck) endif tests: $(..)scripts/merge-test-results.sh -s $(objpfx) $(subdir) \ @@ -192,6 +194,7 @@ else binaries-pie-tests =3D binaries-pie-notests =3D endif +binaries-mcheck-tests =3D $(tests-mcheck:%=3D%-mcheck) binaries-malloc-check-tests =3D $(tests-malloc-check:%=3D%-malloc-check) else binaries-all-notests =3D @@ -202,6 +205,7 @@ binaries-static-tests =3D binaries-static =3D binaries-pie-tests =3D binaries-pie-notests =3D +binaries-mcheck-tests =3D binaries-malloc-check-tests =3D endif =20 @@ -226,6 +230,15 @@ $(addprefix $(objpfx),$(binaries-shared-tests)): %: = %.o \ $(+link-tests) endif =20 +ifneq "$(strip $(binaries-mcheck-tests))" "" +$(addprefix $(objpfx),$(binaries-mcheck-tests)): %-mcheck: %.o \ + $(link-extra-libs-tests) \ + $(sort $(filter $(common-objpfx)lib%,$(link-libc))) \ + $(common-objpfx)malloc/libmcheck.a \ + $(addprefix $(csu-objpfx),start.o) $(+preinit) $(+postinit) + $(+link-tests) +endif + ifneq "$(strip $(binaries-malloc-check-tests))" "" $(addprefix $(objpfx),$(binaries-malloc-check-tests)): %-malloc-check: %= .o \ $(link-extra-libs-tests) \ diff --git a/malloc/Makefile b/malloc/Makefile index 9bc2e50a9a..c8256abbbf 100644 --- a/malloc/Makefile +++ b/malloc/Makefile @@ -77,6 +77,26 @@ tests-exclude-malloc-check =3D tst-malloc-check tst-ma= lloc-usable \ # Run all tests with MALLOC_CHECK_=3D3 tests-malloc-check =3D $(filter-out $(tests-exclude-malloc-check),$(test= s)) =20 +# Tests that don't play well with mcheck. They are either bugs in mchec= k or +# the tests expect specific internal behavior that is changed due to lin= king to +# libmcheck.a. +tests-exclude-mcheck =3D tst-mallocstate \ + tst-safe-linking tst-malloc-usable \ + tst-malloc-backtrace \ + tst-malloc-fork-deadlock \ + tst-malloc-stats-cancellation \ + tst-malloc-tcache-leak \ + tst-malloc-thread-exit \ + tst-malloc-thread-fail \ + tst-malloc-usable-static \ + tst-malloc-usable-static-tunables \ + tst-malloc-usable-tunables \ + tst-malloc_info \ + tst-memalign \ + tst-posix_memalign + +tests-mcheck =3D $(filter-out $(tests-exclude-mcheck), $(tests)) + routines =3D malloc morecore mcheck mtrace obstack reallocarray \ scratch_buffer_dupfree \ scratch_buffer_grow scratch_buffer_grow_preserve \ @@ -118,6 +138,11 @@ $(objpfx)tst-mallocfork3: $(shared-thread-library) $(objpfx)tst-mallocfork3-mcheck: $(shared-thread-library) $(objpfx)tst-malloc-fork-deadlock: $(shared-thread-library) $(objpfx)tst-malloc-stats-cancellation: $(shared-thread-library) +$(objpfx)tst-malloc-backtrace-mcheck: $(shared-thread-library) +$(objpfx)tst-malloc-thread-exit-mcheck: $(shared-thread-library) +$(objpfx)tst-malloc-thread-fail-mcheck: $(shared-thread-library) +$(objpfx)tst-malloc-fork-deadlock-mcheck: $(shared-thread-library) +$(objpfx)tst-malloc-stats-cancellation-mcheck: $(shared-thread-library) $(objpfx)tst-malloc-backtrace-malloc-check: $(shared-thread-library) $(objpfx)tst-malloc-thread-exit-malloc-check: $(shared-thread-library) $(objpfx)tst-malloc-thread-fail-malloc-check: $(shared-thread-library) @@ -253,17 +278,24 @@ $(foreach o,$(all-object-suffixes),$(objpfx)malloc$= (o)): arena.c hooks.c $(tests:%=3D$(objpfx)%.o): CPPFLAGS +=3D -DTEST_NO_MALLOPT =20 $(objpfx)tst-interpose-nothread: $(objpfx)tst-interpose-aux-nothread.o +$(objpfx)tst-interpose-nothread-mcheck: $(objpfx)tst-interpose-aux-nothr= ead.o $(objpfx)tst-interpose-nothread-malloc-check: \ $(objpfx)tst-interpose-aux-nothread.o $(objpfx)tst-interpose-thread: \ $(objpfx)tst-interpose-aux-thread.o $(shared-thread-library) +$(objpfx)tst-interpose-thread-mcheck: \ + $(objpfx)tst-interpose-aux-thread.o $(shared-thread-library) $(objpfx)tst-interpose-thread-malloc-check: \ $(objpfx)tst-interpose-aux-thread.o $(shared-thread-library) $(objpfx)tst-interpose-static-nothread: $(objpfx)tst-interpose-aux-nothr= ead.o +$(objpfx)tst-interpose-static-nothread-mcheck: \ + $(objpfx)tst-interpose-aux-nothread.o $(objpfx)tst-interpose-static-nothread-malloc-check: \ $(objpfx)tst-interpose-aux-nothread.o $(objpfx)tst-interpose-static-thread: \ $(objpfx)tst-interpose-aux-thread.o $(static-thread-library) +$(objpfx)tst-interpose-static-thread-mcheck: \ + $(objpfx)tst-interpose-aux-thread.o $(static-thread-library) $(objpfx)tst-interpose-static-thread-malloc-check: \ $(objpfx)tst-interpose-aux-thread.o $(static-thread-library) =20 @@ -280,6 +312,9 @@ $(objpfx)tst-dynarray-fail-mem.out: $(objpfx)tst-dyna= rray-fail.out $(objpfx)tst-malloc-tcache-leak: $(shared-thread-library) $(objpfx)tst-malloc_info: $(shared-thread-library) $(objpfx)tst-mallocfork2: $(shared-thread-library) +$(objpfx)tst-malloc-tcache-leak-mcheck: $(shared-thread-library) +$(objpfx)tst-malloc_info-mcheck: $(shared-thread-library) +$(objpfx)tst-mallocfork2-mcheck: $(shared-thread-library) $(objpfx)tst-malloc-tcache-leak-malloc-check: $(shared-thread-library) $(objpfx)tst-malloc_info-malloc-check: $(shared-thread-library) $(objpfx)tst-mallocfork2-malloc-check: $(shared-thread-library) --=20 2.31.1