From patchwork Sat Nov 13 00:40:47 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stafford Horne X-Patchwork-Id: 47581 Return-Path: X-Original-To: patchwork@sourceware.org Delivered-To: patchwork@sourceware.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 29976385801D for ; Sat, 13 Nov 2021 00:41:17 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 29976385801D DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1636764077; bh=QKwErJmj9E9haG7WGfTTFaU90Cp8uqR/kVLEpK3WwnQ=; h=To:Subject:Date:List-Id:List-Unsubscribe:List-Archive:List-Post: List-Help:List-Subscribe:From:Reply-To:From; b=jtnzYcgdBfbqozji1i6/wSHDYDwKR1RlF2wZW0fsJ0ned2TsesmC43JQlQio318GB zNbufA1KaduU9hcrITkqYs5hU6gR0vuGMqSlatbIgtb+wn+LsWZGU+WDVkudYtqr6i LI2gSq3MkUOTLMK/O0nxX8bIpanOTgqETBNhq7aA= X-Original-To: libc-alpha@sourceware.org Delivered-To: libc-alpha@sourceware.org Received: from mail-pj1-x1031.google.com (mail-pj1-x1031.google.com [IPv6:2607:f8b0:4864:20::1031]) by sourceware.org (Postfix) with ESMTPS id 6E5FD385840B for ; Sat, 13 Nov 2021 00:40:55 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 6E5FD385840B Received: by mail-pj1-x1031.google.com with SMTP id j6-20020a17090a588600b001a78a5ce46aso8439575pji.0 for ; Fri, 12 Nov 2021 16:40:55 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=QKwErJmj9E9haG7WGfTTFaU90Cp8uqR/kVLEpK3WwnQ=; b=eY4/dScLYHINA9txbXwoKVf0rRhqJ2KmeJxT4P8l99jIwA/WBgU4R4fVIxEOwHqhnr BIWTQjplzZJbCJDNqpZR81VPtaiWlhGIxW+w4pnNA5BqJ1uXgKRosIHGh1QPO1wdJGcU MMWT2oU8b0zfar4LuqfjjL34sbJvm/wAD4Gnbkbn3egxCzYy43uA7g6+6xE9aNW+/gBZ kPZp5Sm2mc3kK/qIJ+XMsdYK72GkP71yRzG4g3ETMczCgCjjI5oWLrIhVWtQDYNZFFf/ MmrpFc+TUYVeIjnDaQ9aEKkvHUE2MbTPcCrOXhPtScmmsN4S8iDnjh5fuJk+LQPNIlRM F1jg== X-Gm-Message-State: AOAM530hKp/oog3ubD5MPSa1ZqaoIryMRVue45PvJmKAjEXZecaKSTfh w33q05wtsHvRUfLtH7/0ITzuPsMuGpY= X-Google-Smtp-Source: ABdhPJwJoX2VMfPmO86IDWnnNzEzx/4jomS3i1SOEIzi4nCkWHDUokX4WAXOIIKj7NXhK8mf96g42A== X-Received: by 2002:a17:903:185:b0:141:f5f3:dae with SMTP id z5-20020a170903018500b00141f5f30daemr12899302plg.56.1636764054177; Fri, 12 Nov 2021 16:40:54 -0800 (PST) Received: from localhost ([2409:10:24a0:4700:e8ad:216a:2a9d:6d0c]) by smtp.gmail.com with ESMTPSA id mp12sm11806496pjb.39.2021.11.12.16.40.52 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 12 Nov 2021 16:40:53 -0800 (PST) To: GLIBC patches Subject: [PATCH] malloc: Fix malloc debug for 2.35 onwards Date: Sat, 13 Nov 2021 09:40:47 +0900 Message-Id: <20211113004047.1980486-1-shorne@gmail.com> X-Mailer: git-send-email 2.31.1 MIME-Version: 1.0 X-Spam-Status: No, score=-10.2 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, FREEMAIL_FROM, GIT_PATCH_0, RCVD_IN_DNSWL_NONE, SPF_HELO_NONE, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.4 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) 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-Patchwork-Original-From: Stafford Horne via Libc-alpha From: Stafford Horne Reply-To: Stafford Horne Errors-To: libc-alpha-bounces+patchwork=sourceware.org@sourceware.org Sender: "Libc-alpha" The change 1e5a5866cb ("Remove malloc hooks [BZ #23328]") has broken ports that are using GLIBC_2_35, like the new OpenRISC port I am working on. The libc_malloc_debug.so library used to bring in the debug infrastructure is currently essentially empty for GLIBC_2_35 ports like mine causing mtrace tests to fail: cat sysdeps/unix/sysv/linux/or1k/shlib-versions DEFAULT GLIBC_2.35 ld=ld-linux-or1k.so.1 FAIL: posix/bug-glob2-mem FAIL: posix/bug-regex14-mem FAIL: posix/bug-regex2-mem FAIL: posix/bug-regex21-mem FAIL: posix/bug-regex31-mem FAIL: posix/bug-regex36-mem FAIL: malloc/tst-mtrace. The issue seems to be with the ifdefs in malloc/malloc-debug.c. The ifdefs are currently essentially exluding all symbols for ports > 2.35. In short: if (SHLIB_COMPAT 2.0 -> 2.34) debug api inlcude .c files implement apis Generate debug compat api endif This fix changes this to: debug api inlcude .c files implement apis if (SHLIB_COMPAT 2.0 -> 2.34) Generate debug compat api endif Fixes: 1e5a5866cb ("Remove malloc hooks [BZ #23328]") Cc: Siddhesh Poyarekar --- malloc/malloc-debug.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/malloc/malloc-debug.c b/malloc/malloc-debug.c index 3d7e6d44fd..6f2b6a2d23 100644 --- a/malloc/malloc-debug.c +++ b/malloc/malloc-debug.c @@ -24,7 +24,6 @@ #include #include -#if SHLIB_COMPAT (libc_malloc_debug, GLIBC_2_0, GLIBC_2_34) /* Support only the glibc allocators. */ extern void *__libc_malloc (size_t); extern void __libc_free (void *); @@ -640,6 +639,7 @@ compat_symbol (libc_malloc_debug, malloc_set_state, malloc_set_state, GLIBC_2_0); #endif +#if SHLIB_COMPAT (libc_malloc_debug, GLIBC_2_0, GLIBC_2_34) /* Do not allow linking against the library. */ compat_symbol (libc_malloc_debug, aligned_alloc, aligned_alloc, GLIBC_2_16); compat_symbol (libc_malloc_debug, calloc, calloc, GLIBC_2_0);