From patchwork Thu Feb 23 08:09:12 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: stsp X-Patchwork-Id: 1746671 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=sourceware.org (client-ip=8.43.85.97; helo=sourceware.org; envelope-from=libc-alpha-bounces+incoming=patchwork.ozlabs.org@sourceware.org; receiver=) Authentication-Results: legolas.ozlabs.org; dkim=pass (1024-bit key; secure) header.d=sourceware.org header.i=@sourceware.org header.a=rsa-sha256 header.s=default header.b=KmgR1AUA; dkim-atps=neutral Received: from sourceware.org (server2.sourceware.org [8.43.85.97]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-384) server-digest SHA384) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4PMm6l6wFFz240V for ; Thu, 23 Feb 2023 19:15:27 +1100 (AEDT) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id B18E43858C5E for ; Thu, 23 Feb 2023 08:15:21 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org B18E43858C5E DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1677140121; bh=WgzftDpc1OiHGgPqEIqLyHmtoFeoUxrOV5xMp0jC2o0=; h=To:Cc:Subject:Date:List-Id:List-Unsubscribe:List-Archive: List-Post:List-Help:List-Subscribe:From:Reply-To:From; b=KmgR1AUAyI+QRnGvL0cFoqdarMpq0ToeS9t9Mw/Vi0vzPedqRxhTPp+wwj/y0AxAA cqFtJj5Ae5nJihiFjmmxBCHzW39KgGt1B8j3Cup315OxxB2YgxBGz6P0PEBQDvoXzn 2NpjKrh3XncZO654AplhhPtafhhWE5Eq4bMnhowg= X-Original-To: libc-alpha@sourceware.org Delivered-To: libc-alpha@sourceware.org Received: from forward108o.mail.yandex.net (forward108o.mail.yandex.net [37.140.190.206]) by sourceware.org (Postfix) with ESMTPS id 8455D3858C2C for ; Thu, 23 Feb 2023 08:15:06 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 8455D3858C2C Received: from forward100q.mail.yandex.net (forward100q.mail.yandex.net [IPv6:2a02:6b8:c0e:4b:0:640:4012:bb97]) by forward108o.mail.yandex.net (Yandex) with ESMTP id 840925DD8098 for ; Thu, 23 Feb 2023 11:09:26 +0300 (MSK) Received: from vla3-79cc00068f6d.qloud-c.yandex.net (vla3-79cc00068f6d.qloud-c.yandex.net [IPv6:2a02:6b8:c15:2582:0:640:79cc:6]) by forward100q.mail.yandex.net (Yandex) with ESMTP id 7F2976F40009 for ; Thu, 23 Feb 2023 11:09:26 +0300 (MSK) Received: by vla3-79cc00068f6d.qloud-c.yandex.net (smtp/Yandex) with ESMTPSA id O9KEnmwXZmI1-smt9Ixpz; Thu, 23 Feb 2023 11:09:26 +0300 X-Yandex-Fwd: 1 To: libc-alpha@sourceware.org Cc: Stas Sergeev Subject: [PATCH v2 0/2] minimal run-time audit support Date: Thu, 23 Feb 2023 13:09:12 +0500 Message-Id: <20230223080914.2961911-1-stsp2@yandex.ru> X-Mailer: git-send-email 2.37.2 MIME-Version: 1.0 X-Spam-Status: No, score=-4.7 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, FREEMAIL_ENVFROM_END_DIGIT, FREEMAIL_FROM, 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+incoming=patchwork.ozlabs.org@sourceware.org Sender: "Libc-alpha" Changes in v2: address the review comment of Jonathon Anderson: Add per-linkmap l_naudit counter to make sure each object is audited only with the modules loaded before it. That avoids the possibility of getting the "unrecognized" cookie. Test-case was enhanced to check for unrecognized cookies. This patch-set introduces the bare minimum functionality for working with audit modules at run-time. Patch1 fixes the check in dlmopen() which avoids loading solibs into the auditing namespace. But RTLD_NOLOAD was forgotten to check, and with that flags nothing gets loaded into auditing namespace, so dlmopen() should succeed and return the handle for auditing object. Patch2 adds dlload_audit_module() function and a test-case for it.