From patchwork Wed Jul 31 15:04:45 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Adhemerval Zanella X-Patchwork-Id: 815657 Delivered-To: patch@linaro.org Received: by 2002:a5d:4acf:0:b0:367:895a:4699 with SMTP id y15csp785172wrs; Wed, 31 Jul 2024 08:05:10 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCVxKDyzwx86bDzpL5xSjWX3DqHXDpW8S3lK+FeRsKRqE3/ZkDxSma6fs5VjqrN+SiYg/SyO2afkOgagnPpRa0wn X-Google-Smtp-Source: AGHT+IEdehc48sWkDeGXkyOkfEotkBw0wKrhRC5/Rhg4v/rr09xFJS7I0zoweNn5r6C/N+B0ZiIR X-Received: by 2002:a05:620a:40c4:b0:7a1:c40d:7573 with SMTP id af79cd13be357-7a1e52ea2d8mr1847781085a.49.1722438309829; Wed, 31 Jul 2024 08:05:09 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1722438309; cv=pass; d=google.com; s=arc-20160816; b=MFEEW/irBkVIcG2Jylnxnf8T5MVe97cT1aZ7G40F82HHxtfiKpn1754E6tc78eOSk3 1vr6WY6Q0N4NWCAfMAYcJpZqBzzo3Z8C91yw9RAMlD/TUtx2mW5H8uB5CuS/Gr3SxHXf cLuRq/H4CtxoeWuxOrYsldByVhPkoEc7kzgfOJGUMRgUiUYlOrZu3RT/Owa8O8prQaUP EgYWdap2hR5SjLMSXRZAiHgmbd8GZ7SDdFNW3m39+5KyoTjxIEK2F12Ujr8u/5CKpR57 ddh5cqYCZ9+ZuOe1RcYYGeAifHzWHLbT6EvS5IXCQQC8zITLUANy/lhjXNlt5cY5d4+a xhxQ== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:message-id:date:subject:to:from:dkim-signature :arc-filter:dmarc-filter:delivered-to; bh=ec8G9i0KFmcsz6Uy1eyf+aHJguhqaU1sKyJqeyb9Z+k=; fh=dHLBnA+MhGtNtN2B2JMAELi4oD+gmgMg7DL8H0jYbkI=; b=N20YXxoWt5OF29ZAQCVxT5dI9OEZGXo6QvbH4txbYLOBJiw8g6u7iN/tk20/WYM8qg QyT/j2TWTqQYZeH56m7s+JbdM0iUZYqPbreOJW8YGs7n3qTdx8LBZqOVtUekCme1gNny v2Qg9wMsShVE7AAxYKJI0rSJ7e8r2LuISvgDATMvL7iR/5A48Zbwpx3KtLcJil6gEcfY r4QKeK99mqNYqVRn8vZYL403fQH7qQBqlU8EOBSRi0o+MC1pXyY3aJUS4Jrj7KaAzPx/ 9PodhVLAfVYJqJLmO8SEhSXHyUtxUyIQY0mXQo9gyKM6qpSUPd1RKBw3rAA2YKCGfzEk 1OHw==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=T1aLSRDi; arc=pass (i=1); spf=pass (google.com: domain of libc-alpha-bounces~patch=linaro.org@sourceware.org designates 2620:52:3:1:0:246e:9693:128c as permitted sender) smtp.mailfrom="libc-alpha-bounces~patch=linaro.org@sourceware.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from server2.sourceware.org (server2.sourceware.org. [2620:52:3:1:0:246e:9693:128c]) by mx.google.com with ESMTPS id d75a77b69052e-44fe8136bb1si154799311cf.61.2024.07.31.08.05.09 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 31 Jul 2024 08:05:09 -0700 (PDT) Received-SPF: pass (google.com: domain of libc-alpha-bounces~patch=linaro.org@sourceware.org designates 2620:52:3:1:0:246e:9693:128c as permitted sender) client-ip=2620:52:3:1:0:246e:9693:128c; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=T1aLSRDi; arc=pass (i=1); spf=pass (google.com: domain of libc-alpha-bounces~patch=linaro.org@sourceware.org designates 2620:52:3:1:0:246e:9693:128c as permitted sender) smtp.mailfrom="libc-alpha-bounces~patch=linaro.org@sourceware.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 6689A385B529 for ; Wed, 31 Jul 2024 15:05:09 +0000 (GMT) X-Original-To: libc-alpha@sourceware.org Delivered-To: libc-alpha@sourceware.org Received: from mail-pf1-x432.google.com (mail-pf1-x432.google.com [IPv6:2607:f8b0:4864:20::432]) by sourceware.org (Postfix) with ESMTPS id 2A0723858C78 for ; Wed, 31 Jul 2024 15:04:58 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 2A0723858C78 Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=linaro.org ARC-Filter: OpenARC Filter v1.0.0 sourceware.org 2A0723858C78 Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=2607:f8b0:4864:20::432 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1722438301; cv=none; b=jSnC1ZI+dPeLthjeTClp4JhSu79Utm7yhK+bLYaqSgFCF7/kDGCarPCmcEDU/dNhACiDuZCTngGM77GZ0Q7nqP4DO6PyRsMqtUxAUJJSM8bCfZIBIxIwUEfksZa0F//FhCektmAI99+HMK0EZZ6SKb7qhc9UgEjL9zew5yuXydQ= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1722438301; c=relaxed/simple; bh=jarVhdvriS3IF2kqiHnxbMwj9Gyq+ALF+Arw7tiyrh4=; h=DKIM-Signature:From:To:Subject:Date:Message-ID:MIME-Version; b=eWxutdlKizQ2+lR0X0YN4Yhpu6gdpq4FMxZY/Wgca5Z4RbBFFlq5pI/ULP3xa8ba/9Xx2SCFSH4czWyyp1qv6iiv39ZY/ds96H+COunxwBA+pGyGX3+AnVn0D95mBBLulg1/rR0g2aPgyH+8tFuVh2sqn2wXmmFYpvY46krQDxA= ARC-Authentication-Results: i=1; server2.sourceware.org Received: by mail-pf1-x432.google.com with SMTP id d2e1a72fcca58-710439ad77dso1448071b3a.2 for ; Wed, 31 Jul 2024 08:04:58 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1722438296; x=1723043096; darn=sourceware.org; h=content-transfer-encoding:mime-version:message-id:date:subject:to :from:from:to:cc:subject:date:message-id:reply-to; bh=ec8G9i0KFmcsz6Uy1eyf+aHJguhqaU1sKyJqeyb9Z+k=; b=T1aLSRDi8UXaaUsFZZ5aF82m7S5ICno4VcncXabucHrWzrFx7BOqe+bXj1dNPIMRlT dklzH7SwfKzICvfR4YmbNmXIiS+QEsHtnj4CO4lq5aDAra1zuxJXE6kM4vdNqLAnUbLW SSmBOwXQEe3gG0vjTDDsILK69CC1AHlgQf9XT8g3RdtLY1hiLblFv1e+aMny5M0sYRfj lEl2sA0AsVCNvEUdjBq+bFpSFio+Wy5P5QDn3ojoEuXkUebslHE9E4C41GsvkkmJrBb/ gXwDQW6LJsGi6ShMFj8l+6WpRjbY8JHBtbJZ7jUv4pHtc75pJN8ha6whNiSwwZZQol7g QHiw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1722438296; x=1723043096; h=content-transfer-encoding:mime-version:message-id:date:subject:to :from:x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=ec8G9i0KFmcsz6Uy1eyf+aHJguhqaU1sKyJqeyb9Z+k=; b=JOTLi6kjW6AHigxrbuJfCy3dQHvUa3G0gYIUw2VbH8AsOCAenA31gTJ2CW2W3pM6qu nK5Pss4vAnDvDRon3yeNXgQQynhVx5W6ldtOHvEwLmkjJvaoDWunlxyx92Ln4katwuM4 aJpMO4SqjEPxll/CuMlRH/nACA0EkeIFgxZjp26N/9BnIBPa5kYcspLq7nhCZNfXtvym XHA3ZRy/LiZu9bLv3MHW98iIaftN0Tn6YFiZ/uvn1ZpenD37b50qH/cgZzRf32K9OKfB u/w6tA7pI+3y97O1P5E0H3GWUUlSh99ENjMIPYYasPtzZc2Xh6dfK7BwLs5ZNF0Oacev IlYQ== X-Gm-Message-State: AOJu0YzOAyqqHqBynoT1aS+IOPBkNy/biDL/VtCJ9meXH9oWLrtL5ww3 gScdmMpa1PZx21xzI0CjmgbJgft+NLwOqh/E6BsqRfaj8Oxw7EI0gJwdTGO5bxgwhC6z3kO4yx0 g X-Received: by 2002:a05:6a21:9989:b0:1c2:8e77:a813 with SMTP id adf61e73a8af0-1c4a117dde5mr14657694637.1.1722438296350; Wed, 31 Jul 2024 08:04:56 -0700 (PDT) Received: from mandiga.. ([2804:1b3:a7c1:1944:b913:6070:fef0:3852]) by smtp.gmail.com with ESMTPSA id 41be03b00d2f7-7a9f9ec424csm9077517a12.59.2024.07.31.08.04.55 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 31 Jul 2024 08:04:55 -0700 (PDT) From: Adhemerval Zanella To: libc-alpha@sourceware.org Subject: [PATCH] linux: Annotate mode anonymous allocated maps Date: Wed, 31 Jul 2024 12:04:45 -0300 Message-ID: <20240731150452.532026-1-adhemerval.zanella@linaro.org> X-Mailer: git-send-email 2.43.0 MIME-Version: 1.0 X-Spam-Status: No, score=-12.8 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, KAM_SHORT, RCVD_IN_DNSWL_NONE, SPF_HELO_NONE, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org X-BeenThere: libc-alpha@sourceware.org X-Mailman-Version: 2.1.30 Precedence: list List-Id: Libc-alpha mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: libc-alpha-bounces~patch=linaro.org@sourceware.org For VMAs that are supposed to be long lasting. --- elf/dl-fptr.c | 3 +++ elf/dl-map-segments.h | 3 +++ sysdeps/arm/dl-machine.h | 2 ++ sysdeps/hppa/dl-fptr.c | 3 +++ 4 files changed, 11 insertions(+) diff --git a/elf/dl-fptr.c b/elf/dl-fptr.c index 575406ae44..5eebd4e1f6 100644 --- a/elf/dl-fptr.c +++ b/elf/dl-fptr.c @@ -27,6 +27,7 @@ #include #include #include +#include #ifndef ELF_MACHINE_BOOT_FPTR_TABLE_LEN /* ELF_MACHINE_BOOT_FPTR_TABLE_LEN should be greater than the number of @@ -86,6 +87,7 @@ new_fdesc_table (struct local *l, size_t *size) if (new_table == MAP_FAILED) _dl_signal_error (errno, NULL, NULL, N_("cannot map pages for fdesc table")); + __set_vma_name (new_table, *size, " glibc: fdesc table"); new_table->len = (*size - sizeof (*new_table)) / sizeof (struct fdesc); @@ -190,6 +192,7 @@ make_fptr_table (struct link_map *map) if (fptr_table == MAP_FAILED) _dl_signal_error (errno, NULL, NULL, N_("cannot map pages for fptr table")); + __set_vma_name (new_table, *size, " glibc: fdesc table"); if (COMPARE_AND_SWAP ((ElfW(Addr) *) &map->l_mach.fptr_table, (ElfW(Addr)) NULL, (ElfW(Addr)) fptr_table)) diff --git a/elf/dl-map-segments.h b/elf/dl-map-segments.h index 30977cf800..be3ad41a9a 100644 --- a/elf/dl-map-segments.h +++ b/elf/dl-map-segments.h @@ -18,6 +18,7 @@ . */ #include +#include /* Map a segment and align it properly. */ @@ -188,6 +189,8 @@ _dl_map_segments (struct link_map *l, int fd, -1, 0); if (__glibc_unlikely (mapat == MAP_FAILED)) return DL_MAP_SEGMENTS_ERROR_MAP_ZERO_FILL; + __set_vma_name (mapat, zeroend - zeropage, + " glibc: zero padding"); } } diff --git a/sysdeps/arm/dl-machine.h b/sysdeps/arm/dl-machine.h index 9186831be3..7cb38c9726 100644 --- a/sysdeps/arm/dl-machine.h +++ b/sysdeps/arm/dl-machine.h @@ -28,6 +28,7 @@ #include #include #include +#include #ifndef CLEAR_CACHE # error CLEAR_CACHE definition required to handle TEXTREL @@ -259,6 +260,7 @@ relocate_pc24 (struct link_map *map, Elf32_Addr value, if (new_page == MAP_FAILED) _dl_signal_error (0, map->l_name, NULL, "could not map page for fixup"); + __set_vma_name (new_page, GLRO(dl_pagesize), " glibc: arm fixup"); fix_page = new_page; assert (fix_offset == 0); } diff --git a/sysdeps/hppa/dl-fptr.c b/sysdeps/hppa/dl-fptr.c index e24a522998..be3096db44 100644 --- a/sysdeps/hppa/dl-fptr.c +++ b/sysdeps/hppa/dl-fptr.c @@ -30,6 +30,7 @@ #include #include #include +#include #ifndef ELF_MACHINE_BOOT_FPTR_TABLE_LEN /* ELF_MACHINE_BOOT_FPTR_TABLE_LEN should be greater than the number of @@ -94,6 +95,7 @@ new_fdesc_table (struct local *l, size_t *size) if (new_table == MAP_FAILED) _dl_signal_error (errno, NULL, NULL, N_("cannot map pages for fdesc table")); + __set_vma_name (new_table, *size, " glibc: fdesc table"); new_table->len = (*size - sizeof (*new_table)) / sizeof (struct fdesc); @@ -212,6 +214,7 @@ make_fptr_table (struct link_map *map) if (fptr_table == MAP_FAILED) _dl_signal_error (errno, NULL, NULL, N_("cannot map pages for fptr table")); + __set_vma_name (fptr_table, size, " glibc: fdesc table"); if (COMPARE_AND_SWAP ((ElfW(Addr) *) &map->l_mach.fptr_table, (ElfW(Addr)) NULL, (ElfW(Addr)) fptr_table))