From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from forward202c.mail.yandex.net (forward202c.mail.yandex.net [178.154.239.219]) by sourceware.org (Postfix) with ESMTPS id E307E3858C5E for ; Tue, 28 Feb 2023 16:52:05 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org E307E3858C5E 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 iva4-143b1447cf50.qloud-c.yandex.net (iva4-143b1447cf50.qloud-c.yandex.net [IPv6:2a02:6b8:c0c:7511:0:640:143b:1447]) by forward202c.mail.yandex.net (Yandex) with ESMTP id C8D66600C2 for ; Tue, 28 Feb 2023 19:52:03 +0300 (MSK) Received: by iva4-143b1447cf50.qloud-c.yandex.net (smtp/Yandex) with ESMTPSA id xpXnhH0ca4Y1-L0sEh8N7; Tue, 28 Feb 2023 19:52:03 +0300 X-Yandex-Fwd: 1 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yandex.ru; s=mail; t=1677603123; bh=nZihGjoaGJvHThZq1CM+FMCZNvKR6LheeR/xgcK1we4=; h=Message-Id:Date:In-Reply-To:Cc:Subject:References:To:From; b=S/GnpNTyXcLSyNQcjztVqPP+nczPo1kNBMxAX9UvsUEpQdGWPT7Pq9db9LzqdRCpa Ol/+vuiURxpMFkS1RZ7wUV+J4WT5wDwDsNL+AgfEsZqWrHbTR2KCXBHFV5JSduSkMi EtkXijN4PzKnqrRZzZb8AQB3morWCQjs2eo27JGY= Authentication-Results: iva4-143b1447cf50.qloud-c.yandex.net; dkim=pass header.i=@yandex.ru From: Stas Sergeev To: libc-alpha@sourceware.org Cc: Stas Sergeev Subject: [PATCH 1/2] elf/dl-open: fix audit wrt RTLD_NOLOAD [BZ #30127] Date: Tue, 28 Feb 2023 21:51:57 +0500 Message-Id: <20230228165158.685970-2-stsp2@yandex.ru> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20230228165158.685970-1-stsp2@yandex.ru> References: <20230228165158.685970-1-stsp2@yandex.ru> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-10.0 required=5.0 tests=BAYES_00,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_ENVFROM_END_DIGIT,FREEMAIL_FROM,GIT_PATCH_0,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: Currently dlmopen() does not allow to load objects into an audit namespace. But the RTLD_NOLOAD case was forgotten, so the too restrictive check prevents even getting a handle for an objects in an audit namespace. This patch fixes the problem by relaxing a check in case of RTLD_NOLOAD. Test-case on x86_64 revealed no regressions. Signed-off-by: Stas Sergeev --- elf/dl-open.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/elf/dl-open.c b/elf/dl-open.c index 91a2d8a538..c7ce0396d3 100644 --- a/elf/dl-open.c +++ b/elf/dl-open.c @@ -864,7 +864,8 @@ no more namespaces available for dlmopen()")); DL_NNS is 1 and so any NSID != 0 is invalid. */ || DL_NNS == 1 || GL(dl_ns)[nsid]._ns_nloaded == 0 - || GL(dl_ns)[nsid]._ns_loaded->l_auditing)) + || (GL(dl_ns)[nsid]._ns_loaded->l_auditing && + !(mode & RTLD_NOLOAD)))) _dl_signal_error (EINVAL, file, NULL, N_("invalid target namespace in dlmopen()")); -- 2.37.2