From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 127676 invoked by alias); 3 Oct 2019 15:31:17 -0000 Mailing-List: contact libc-alpha-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: libc-alpha-owner@sourceware.org Received: (qmail 127668 invoked by uid 89); 3 Oct 2019 15:31:17 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-1.9 required=5.0 tests=BAYES_00,SPF_HELO_PASS,SPF_PASS autolearn=ham version=3.3.1 spammy=H*r:4.80, HContent-Transfer-Encoding:8bit X-HELO: ou.quest-ce.net Message-ID: From: Yann Droneaud To: "libc-alpha@sourceware.org" Cc: Leandro Pereira Date: Thu, 03 Oct 2019 15:31:00 -0000 In-Reply-To: References: Content-Type: text/plain; charset="UTF-8" User-Agent: Evolution 3.32.4 (3.32.4-1.fc30) MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-SA-Exim-Connect-IP: 62.23.167.188 X-SA-Exim-Mail-From: ydroneaud@opteya.com Subject: Re: [PATCH 2/2] elf: Use nocancel pread64() instead of lseek()+read() X-SA-Exim-Version: 4.2.1 (built Mon, 26 Dec 2011 16:24:06 +0000) X-SA-Exim-Scanned: Yes (on ou.quest-ce.net) X-SW-Source: 2019-10/txt/msg00066.txt.bz2 Hi, Le lundi 05 août 2019 à 21:56 +0000, Leandro Pereira a écrit : > Transforms this, when linking in a shared object: > > openat(AT_FDCWD, "/lib64/libc.so.6", O_RDONLY|O_CLOEXEC) = 3 > read(3, "\177ELF\2\1\1\3"..., 832) = 832 > lseek(3, 792, SEEK_SET) = 792 > read(3, "\4\0\0\0\24\0\0\0"..., 68) = 68 > fstat(3, {st_mode=S_IFREG|0755, st_size=6699224, ...}) = 0 > lseek(3, 792, SEEK_SET) = 792 > read(3, "\4\0\0\0\24\0\0\0"..., 68) = 68 > lseek(3, 864, SEEK_SET) = 864 > read(3, "\4\0\0\0\20\0\0\0"..., 32) = 32 > > Into this: > > openat(AT_FDCWD, "/lib64/libc.so.6", O_RDONLY|O_CLOEXEC) = 3 > read(3, "\177ELF\2\1\1\3"..., 832) = 832 > pread(3, "\4\0\0\0\24\0\0\0"..., 68, 792) = 68 > fstat(3, {st_mode=S_IFREG|0755, st_size=6699224, ...}) = 0 > pread(3, "\4\0\0\0\24\0\0\0"..., 68, 792) = 68 > pread(3, "\4\0\0\0\20\0\0\0"..., 32, 864) = 32 > I confirm the behavior. And the usefulness of the patch. Anyway I'm quite surprised ld.so is reading twice 68 bytes at the same 792 offset. Moreover, the first read already brought 28 bytes out of 68. Could these read() be replaced by a call to mmap(), then using mremap() to brought the shared object in memory after initial inspection ? Regards. -- Yann Droneaud OPTEYA