From patchwork Sun Feb 26 11:16:35 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: stsp X-Patchwork-Id: 1748074 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=HXCxdK5I; 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 4PPh1j4CNZz240p for ; Sun, 26 Feb 2023 22:17:45 +1100 (AEDT) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 8F35A385043F for ; Sun, 26 Feb 2023 11:17:43 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 8F35A385043F DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1677410263; bh=ik2KKi6JWsSLPKk+Hp87n5NKIXqrXLJmusNxfwLUWsA=; h=To:Cc:Subject:Date:List-Id:List-Unsubscribe:List-Archive: List-Post:List-Help:List-Subscribe:From:Reply-To:From; b=HXCxdK5Ic7A3SXdfrsWW0ci2RCzcw0+ovXsd4dqGLfI+j/jPKdb4m+emOPmL9eoI3 G9jS5Dtwgd8eXnSLK6MBKtKC+T+BjAKCmEn5wRwglIWFGHOjW2uRg1nEUN53rccDJj voiycGiMlXQuertCgVeDRzIf9Xlvgo82i0e3E7e8= X-Original-To: libc-alpha@sourceware.org Delivered-To: libc-alpha@sourceware.org Received: from forward105p.mail.yandex.net (forward105p.mail.yandex.net [77.88.28.108]) by sourceware.org (Postfix) with ESMTPS id BB7223858413 for ; Sun, 26 Feb 2023 11:16:45 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org BB7223858413 Received: from iva7-711d0b0d05cd.qloud-c.yandex.net (iva7-711d0b0d05cd.qloud-c.yandex.net [IPv6:2a02:6b8:c0c:2e88:0:640:711d:b0d]) by forward105p.mail.yandex.net (Yandex) with ESMTP id E50742FD807E for ; Sun, 26 Feb 2023 14:16:43 +0300 (MSK) Received: by iva7-711d0b0d05cd.qloud-c.yandex.net (smtp/Yandex) with ESMTPSA id fGQmMQcaZ4Y1-SfMGz3XH; Sun, 26 Feb 2023 14:16:43 +0300 X-Yandex-Fwd: 1 To: libc-alpha@sourceware.org Cc: Stas Sergeev Subject: [PATCH v4 0/2] minimal run-time audit support Date: Sun, 26 Feb 2023 16:16:35 +0500 Message-Id: <20230226111637.1541915-1-stsp2@yandex.ru> X-Mailer: git-send-email 2.37.2 MIME-Version: 1.0 X-Spam-Status: No, score=-3.8 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_NONE, 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 v4: rebased, conflicts resolved. Changes in v3: address the review comment of Jonathon Anderson: Disable 3 audit call-backs for dynamically loaded modules. Namely symbind, pltenter, pltexit. Extend test-case to make sure they are not resolved and not called. 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.