From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from forward500c.mail.yandex.net (forward500c.mail.yandex.net [178.154.239.208]) by sourceware.org (Postfix) with ESMTPS id BF4143858C50 for ; Wed, 5 Apr 2023 09:26:46 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org BF4143858C50 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-38.myt.yp-c.yandex.net (mail-nwsmtp-smtp-production-main-38.myt.yp-c.yandex.net [IPv6:2a02:6b8:c12:5ba1:0:640:dcdc:0]) by forward500c.mail.yandex.net (Yandex) with ESMTP id 427755E810; Wed, 5 Apr 2023 12:26:45 +0300 (MSK) Received: by mail-nwsmtp-smtp-production-main-38.myt.yp-c.yandex.net (smtp/Yandex) with ESMTPSA id gQLQna7Ww0U0-MatjTDc9; Wed, 05 Apr 2023 12:26:44 +0300 X-Yandex-Fwd: 1 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yandex.ru; s=mail; t=1680686804; bh=0cMpBQGVcTfIgpPixVY9ZVyRyxxb7f1luv11Uwv8iJs=; h=In-Reply-To:From:Date:References:To:Subject:Message-ID; b=I6U3bfyZGX9hLz0IBqFhNtMDS7lam3qBe6r++j4LW9TT+0z7+P94KQxnV1+jf7AVu ae1Wnr4W6TsAKBiLwZ+fPW6moKQBsVNMQNYnScs62pYrvpk7ewl0DFGZ1TLUkYFIMO YMvnRT9mr3kZY0eZptoxRoc4mNLR299SJuTgo2Gs= Authentication-Results: mail-nwsmtp-smtp-production-main-38.myt.yp-c.yandex.net; dkim=pass header.i=@yandex.ru Message-ID: <770aab11-a1d2-24e3-70bf-06ac5b20a298@yandex.ru> Date: Wed, 5 Apr 2023 14:26:41 +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 v9 0/13] implement dlmem() function Content-Language: en-US To: Szabolcs Nagy , Adhemerval Zanella Netto , libc-alpha@sourceware.org, janderson@rice.edu, Carlos O'Donell , Rich Felker References: <2f3a10fa-4f79-7f9a-6407-d227dbf31935@yandex.ru> <298b04a6-3055-b89b-59c1-4cfbe955848e@yandex.ru> <81749d04-8cdb-de0b-b88e-24347ed535ba@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.0 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,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 List-Id: 05.04.2023 13:51, Szabolcs Nagy пишет: > The 04/05/2023 12:29, stsp wrote: >> Hi Szabolcs, >> >> 03.04.2023 17:01, Szabolcs Nagy пишет: >>> a user callback must not run in a context where libc >>> internals are exposed (e.g. under internal locks). >> I checked that part a bit more, and so far >> my findings are (let me know if they are wrong): >> - That code indeed works under dl_load_lock, >>   but it calls audit callbacks rather freely, and >>   I don't see it releasing the lock before calling >>   the user audit callbacks. >> >> - dl_iterate_phdr() seems to be calling the user >>   callback under dl_load_write_lock lock. > this is a known bug. > > (audit is special because it is not an api for applications > but for tooling that hooks into dynamic linker internals, I had the version of the patch that added an audit callback instead of the direct callback. Do you think that's going to be better? In that case the dlmem() API is only documented for the basic tasks of loading a solib from memory. Audit module can then add an advanced functionality, but its not going to be a part of glibc. The problems around documenting maplength are not available in such an impl, since that became internal to an audit callback. > in any case dlmem has way too many issues beyond > the locking one, the fact that you don't document > nor understand the issues around the huge interface > boundary it creates does not help either. I understand the problem around maplength, and I wonder if getting back to an audit callback may be a solution to this and all the other problems you mentioned. Essentially in this case glibc has only a very small and simple call, and the rest is implemented by an author of an audit module.