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 8B6653858C52 for ; Sat, 18 Mar 2023 17:04:15 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 8B6653858C52 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 iva3-dd2bb2ff2b5f.qloud-c.yandex.net (iva3-dd2bb2ff2b5f.qloud-c.yandex.net [IPv6:2a02:6b8:c0c:7611:0:640:dd2b:b2ff]) by forward501c.mail.yandex.net (Yandex) with ESMTP id E3BDF5EB8A; Sat, 18 Mar 2023 20:04:12 +0300 (MSK) Received: by iva3-dd2bb2ff2b5f.qloud-c.yandex.net (smtp/Yandex) with ESMTPSA id A4q9vb2doeA1-z9qEs3HG; Sat, 18 Mar 2023 20:04:12 +0300 X-Yandex-Fwd: 1 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yandex.ru; s=mail; t=1679159052; bh=39A9Nc7cYv/k/Fo2crml3BmHBWgzmo2njV/3Cyyp9NY=; h=In-Reply-To:From:Date:References:To:Subject:Message-ID; b=KtSsEeSwMmm+/5460I3Dz6rP7AyGOAGAUFGyBBOSMgz9ZNqT9QPOnyheQpgNHZ1mB bFCZ+HHvCYdfjl538wk49WKIlI8crtNTjYOFlD6W9tj75Dd3GRKLAcOM3+nVIl6i3i Xa8nM6CX/artLlJzltRjcaSsNUkF76Qk6ZXznWqA= Authentication-Results: iva3-dd2bb2ff2b5f.qloud-c.yandex.net; dkim=pass header.i=@yandex.ru Message-ID: <8ae11de1-1b64-99af-2f9f-ca8272a653c2@yandex.ru> Date: Sat, 18 Mar 2023 22:04:10 +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/3] dlfcn,elf: implement dlmem() and audit [BZ #11767] Content-Language: en-US To: Carlos O'Donell , libc-alpha@sourceware.org, Paul Pluzhnikov References: <20230215165541.1107137-1-stsp2@yandex.ru> <20230215165541.1107137-3-stsp2@yandex.ru> From: stsp In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-3.6 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 Carlos, 20.02.2023 20:50, Carlos O'Donell пишет: > * No new LD_AUDIT interfaces reuqired so auditors and developer tooling does > not need to be updated. I dropped LD_AUDIT stuff just as you say. > My suggestion therefore is to attempt to refactor what you have around an API > that is like fdlopen(), and see what the implementation and performance looks > like in glibc. > > Thoughts? Done in a just posted v9. It has fdlopen() in tst-dlmem-fdlopen. Its source are also listed below. I think that impl should go to libbsd, not into glibc though. What do you think? Source: static void * fdlopen (int fd, int flags) {   off_t len;   void *addr;   void *handle;   len = lseek (fd, 0, SEEK_END);   lseek (fd, 0, SEEK_SET);   addr = mmap (NULL, len, PROT_READ, MAP_PRIVATE, fd, 0);   if (addr == MAP_FAILED)     {       printf ("cannot mmap, %s\n", strerror(errno));       exit (EXIT_FAILURE);     }   handle = dlmem (addr, len, flags, NULL);   munmap (addr, len);   return handle; }