From patchwork Thu Mar 4 16:32:27 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Szabolcs Nagy X-Patchwork-Id: 42250 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 BFCD93890427; Thu, 4 Mar 2021 16:32:47 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org BFCD93890427 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1614875567; bh=xXECP3YuiNjZTauqIkoJGbj9yaN4LWUgH40dSF8giNM=; h=To:Subject:Date:In-Reply-To:References:List-Id:List-Unsubscribe: List-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To: From; b=hh7ulLs0Cby2L1faSkoQKGjBFAverbIYzkPaTi3TtwMtwFvmz9n1jqJUVyZIigUst EBkBrmlTSV9diWPCLvCpvm9v2pQDcQe3M/7H+TJOr0lBCsP6+8ibPnMX8bndG5GOtz gCJl9LnxvdkU2pwKaMAR2a/A8RvG5TU9mZjnBSik= X-Original-To: libc-alpha@sourceware.org Delivered-To: libc-alpha@sourceware.org Received: from EUR04-VI1-obe.outbound.protection.outlook.com (mail-eopbgr80077.outbound.protection.outlook.com [40.107.8.77]) by sourceware.org (Postfix) with ESMTPS id 41049388CC0F for ; Thu, 4 Mar 2021 16:32:44 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org 41049388CC0F Received: from AM6PR10CA0040.EURPRD10.PROD.OUTLOOK.COM (2603:10a6:209:80::17) by AM0PR08MB4177.eurprd08.prod.outlook.com (2603:10a6:208:132::12) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3890.23; Thu, 4 Mar 2021 16:32:42 +0000 Received: from VE1EUR03FT035.eop-EUR03.prod.protection.outlook.com (2603:10a6:209:80:cafe::68) by AM6PR10CA0040.outlook.office365.com (2603:10a6:209:80::17) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3912.17 via Frontend Transport; Thu, 4 Mar 2021 16:32:42 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 63.35.35.123) smtp.mailfrom=arm.com; sourceware.org; dkim=pass (signature was verified) header.d=armh.onmicrosoft.com;sourceware.org; dmarc=pass action=none header.from=arm.com; Received-SPF: Pass (protection.outlook.com: domain of arm.com designates 63.35.35.123 as permitted sender) receiver=protection.outlook.com; client-ip=63.35.35.123; helo=64aa7808-outbound-1.mta.getcheckrecipient.com; Received: from 64aa7808-outbound-1.mta.getcheckrecipient.com (63.35.35.123) by VE1EUR03FT035.mail.protection.outlook.com (10.152.18.110) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3912.17 via Frontend Transport; Thu, 4 Mar 2021 16:32:41 +0000 Received: ("Tessian outbound dd71fb35fd76:v71"); Thu, 04 Mar 2021 16:32:41 +0000 X-CheckRecipientChecked: true X-CR-MTA-CID: 6de25e08d59a4b57 X-CR-MTA-TID: 64aa7808 Received: from ee5e1b148c14.2 by 64aa7808-outbound-1.mta.getcheckrecipient.com id C78B3808-C409-4A2F-B6D1-CDF529F18476.1; Thu, 04 Mar 2021 16:32:36 +0000 Received: from EUR02-AM5-obe.outbound.protection.outlook.com by 64aa7808-outbound-1.mta.getcheckrecipient.com with ESMTPS id ee5e1b148c14.2 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384); Thu, 04 Mar 2021 16:32:36 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=hI1k8EZcis0RiGNy6J+bqF9Ui4DN+VaMWuxoavYrSx6rp+yZVt6aljlGrIR2vxYlCeGX+K69Eqk8HY0Vb0rh98yh2N/a477rqf3JdTlD6lhNpw9ynhUceZBpT0wye8meQ0ePXEtltKKCAHg7ORfZZuOGE5F3tQLbOjZ+sD6tFc+Cl7ZYfxX881g2F+vL5+4Zl9i0HaZQdUvlqjO/TJ3QoS8XGcuFA6MpzS8w7MOu1vK3pKsCEHd5IydB/7YLVjhQL66kA2ZtCptAjEzD9PrDflCJtnvc6ZSfEn+knrKSy4mETY7O36PhQ/6FvrPhweqP6h43x9AYKDxibR+Ktla1aw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=xXECP3YuiNjZTauqIkoJGbj9yaN4LWUgH40dSF8giNM=; b=I9FaCiZHcotcptvGWlZvh/YlrW0R76TLFSo6TuuTf0qtGfWvNSrjPPDBZK5ry84QOpkf1P6hkjV9DAIJgMc6ZGvVgFQnQzMShBHEbex++zHfSrHzSif1/0zawHj/cYWbKD77GijWyCwoQkxhSqJYLBQNMgF8cRPDcMxyo3Qk1lc2PK9XK4TZBTbH+6XZ+t1Pjf57JtS0yatdg2aUbZXqBh/BthbKqN2hUrn2tw4ztUPpm70L7XPV7o5QwWTxf0vtFX6vGD+j1zMUbXRWphqiRWlvRz47gpj8BNSCs0vjjMvO4lKNRDObz1bZvpKUw/n+/yZzQqX8xYDXFoQ7ChbWMw== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=arm.com; dmarc=pass action=none header.from=arm.com; dkim=pass header.d=arm.com; arc=none Authentication-Results-Original: sourceware.org; dkim=none (message not signed) header.d=none;sourceware.org; dmarc=none action=none header.from=arm.com; Received: from PA4PR08MB6320.eurprd08.prod.outlook.com (2603:10a6:102:e5::9) by PA4PR08MB6205.eurprd08.prod.outlook.com (2603:10a6:102:e6::9) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3912.17; Thu, 4 Mar 2021 16:32:34 +0000 Received: from PA4PR08MB6320.eurprd08.prod.outlook.com ([fe80::60f0:3773:69b8:e336]) by PA4PR08MB6320.eurprd08.prod.outlook.com ([fe80::60f0:3773:69b8:e336%2]) with mapi id 15.20.3912.021; Thu, 4 Mar 2021 16:32:34 +0000 To: libc-alpha@sourceware.org, Richard.Earnshaw@arm.com, DJ Delorie Subject: [PATCH 08/16] malloc: Use global flag instead of function pointer dispatch for mtag Date: Thu, 4 Mar 2021 16:32:27 +0000 Message-Id: <8d9711a654bfe7a47ba743ab7e836118f8866f66.1614874816.git.szabolcs.nagy@arm.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: References: X-Originating-IP: [217.140.106.55] X-ClientProxiedBy: LO4P123CA0027.GBRP123.PROD.OUTLOOK.COM (2603:10a6:600:151::14) To PA4PR08MB6320.eurprd08.prod.outlook.com (2603:10a6:102:e5::9) MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 Received: from localhost.localdomain (217.140.106.55) by LO4P123CA0027.GBRP123.PROD.OUTLOOK.COM (2603:10a6:600:151::14) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3890.25 via Frontend Transport; Thu, 4 Mar 2021 16:32:34 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-HT: Tenant X-MS-Office365-Filtering-Correlation-Id: 9b934899-ea3d-4e54-bed5-08d8df2b21e2 X-MS-TrafficTypeDiagnostic: PA4PR08MB6205:|AM0PR08MB4177: X-MS-Exchange-Transport-Forked: True X-Microsoft-Antispam-PRVS: x-checkrecipientrouted: true NoDisclaimer: true X-MS-Oob-TLC-OOBClassifiers: OLM:10000;OLM:10000; X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam-Untrusted: BCL:0; X-Microsoft-Antispam-Message-Info-Original: GbkZCwkbPIz7tGVhlPasdhXhPvso4sL7el24p/pQ2ieDsYLLUUFQpLec6KWCICgLeFUjp2thlIzI5YbbvoZTwinemTiKZw4HWdENp6laL+/dyazW4TJNjJsbMAsYvJyDbiMKLk24D2ayUbled9VYOqxH/CCrxFNy8mIP4KgxsP9r9lozRzvmtqoFrOGGEiL0U3YnV1fmM/AGGColwWXuN4+cS+sQoCUKE4H/P5AKQUhK1UWg4J3wqvYmFXGsnIC93s7P89Mu39FKtzMcufsBZzvAyi+VjTtI6jycmoSRVnkeJAqM+NEc+wKTs65mu0wbZMIX4GE9L99uN3g3+J6Ca4xnXT9QP/epON9OzCiZsj2E83g2Pcz/WjzEQz26zf8Zu2MG7wXSvvyQQniBCumcheaTjvm9+iSbjIz2FE+oMqU4UQVXyx76osqJ2kzzrFT9CJMZl2X0nTebj7zeUy6ddLQ+v+PIdRneaY5hRVXEAU2zWxkBZb3tJPSZqyylSG9vVL9+2E+rFZ+qKptm5QxPxY/DWpUKmNUUAB6gj+KcwmF9/wE6zxR46xlr6Ze4ed0WKEMDN5rFh1//mXyI1Y8x8g== X-Forefront-Antispam-Report-Untrusted: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:PA4PR08MB6320.eurprd08.prod.outlook.com; PTR:; CAT:NONE; SFS:(4636009)(136003)(376002)(346002)(396003)(366004)(39850400004)(6916009)(86362001)(956004)(52116002)(2616005)(44832011)(6512007)(316002)(69590400012)(26005)(66556008)(66476007)(186003)(66946007)(6506007)(16526019)(478600001)(6486002)(2906002)(6666004)(8936002)(36756003)(83380400001)(5660300002)(8676002); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData: j5kvZ7uqYbyFSv8rZ6RHeSrqxmAg6tGl/RHhoU80DpqtubMzsTVXy6N2q3F/42ni7cKrFM87QrNQVnplANsJGeCywQmOQuxh3Kh+MJfixM1JxYfpchzXa/xtr6KZyhHkZ/c2Duib8g0/Qjbthl/Sx63VjNWS3h8CTzqPDpPbnX9DkxItBHJTCJuH4tgtzwiL3OzC1ne8RAuanavXGtofanDbIZ9d9iSJUbYscCBHQtWYb4binMZ6mptUgq1ItJJjUJZq/Icvd8C44NpAe+Kngppj/8JBGc8DPLdwA866cGbDup1wxNz5VdYjiA8ysCIjdz5bNEDpHiao37JdWCFtfzH2j3h1s0VsEPcZ+iyvM6Le8WINBwc7MlKPb+8hqZz51EXq/3olUFXIkyKbjWGS7O3bc6kb8hsHCn4F46ga51NEnfGMmDmBuCAMLKGzF4sTBLZRb91o8yf7+QIeODIbM3z57PGVinDkM53G+QNk/U/dwX6CTTpN8tAxZlq6hYVPxgZbsj9JggpCUrKmwCT+Ju1f2FEx3JU7COcq8jsZIZHbS6wKBrKmuF8ZH3ivmna1+p8/b+4I2ts/RLAh4guLWwSfoopVeLPfScb7YVi9tkn8zCMKh5CjX8ni5v3+xPfwGfTuS7Nqw0amYmwE2b5HiQfKnKzUIR3UBR50xJPVBlPU+9k8qDFtyf2f3GD6Wvh6qqcuGvqFCo1ZKpuBfpN1+BwLvdwRA3LvZ74Eh9gKZBx7JEEOqma8p66sYiiiKNfEPMnvHE/uzgy3RpuoAqx3iZrb+FCvnHAFNFPReFCcbBfzDdpOG4Jr3LIS4aMd2mwlLkpYK3HX23OtLIyum52qoLE1zcR7wfadFKxnd/HZeupj+wDAzjPQAbAGBhc6x8a9Syb08/OLGpfUPBpmXtRI7cMrlOcOPXnwuby1H7G/mJTxDgNfY4AW7p8cIWm7opq99JG77O3qJB8wZnNbrvX+227dvbk05RkXAZhXgLT+/3v9PrUGnA3kCrsd7sX8io9/VTjvbStUw+sJA3biJhwF8h6RXUif2kG2I4LBb5B9zOo9lVED0gOGsjCQTU3rDMFcacqNvhklACF019xdiKXuQdbMMWWTp4oHAzztztw+xyqn5noJ7qukqs9b4ZTgU+koHSZ/oZfcDB06WYuZOV02d08A/KK91kGt3zfmMexFE0UJdN4qnfHklt+ipjEfIVymtnG5WUYPtRr6kjJzILsvdwIkvdsbgzt0bMDk4sqfshVAhxczb38rS9Zta+45mqjXcXbDaFqki2v3d62CayvaJMwVXdS2A+A18E1RAjKymdcc5ZzmvGlATBA9n44AKGaH X-MS-Exchange-Transport-CrossTenantHeadersStamped: PA4PR08MB6205 Original-Authentication-Results: sourceware.org; dkim=none (message not signed) header.d=none; sourceware.org; dmarc=none action=none header.from=arm.com; X-EOPAttributedMessage: 0 X-MS-Exchange-Transport-CrossTenantHeadersStripped: VE1EUR03FT035.eop-EUR03.prod.protection.outlook.com X-MS-Office365-Filtering-Correlation-Id-Prvs: 63b82db2-8cdf-479c-ae19-08d8df2b1d9b X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 9484ugAC3JhaKFXg2mM9K6e6177KA8xun2Q50bp+lQ/NfCs+8OdoSzOuBNpZXx96y794AuWuyQ9C2ZcjoqzuPOV1umOk/avPM5kgsABZywaa/tKRXumjMWiOZ5O9GrHVgjQbp4WByt77gckok2hsEPmCI0fvNAANSmJJ67onKUVrsG1L1Hh8ReB2xSwM5GPstgFh2GA5M/mn78KzTLri5tjko4fvuSf6lKipmgu5nmLdxwViD5p1JTvbwU2Me/O3sRUAncwT/0lXwHoUdFS79zMVmpRB+rxG6GWNb5RJTi+5dy+//8X7G0RnmgshCMvQCz8dGhrPc4Q8m5Yloq1HTrZUIdN+Pfqy8dYeUh4LJe547/5Td/c8e9xgjEHtrFIYStqUk5kPGbT28l5wTlCs1BhuhOv3RNHjl+hTU5+XO20RUUt+05/+x78z8p015c10t/zo81rO9OZ2o2b0WpRGy26rd73nEq5vp7GM1dlNGwHquQqxXbfb/1Cf108ug5lvRIGfWcWia1uVJIpSCSQSwKEKHrDj6p8R36xOJEUYx1pMAB3r+7xY7RM3tJ5an2O0zB3eDUoaWKFwsK0TnPc1UeniLLo84aLVsslQmqMUXBzVkcHtx8F1udPVnv6uCzK5fVN9JoJRXGti1FZqPFxDyIGMxOT5IUZuaqjiSH9c2auQI+4wPYhDQpJyxQ+ZQ+dV X-Forefront-Antispam-Report: CIP:63.35.35.123; CTRY:IE; LANG:en; SCL:1; SRV:; IPV:CAL; SFV:NSPM; H:64aa7808-outbound-1.mta.getcheckrecipient.com; PTR:ec2-63-35-35-123.eu-west-1.compute.amazonaws.com; CAT:NONE; SFS:(4636009)(346002)(396003)(39850400004)(136003)(376002)(46966006)(36840700001)(36860700001)(6512007)(478600001)(6506007)(82740400003)(316002)(6666004)(186003)(86362001)(16526019)(6862004)(956004)(44832011)(69590400012)(2906002)(6486002)(5660300002)(8676002)(36756003)(81166007)(2616005)(47076005)(70586007)(83380400001)(70206006)(8936002)(356005)(26005)(336012)(82310400003); DIR:OUT; SFP:1101; X-OriginatorOrg: arm.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 04 Mar 2021 16:32:41.6688 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 9b934899-ea3d-4e54-bed5-08d8df2b21e2 X-MS-Exchange-CrossTenant-Id: f34e5979-57d9-4aaa-ad4d-b122a662184d X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=f34e5979-57d9-4aaa-ad4d-b122a662184d; Ip=[63.35.35.123]; Helo=[64aa7808-outbound-1.mta.getcheckrecipient.com] X-MS-Exchange-CrossTenant-AuthSource: VE1EUR03FT035.eop-EUR03.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM0PR08MB4177 X-Spam-Status: No, score=-13.9 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, GIT_PATCH_0, MSGID_FROM_MTA_HEADER, RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H2, SPF_HELO_PASS, SPF_PASS, TXREP, UNPARSEABLE_RELAY 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-Patchwork-Original-From: Szabolcs Nagy via Libc-alpha From: Szabolcs Nagy Reply-To: Szabolcs Nagy Errors-To: libc-alpha-bounces@sourceware.org Sender: "Libc-alpha" A flag check can be faster than function pointers because of how branch prediction and speculation works and it can also remove a layer of indirection when there is a mismatch between the malloc internal tag_* api and __libc_mtag_* target hooks. Memory tagging wrapper functions are moved to malloc.c from arena.c and the logic now checks mmap_enabled. The definition of tag_new_usable is moved after chunk related definitions. This refactoring also allows using mtag_enabled checks instead of USE_MTAG ifdefs when memory tagging support only changes code logic when memory tagging is enabled at runtime. --- malloc/arena.c | 33 +--------------------------- malloc/malloc.c | 58 ++++++++++++++++++++++++++++++++----------------- 2 files changed, 39 insertions(+), 52 deletions(-) diff --git a/malloc/arena.c b/malloc/arena.c index d0778fea92..1e83bb66bd 100644 --- a/malloc/arena.c +++ b/malloc/arena.c @@ -287,34 +287,6 @@ extern struct dl_open_hook *_dl_open_hook; libc_hidden_proto (_dl_open_hook); #endif -#ifdef USE_MTAG - -/* Generate a new (random) tag value for PTR and tag the memory it - points to upto the end of the usable size for the chunk containing - it. Return the newly tagged pointer. */ -static void * -__mtag_tag_new_usable (void *ptr) -{ - if (ptr) - { - mchunkptr cp = mem2chunk(ptr); - ptr = __libc_mtag_tag_region (__libc_mtag_new_tag (ptr), - CHUNK_AVAILABLE_SIZE (cp) - CHUNK_HDR_SZ); - } - return ptr; -} - -/* Generate a new (random) tag value for PTR, set the tags for the - memory to the new tag and initialize the memory contents to VAL. - In practice this function will only be called with VAL=0, but we - keep this parameter to maintain the same prototype as memset. */ -static void * -__mtag_tag_new_memset (void *ptr, int val, size_t size) -{ - return __libc_mtag_memset_with_tag (__libc_mtag_new_tag (ptr), val, size); -} -#endif - static void ptmalloc_init (void) { @@ -332,11 +304,8 @@ ptmalloc_init (void) if (__MTAG_SBRK_UNTAGGED) __morecore = __failing_morecore; + mtag_enabled = true; mtag_mmap_flags = __MTAG_MMAP_FLAGS; - tag_new_memset = __mtag_tag_new_memset; - tag_region = __libc_mtag_tag_region; - tag_new_usable = __mtag_tag_new_usable; - tag_at = __libc_mtag_address_get_tag; mtag_granule_mask = ~(size_t)(__MTAG_GRANULE_SIZE - 1); } #endif diff --git a/malloc/malloc.c b/malloc/malloc.c index e5f520267b..caf34843f7 100644 --- a/malloc/malloc.c +++ b/malloc/malloc.c @@ -441,35 +441,41 @@ void *(*__morecore)(ptrdiff_t) = __default_morecore; */ #ifdef USE_MTAG +static bool mtag_enabled = false; +static int mtag_mmap_flags = 0; +static size_t mtag_granule_mask = ~(size_t)0; +#else +# define mtag_enabled false +# define mtag_mmap_flags 0 +#endif -/* Default implementaions when memory tagging is supported, but disabled. */ -static void * -__default_tag_region (void *ptr, size_t size) +static __always_inline void * +tag_region (void *ptr, size_t size) { + if (__glibc_unlikely (mtag_enabled)) + return __libc_mtag_tag_region (ptr, size); return ptr; } -static void * -__default_tag_nop (void *ptr) +static __always_inline void * +tag_new_memset (void *ptr, int val, size_t size) { - return ptr; + if (__glibc_unlikely (mtag_enabled)) + return __libc_mtag_memset_with_tag (__libc_mtag_new_tag (ptr), val, size); + return memset (ptr, val, size); } -static int mtag_mmap_flags = 0; -static size_t mtag_granule_mask = ~(size_t)0; - -static void *(*tag_new_memset)(void *, int, size_t) = memset; -static void *(*tag_region)(void *, size_t) = __default_tag_region; -static void *(*tag_new_usable)(void *) = __default_tag_nop; -static void *(*tag_at)(void *) = __default_tag_nop; +/* Defined later. */ +static void * +tag_new_usable (void *ptr); -#else -# define mtag_mmap_flags 0 -# define tag_new_memset(ptr, val, size) memset (ptr, val, size) -# define tag_region(ptr, size) (ptr) -# define tag_new_usable(ptr) (ptr) -# define tag_at(ptr) (ptr) -#endif +static __always_inline void * +tag_at (void *ptr) +{ + if (__glibc_unlikely (mtag_enabled)) + return __libc_mtag_address_get_tag (ptr); + return ptr; +} #include @@ -3185,6 +3191,18 @@ tcache_thread_shutdown (void) #endif /* !USE_TCACHE */ +static __always_inline void * +tag_new_usable (void *ptr) +{ + if (__glibc_unlikely (mtag_enabled) && ptr) + { + mchunkptr cp = mem2chunk(ptr); + ptr = __libc_mtag_tag_region (__libc_mtag_new_tag (ptr), + CHUNK_AVAILABLE_SIZE (cp) - CHUNK_HDR_SZ); + } + return ptr; +} + void * __libc_malloc (size_t bytes) {