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 Netto X-Patchwork-Id: 1967175 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=linaro.org header.i=@linaro.org header.a=rsa-sha256 header.s=google header.b=T1aLSRDi; dkim-atps=neutral Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=sourceware.org (client-ip=2620:52:3:1:0:246e:9693:128c; helo=server2.sourceware.org; envelope-from=libc-alpha-bounces~incoming=patchwork.ozlabs.org@sourceware.org; receiver=patchwork.ozlabs.org) Received: from server2.sourceware.org (server2.sourceware.org [IPv6:2620:52:3:1:0:246e:9693:128c]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (secp384r1) server-digest SHA384) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4WYwPm5Qtpz1yYq for ; Thu, 1 Aug 2024 01:05:16 +1000 (AEST) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id E17E03858283 for ; Wed, 31 Jul 2024 15:05:14 +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-Google-Smtp-Source: AGHT+IFA/qcxjmgIuLHw5BjpID6RP8k17o+VEXqsKurZRrRrqpZ/svARApuIFgRm2ppTNzayt5SeKg== 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~incoming=patchwork.ozlabs.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))