From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from forward501c.mail.yandex.net (forward501c.mail.yandex.net [IPv6:2a02:6b8:c03:500:1:45:d181:d501]) by sourceware.org (Postfix) with ESMTPS id B478E3858C52 for ; Sat, 18 Mar 2023 17:28:11 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org B478E3858C52 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 iva1-07947c637cce.qloud-c.yandex.net (iva1-07947c637cce.qloud-c.yandex.net [IPv6:2a02:6b8:c0c:929a:0:640:794:7c63]) by forward501c.mail.yandex.net (Yandex) with ESMTP id B98545EBE6; Sat, 18 Mar 2023 20:28:10 +0300 (MSK) Received: by iva1-07947c637cce.qloud-c.yandex.net (smtp/Yandex) with ESMTPSA id 9Sqf9n2bpKo1-3XeaVkTg; Sat, 18 Mar 2023 20:28:10 +0300 X-Yandex-Fwd: 1 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yandex.ru; s=mail; t=1679160490; bh=Gys2XVfcHGWzyEfpERtuv4PqAY/Xb825Y6B2aH88Dyw=; h=In-Reply-To:From:Date:References:To:Subject:Message-ID; b=uwlCZOGH7Id4wSuQXkjAZoTzoYWZY+q5cPUAlmynlQ47fdUdCMLKw7P4CEkKLyXyD cbqakIl7wcVd4ReiiQrLq7tNFZr5wpavKBtWveYkVk+gsRgmDb1Ye0MRgtzb04+w7l aG+l7QS4iS2bHsTjMOmW99k5aMduqoBQDml9BgNM= Authentication-Results: iva1-07947c637cce.qloud-c.yandex.net; dkim=pass header.i=@yandex.ru Message-ID: Date: Sat, 18 Mar 2023 22:28:08 +0500 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.7.1 Subject: Re: [PATCH 2/2] dlfcn,elf: implement dlmem() function [BZ #11767] Content-Language: en-US To: Florian Weimer , Stas Sergeev via Libc-alpha References: <20230213132307.528976-1-stsp2@yandex.ru> <20230213132307.528976-3-stsp2@yandex.ru> <87y1p1d6go.fsf@oldenburg.str.redhat.com> From: stsp In-Reply-To: <87y1p1d6go.fsf@oldenburg.str.redhat.com> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-3.5 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,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: 13.02.2023 18:45, Florian Weimer пишет: > On the Google branches, there is somewhat similar functionality, in the > form of dlopen_with_offset. I'll list dlopen_with_offset() below. > Your patch seems to allow the creation of fully unnamed link maps > (especially if the shared object being loaded does not come with > DT_SONAME). I think we need to discuss the consequences of that. This > feature could be independently useful to some applications, to the > extent that they would use dlmem just for that purposes (even for files > that are stored on disk). Probably, but in v9 I added a possibility to specify an object name for dlmem(). It also has an fdlopen() impl as a test-case. So dlopen_with_offset(): static void * dlopen_with_offset (int fd, int flags, off_t offset) {   off_t len;   void *addr;   void *handle;   len = lseek (fd, 0, SEEK_END);   lseek (fd, 0, SEEK_SET);   if (len <= offset)     return NULL;   len -= offset;   addr = mmap (NULL, len, PROT_READ, MAP_PRIVATE, fd, offset);   if (addr == MAP_FAILED)     return NULL;   handle = dlmem (addr, len, flags, NULL);   munmap (addr, len);   return handle; } Should I add it to a test-case or fdlopen() is enough?