From patchwork Sat Mar 18 16:50:57 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: stsp X-Patchwork-Id: 55596 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 421BF3850217 for ; Sat, 18 Mar 2023 16:52:39 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 421BF3850217 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1679158359; bh=ihY0MPVYLDeQ2o1y94YU+pEO25ZQ9cmxa1BSa8haMHc=; h=To:Cc:Subject:Date:List-Id:List-Unsubscribe:List-Archive: List-Post:List-Help:List-Subscribe:From:Reply-To:From; b=EtqXT35QwY2NEeRjwBPkTj3Qvgb5N7U7KM8biz1x1qi+dkXK+MbgO6EEPgNhBDtK8 Jv4zg8NyQFPxzGsKJEpF33pRZKTJhlTEuSWuUPM/bQh/cBjwa18p+I/B1i+yrde/gu mDnoWp9/uPrnDDbrdDfHDaKPT6UKcx7e7Li2Qo44= X-Original-To: libc-alpha@sourceware.org Delivered-To: libc-alpha@sourceware.org Received: from forward106j.mail.yandex.net (forward106j.mail.yandex.net [5.45.198.249]) by sourceware.org (Postfix) with ESMTPS id CC58F385022C for ; Sat, 18 Mar 2023 16:51:43 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org CC58F385022C Received: from myt6-1289f562e823.qloud-c.yandex.net (myt6-1289f562e823.qloud-c.yandex.net [IPv6:2a02:6b8:c12:259d:0:640:1289:f562]) by forward106j.mail.yandex.net (Yandex) with ESMTP id B55316BD61E6 for ; Sat, 18 Mar 2023 19:51:41 +0300 (MSK) Received: by myt6-1289f562e823.qloud-c.yandex.net (smtp/Yandex) with ESMTPSA id cpp3fcrbC8c1-MjfO4cfx; Sat, 18 Mar 2023 19:51:41 +0300 X-Yandex-Fwd: 1 To: libc-alpha@sourceware.org Cc: Stas Sergeev Subject: [PATCH v9 0/13] implement dlmem() function Date: Sat, 18 Mar 2023 21:50:57 +0500 Message-Id: <20230318165110.3672749-1-stsp2@yandex.ru> X-Mailer: git-send-email 2.37.2 MIME-Version: 1.0 X-Spam-Status: No, score=-4.6 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, FREEMAIL_ENVFROM_END_DIGIT, FREEMAIL_FROM, RCVD_IN_DNSWL_LOW, 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 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: Stas Sergeev via Libc-alpha From: stsp Reply-To: Stas Sergeev Errors-To: libc-alpha-bounces+patchwork=sourceware.org@sourceware.org Sender: "Libc-alpha" Changes in v9: - use "zero-copy" machinery instead of memcpy(). It works on linux 5.13 and newer, falling back to memcpy() otherwise. Suggested by Florian Weimer. - implement fdlopen() using the above functionality. It is in a new test tst-dlmem-fdlopen. Suggested by Carlos O'Donell. - add DLMEM_DONTREPLACE flag that doesn't replace the backing-store mapping. It switches back to memcpy(). Test-case is called tst-dlmem-shm. Changes in v8: - drop audit machinery and instead add an extra arg (optional pointer to a struct) to dlmem() itself that allows to install a custom premap callback or to specify nsid. Audit machinery was meant to allow controling over the pre-existing APIs like dlopen(), but if someone ever needs such extensions to dlopen(), he can trivially implement dlopen() on top of dlmem(). Changes in v7: - add _dl_audit_premap audit extension and its usage example Changes in v6: - use __strdup("") for l_name as suggested by Andreas Schwab Changes in v5: - added _dl_audit_premap_dlmem audit extension for dlmem - added tst-auditmod-dlmem.c test-case that feeds shm fd to dlmem() Changes in v4: - re-target to GLIBC_2.38 - add tst-auditdlmem.c test-case to test auditing - drop length page-aligning in tst-dlmem: mmap() aligns length on its own - bugfix: in do_mmapcpy() allow mmaps past end of buffer Changes in v3: - Changed prototype of dlmem() (and all the internal machinery) to use "const unsigned char *buffer" instead of "const char *buffer". Changes in v2: - use instead of "../test-skeleton.c" - re-target to GLIBC_2.37 - update all libc.abilist files