From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from purple.birch.relay.mailchannels.net (purple.birch.relay.mailchannels.net [23.83.209.150]) by sourceware.org (Postfix) with ESMTPS id E3C45394FC1D for ; Mon, 28 Jun 2021 08:39:52 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org E3C45394FC1D Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=gotplt.org Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=gotplt.org 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 9C4BA8414AC for ; Mon, 28 Jun 2021 08:39:48 +0000 (UTC) Received: from pdx1-sub0-mail-a39.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 9257484117F for ; Mon, 28 Jun 2021 08:39:46 +0000 (UTC) X-Sender-Id: dreamhost|x-authsender|siddhesh@gotplt.org Received: from pdx1-sub0-mail-a39.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); Mon, 28 Jun 2021 08:39:48 +0000 X-MC-Relay: Neutral X-MailChannels-SenderId: dreamhost|x-authsender|siddhesh@gotplt.org X-MailChannels-Auth-Id: dreamhost X-Eyes-White: 665d5d962503c9bd_1624869586847_1580332049 X-MC-Loop-Signature: 1624869586847:3488047163 X-MC-Ingress-Time: 1624869586846 Received: from pdx1-sub0-mail-a39.g.dreamhost.com (localhost [127.0.0.1]) by pdx1-sub0-mail-a39.g.dreamhost.com (Postfix) with ESMTP id 560747F42E for ; Mon, 28 Jun 2021 01:39:46 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=gotplt.org; h=subject:to :references:from:message-id:date:mime-version:in-reply-to :content-type:content-transfer-encoding; s=gotplt.org; bh=88q/j2 AZoOrcVAraQRl0I8Ofb+Y=; b=UskFgsmb9X9Xu/frUQq6dsJmPuyVs/q1YdaRuB bdNNzEG93nWcoCfWRbJC6YDv/vwMf98PLl77FlJnue1sDxQLZNgA6irorrriX6HX zYFZlQUbk2ETMuYUGqLLw9MJYG4+976On5TPnapEyka+VD6xm5Hw8Wh2cQCFC0IU 8yOr4= Received: from [192.168.1.136] (unknown [1.186.101.110]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) (Authenticated sender: siddhesh@gotplt.org) by pdx1-sub0-mail-a39.g.dreamhost.com (Postfix) with ESMTPSA id C0B3F7EE56 for ; Mon, 28 Jun 2021 01:39:45 -0700 (PDT) Subject: [PING][PATCH] Add mcheck tests to malloc To: libc-alpha@sourceware.org References: <20210622130746.761980-1-siddhesh@sourceware.org> X-DH-BACKEND: pdx1-sub0-mail-a39 From: Siddhesh Poyarekar Message-ID: <020ac9cd-223a-49aa-7950-52e28a7c55ea@gotplt.org> Date: Mon, 28 Jun 2021 14:09:39 +0530 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.10.1 MIME-Version: 1.0 In-Reply-To: <20210622130746.761980-1-siddhesh@sourceware.org> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-3037.4 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, RCVD_IN_BARRACUDACENTRAL, RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H2, SPF_HELO_NONE, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.2 X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on server2.sourceware.org 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: , X-List-Received-Date: Mon, 28 Jun 2021 08:39:57 -0000 On 6/22/21 6:37 PM, Siddhesh Poyarekar via Libc-alpha wrote: > 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. > --- > > This patch relies on the refactoring in: > https://patchwork.sourceware.org/project/glibc/patch/20210622102013.2807141-1-siddhesh@sourceware.org/ > > 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:%=$(objpfx)%.out) $(tests-internal:%=$(objpfx)%.out) \ > $(tests-container:%=$(objpfx)%.out) \ > + $(tests-mcheck:%=$(objpfx)%-mcheck.out) \ > $(tests-malloc-check:%=$(objpfx)%-malloc-check.out) \ > $(tests-special) $(tests-printers-out) > xtests: tests $(xtests:%=$(objpfx)%.out) $(xtests-special) > @@ -166,7 +167,8 @@ ifeq ($(run-built-tests),no) > tests-expected = > else > tests-expected = $(tests) $(tests-internal) $(tests-printers) \ > - $(tests-container) $(tests-malloc-check:%=%-malloc-check) > + $(tests-container) $(tests-malloc-check:%=%-malloc-check) \ > + $(tests-mcheck:%=%-mcheck) > endif > tests: > $(..)scripts/merge-test-results.sh -s $(objpfx) $(subdir) \ > @@ -192,6 +194,7 @@ else > binaries-pie-tests = > binaries-pie-notests = > endif > +binaries-mcheck-tests = $(tests-mcheck:%=%-mcheck) > binaries-malloc-check-tests = $(tests-malloc-check:%=%-malloc-check) > else > binaries-all-notests = > @@ -202,6 +205,7 @@ binaries-static-tests = > binaries-static = > binaries-pie-tests = > binaries-pie-notests = > +binaries-mcheck-tests = > binaries-malloc-check-tests = > endif > > @@ -226,6 +230,15 @@ $(addprefix $(objpfx),$(binaries-shared-tests)): %: %.o \ > $(+link-tests) > endif > > +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 3162301fba..fd7f399250 100644 > --- a/malloc/Makefile > +++ b/malloc/Makefile > @@ -76,6 +76,26 @@ tests-exclude-malloc-check = tst-malloc-check tst-malloc-usable \ > # Run all tests with MALLOC_CHECK_=3 > tests-malloc-check = $(filter-out $(tests-exclude-malloc-check),$(tests)) > > +# Tests that don't play well with mcheck. They are either bugs in mcheck or > +# the tests expect specific internal behavior that is changed due to linking to > +# libmcheck.a. > +tests-exclude-mcheck = 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 = $(filter-out $(tests-exclude-mcheck), $(tests)) > + > routines = malloc morecore mcheck mtrace obstack reallocarray \ > scratch_buffer_dupfree \ > scratch_buffer_grow scratch_buffer_grow_preserve \ > @@ -115,6 +135,11 @@ $(objpfx)tst-malloc-thread-exit: $(shared-thread-library) > $(objpfx)tst-malloc-thread-fail: $(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) > @@ -250,17 +275,24 @@ $(foreach o,$(all-object-suffixes),$(objpfx)malloc$(o)): arena.c hooks.c > $(tests:%=$(objpfx)%.o): CPPFLAGS += -DTEST_NO_MALLOPT > > $(objpfx)tst-interpose-nothread: $(objpfx)tst-interpose-aux-nothread.o > +$(objpfx)tst-interpose-nothread-mcheck: $(objpfx)tst-interpose-aux-nothread.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-nothread.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) > > @@ -277,6 +309,9 @@ $(objpfx)tst-dynarray-fail-mem.out: $(objpfx)tst-dynarray-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) >