From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from forward501b.mail.yandex.net (forward501b.mail.yandex.net [IPv6:2a02:6b8:c02:900:1:45:d181:d501]) by sourceware.org (Postfix) with ESMTPS id 344FE3858C50 for ; Sat, 18 Mar 2023 16:58:22 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 344FE3858C50 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-31.sas.yp-c.yandex.net (mail-nwsmtp-smtp-production-main-31.sas.yp-c.yandex.net [IPv6:2a02:6b8:c08:d315:0:640:bb64:0]) by forward501b.mail.yandex.net (Yandex) with ESMTP id 3A9905E8AF; Sat, 18 Mar 2023 19:58:20 +0300 (MSK) Received: by mail-nwsmtp-smtp-production-main-31.sas.yp-c.yandex.net (smtp/Yandex) with ESMTPSA id IwpCpcFWqiE0-7S4F5XeA; Sat, 18 Mar 2023 19:58:19 +0300 X-Yandex-Fwd: 1 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yandex.ru; s=mail; t=1679158699; bh=ctvgMI5Anm0fZtvy+Ibiu7VHECe8rHsQWAYrQ+WUbUs=; h=In-Reply-To:From:Date:References:To:Subject:Message-ID; b=g27f9H/Q+M4xXxKp/YMV5OCMI6kcBv5Pwd2mfZCCE6ySeqkfmjk8LyhyV8aPTEY8f yi/UrLlPb+ZW9duiVVXYGjJN05SCvXkexluCx9pDhUruCP32lvJrXY0Kf5Eor2Drxh 6Ms0z2qdUX0I4Z0+8mOKy6qqHKHgaAQYqGIjwf5A= Authentication-Results: mail-nwsmtp-smtp-production-main-31.sas.yp-c.yandex.net; dkim=pass header.i=@yandex.ru Message-ID: <593c02f1-5a20-07c4-9736-1f35705f154b@yandex.ru> Date: Sat, 18 Mar 2023 21:58:17 +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: <20230214084123.2056067-1-stsp2@yandex.ru> <20230214084123.2056067-3-stsp2@yandex.ru> <87mt5ga82l.fsf@oldenburg.str.redhat.com> From: stsp In-Reply-To: <87mt5ga82l.fsf@oldenburg.str.redhat.com> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-2.8 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: Hi, 14.02.2023 14:51, Florian Weimer пишет: > * Stas Sergeev via Libc-alpha: > >> This patch adds the following function: >> void *dlmem(const unsigned char *buffer, size_t size, int flags); >> >> It is the same as dlopen() but allows to dynamic-link solibs from >> the memory buffer, rather than from a file as dlopen() does. >> >> "buffer" arg is the pointer to the solib image in memory. >> "size" is the solib image size. Must be smaller-or-equal to the >> actual buffer size. >> "flags" is the same flags argument used in dlopen(). >> >> The idea behind the implementation is very simple: where the >> dlopen() would mmap() the file, dlmem() does anonymous >> mmap()+memcpy(). > With the mandatory copy, I'm not sure if this is a substantial > improvement over the pedestrian implementation using memfd_create, Hope the need/features of my dlmem() impl was explained since then. But now I posted v9 that uses memcpy() only as an opt-in, not by default. Unfortunately I haven't made it to work on kernels older than 5.13, so on those it still falls back to memcpy(). Are there any other things left to implement?