From patchwork Fri Jan 21 17:29:51 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Adhemerval Zanella X-Patchwork-Id: 50319 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 0575F3857827 for ; Fri, 21 Jan 2022 17:31:43 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 0575F3857827 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1642786303; bh=E2wV4UH38hASOWqZEko066Uk5FKIw45bJ9AugOeEbpY=; h=To:Subject:Date:In-Reply-To:References:List-Id:List-Unsubscribe: List-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To:Cc: From; b=LhEFW0i74TFSoeEvihjWhFnmsME73UqZpZ6k+r9FyGDKgf/yS3BVr2ZgYzw75UHpE GVr7djbAxzNxSmZkZE98HPIX+xJULeh0h+PGnkx/jkAJ3zLN3J5olOLvmOZo+oiiNB F1QNc7NkeS0IhAQ0k5BERlZ3KgmrASbGhrV0rh5o= X-Original-To: libc-alpha@sourceware.org Delivered-To: libc-alpha@sourceware.org Received: from mail-ot1-x32e.google.com (mail-ot1-x32e.google.com [IPv6:2607:f8b0:4864:20::32e]) by sourceware.org (Postfix) with ESMTPS id BACD63857817 for ; Fri, 21 Jan 2022 17:30:00 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org BACD63857817 Received: by mail-ot1-x32e.google.com with SMTP id z25-20020a0568301db900b005946f536d85so12617261oti.9 for ; Fri, 21 Jan 2022 09:30:00 -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:in-reply-to :references:mime-version:content-transfer-encoding; bh=E2wV4UH38hASOWqZEko066Uk5FKIw45bJ9AugOeEbpY=; b=ZluqBc05l6N1uTkNHH+0zr/T9QhjXp0ujyJzswEwsHK09Jm+DGFjL9MWoJMKSpqZBU p3yL/3LKgl8d1+C0y5zisW8vlh9FyQ50Naca3yXmKyX7nc+LN+2wG343XnGm8katsM1S +0wAR7luoAfXQwTnO9Ahsy1lv3cFylBIYTPdFLCDlVI01vpFi9uTte8GQrV5h+/k6xa7 N4M5wZf2klr99SaMgHcE6kTfhCXiA0lT/vn2tbA9NSs2F6kl/2ovSPx059na+f69uxam EHwzVB5sx+iEcSc2fzkWgOeqKZYmCsR+mtZkk68gb5dx3NC1tf9QbV/JwCmnGfVNMiA5 /Rag== X-Gm-Message-State: AOAM53093+1LqARwQeefwthkx91qrmd95GKFbM/QpwNB+8BIlX+ZwgYh t6KKysgwLHG8AXa/kEUsqfLfWbvqjz2uFA== X-Google-Smtp-Source: ABdhPJwTNE3yQEdIcIj3RX9OXojNOl7kj/FrCqDLoVNiMbXD24Jp5NUFG6YATLvZwLvAhjQrU2G/Og== X-Received: by 2002:a9d:7b4d:: with SMTP id f13mr3499864oto.365.1642786199968; Fri, 21 Jan 2022 09:29:59 -0800 (PST) Received: from birita.. ([2804:431:c7cb:27f8:f8b7:bc61:9607:9ecb]) by smtp.gmail.com with ESMTPSA id i21sm1294706oto.27.2022.01.21.09.29.58 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 21 Jan 2022 09:29:59 -0800 (PST) To: libc-alpha@sourceware.org Subject: [PATCH 3/3] elf: Remove LD_USE_LOAD_BIAS Date: Fri, 21 Jan 2022 14:29:51 -0300 Message-Id: <20220121172951.285848-4-adhemerval.zanella@linaro.org> X-Mailer: git-send-email 2.32.0 In-Reply-To: <20220121172951.285848-1-adhemerval.zanella@linaro.org> References: <20220121172951.285848-1-adhemerval.zanella@linaro.org> MIME-Version: 1.0 X-Spam-Status: No, score=-12.9 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, 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: Adhemerval Zanella via Libc-alpha From: Adhemerval Zanella Reply-To: Adhemerval Zanella Cc: Richard Purdie Errors-To: libc-alpha-bounces+patchwork=sourceware.org@sourceware.org Sender: "Libc-alpha" It is used only for prelink with PIE exectuables [1]. [1] https://sourceware.org/legacy-ml/libc-hacker/2003-11/msg00127.html --- NEWS | 3 +++ elf/dl-map-segments.h | 3 +-- elf/dl-support.c | 1 - elf/rtld.c | 13 ------------- sysdeps/generic/ldsodefs.h | 5 ----- sysdeps/generic/unsecvars.h | 1 - 6 files changed, 4 insertions(+), 22 deletions(-) diff --git a/NEWS b/NEWS index ee2bcabda7..68a7f2b752 100644 --- a/NEWS +++ b/NEWS @@ -156,6 +156,9 @@ Deprecated and removed features, and other changes affecting compatibility: * The prelink support has been removed. Prelinked binaries and libraries work as if prelinked is disabled. +* The LD_USE_LOAD_BIAS has been removed. The variable was mainly used to + support prelink PIE binaries. + Changes to build and runtime requirements: [Add changes to build and runtime requirements here] diff --git a/elf/dl-map-segments.h b/elf/dl-map-segments.h index 172692b120..b3513e7909 100644 --- a/elf/dl-map-segments.h +++ b/elf/dl-map-segments.h @@ -94,8 +94,7 @@ _dl_map_segments (struct link_map *l, int fd, prefer to map such objects at; but this is only a preference, the OS can do whatever it likes. */ ElfW(Addr) mappref - = (ELF_PREFERRED_ADDRESS (loader, maplength, - c->mapstart & GLRO(dl_use_load_bias)) + = (ELF_PREFERRED_ADDRESS (loader, maplength, c->mapstart) - MAP_BASE_ADDR (l)); /* Remember which part of the address space this object uses. */ diff --git a/elf/dl-support.c b/elf/dl-support.c index fb64765537..6d2c4baf81 100644 --- a/elf/dl-support.c +++ b/elf/dl-support.c @@ -54,7 +54,6 @@ size_t _dl_platformlen; int _dl_debug_mask; int _dl_lazy; -ElfW(Addr) _dl_use_load_bias = -2; int _dl_dynamic_weak; /* If nonzero print warnings about problematic situations. */ diff --git a/elf/rtld.c b/elf/rtld.c index 9fea138619..04976b8673 100644 --- a/elf/rtld.c +++ b/elf/rtld.c @@ -364,7 +364,6 @@ struct rtld_global_ro _rtld_global_ro attribute_relro = ._dl_sysinfo = DL_SYSINFO_DEFAULT, #endif ._dl_debug_fd = STDERR_FILENO, - ._dl_use_load_bias = -2, ._dl_correct_cache_id = _DL_CACHE_DEFAULT_ID, #if !HAVE_TUNABLES ._dl_hwcap_mask = HWCAP_IMPORTANT, @@ -1741,12 +1740,6 @@ dl_main (const ElfW(Phdr) *phdr, ++GL(dl_ns)[LM_ID_BASE]._ns_nloaded; ++GL(dl_load_adds); - /* If LD_USE_LOAD_BIAS env variable has not been seen, default - to not using bias for non-prelinked PIEs and libraries - and using it for executables or prelinked PIEs or libraries. */ - if (GLRO(dl_use_load_bias) == (ElfW(Addr)) -2) - GLRO(dl_use_load_bias) = main_map->l_addr == 0 ? -1 : 0; - /* Starting from binutils-2.23, the linker will define the magic symbol __ehdr_start to point to our own ELF header if it is visible in a segment that also includes the phdrs. If that's not available, we use @@ -2656,12 +2649,6 @@ process_envvars (struct dl_main_state *state) #ifdef EXTRA_LD_ENVVARS_13 EXTRA_LD_ENVVARS_13 #endif - if (!__libc_enable_secure - && memcmp (envline, "USE_LOAD_BIAS", 13) == 0) - { - GLRO(dl_use_load_bias) = envline[14] == '1' ? -1 : 0; - break; - } break; case 14: diff --git a/sysdeps/generic/ldsodefs.h b/sysdeps/generic/ldsodefs.h index 139eed8d3f..4c028f9d06 100644 --- a/sysdeps/generic/ldsodefs.h +++ b/sysdeps/generic/ldsodefs.h @@ -628,11 +628,6 @@ struct rtld_global_ro /* Location of the binary. */ EXTERN const char *_dl_origin_path; - /* -1 if the dynamic linker should honor library load bias, - 0 if not, -2 use the default (honor biases for normal - binaries, don't honor for PIEs). */ - EXTERN ElfW(Addr) _dl_use_load_bias; - /* Size of the static TLS block. */ EXTERN size_t _dl_tls_static_size; diff --git a/sysdeps/generic/unsecvars.h b/sysdeps/generic/unsecvars.h index 5ea8a4a259..b50331b50f 100644 --- a/sysdeps/generic/unsecvars.h +++ b/sysdeps/generic/unsecvars.h @@ -22,7 +22,6 @@ "LD_PRELOAD\0" \ "LD_PROFILE\0" \ "LD_SHOW_AUXV\0" \ - "LD_USE_LOAD_BIAS\0" \ "LOCALDOMAIN\0" \ "LOCPATH\0" \ "MALLOC_TRACE\0" \