From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from forward500c.mail.yandex.net (forward500c.mail.yandex.net [178.154.239.208]) by sourceware.org (Postfix) with ESMTPS id 2BE8A3858D1E for ; Wed, 29 Mar 2023 19:43:25 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 2BE8A3858D1E Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=yandex.ru Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=yandex.ru Received: from mail-nwsmtp-smtp-production-main-90.myt.yp-c.yandex.net (mail-nwsmtp-smtp-production-main-90.myt.yp-c.yandex.net [IPv6:2a02:6b8:c12:2923:0:640:4a49:0]) by forward500c.mail.yandex.net (Yandex) with ESMTP id B40465F569; Wed, 29 Mar 2023 22:43:23 +0300 (MSK) Received: by mail-nwsmtp-smtp-production-main-90.myt.yp-c.yandex.net (smtp/Yandex) with ESMTPSA id MhOsW06DgOs0-MgYTdYfJ; Wed, 29 Mar 2023 22:43:23 +0300 X-Yandex-Fwd: 1 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yandex.ru; s=mail; t=1680119003; bh=vK4v7QSgTj7hzoO3gbI4j24Oo57FgTriMWUpD4qyaXI=; h=In-Reply-To:Date:References:To:Subject:From:Message-ID; b=UpqiCQm5WGydLR+E6etxRfyMlXvc/cdZGjwoCzozSagNkOAWt2MrP0d87hhORPz7k Kp5IbvxrBiqRtcd/xXwHkRhszIYkyyIb1YoW83hcgZHbWga5UjeoxBt2NWztnq2ixt seBNPNBHD6gxzIu0m2IloCwMZyqbsFE4LmWTCrs0= Authentication-Results: mail-nwsmtp-smtp-production-main-90.myt.yp-c.yandex.net; dkim=pass header.i=@yandex.ru Message-ID: Date: Thu, 30 Mar 2023 00:43:21 +0500 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.7.1 From: stsp Subject: Re: [PATCH 02/13] elf: switch _dl_map_segment() to anonymous mapping To: Adhemerval Zanella Netto , libc-alpha@sourceware.org References: <20230318165110.3672749-1-stsp2@yandex.ru> <20230318165110.3672749-3-stsp2@yandex.ru> <0ecd46af-74d2-a1ea-cd3f-88c7c9886c21@linaro.org> <7c3c1d76-578b-4e9d-65fe-f53220fe0640@yandex.ru> Content-Language: en-US In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-2.4 required=5.0 tests=BAYES_00,BODY_8BITS,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_ENVFROM_END_DIGIT,FREEMAIL_FROM,NICE_REPLY_A,RCVD_IN_MSPIKE_H2,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 List-Id: 30.03.2023 00:17, Adhemerval Zanella Netto пишет: > On 29/03/23 15:46, stsp wrote: > >> Would MAP_COPY be a good choice for >> explicitly anonymous mapping? If so - >> can change. > It avoid code duplication. Queued for v10. >> >> Ah, that seems to be a "hole" are >> between segments. I actually think >> my handling is much better. Without >> my patch, such holes are filled with >> actually the _random_ page from the >> original file mapping. Just whatever >> page happened to have that offset. >> Do you think the random page from >> the file is a good idea for tooling/debugging? > It seems to be a gdb limitation that is showing some wrong information. But again, > I really don't see *why* this change is needed: the current algorithms already > maps the ELF segments correctly and have random data on the hole does not really > matter (it would be mapped as PROT_NONE). Its only for dlmem(). In dlmem() you need to do anonymous mmap at the relocation address, and after that we shouldn't skip the first segment. I can remove this patch if you insist, but the cost will likely be quite high, as I'll need then to propagate some flag up to _dl_map_segments() to tell if we can skip the first segment or not, and if we should call _dl_map_segment() or a premap callback.