From patchwork Mon Jul 19 14:33:03 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Adhemerval Zanella Netto X-Patchwork-Id: 1507087 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=sourceware.org (client-ip=2620:52:3:1:0:246e:9693:128c; helo=sourceware.org; envelope-from=libc-alpha-bounces+incoming=patchwork.ozlabs.org@sourceware.org; receiver=) Authentication-Results: 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=GdAtufvZ; dkim-atps=neutral Received: from sourceware.org (server2.sourceware.org [IPv6:2620:52:3:1:0:246e:9693:128c]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 4GT48X0xwtz9sRf for ; Tue, 20 Jul 2021 00:33:31 +1000 (AEST) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 7CF313951883 for ; Mon, 19 Jul 2021 14:33:29 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 7CF313951883 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1626705209; bh=SxDo260BfUim+6Nz9HyFfq7KO6/c6pVjWj2tYXSdI5k=; h=To:Subject:Date:List-Id:List-Unsubscribe:List-Archive:List-Post: List-Help:List-Subscribe:From:Reply-To:Cc:From; b=GdAtufvZ7HY0OnnLijQwHnyWrmVaMwEKb19xvDi1DW71tF2BR7E9qa4BZkR0zOpQ1 6nVJ04kkfa5rDPgwqIrZpTDkqby0QCsUd3ZgTYElNJtIY8+e2qWSPc4AaOJ0rsW04W r0TNTQfYSMFK68BZREACMCykFeO2O+J34D9aUmnc= X-Original-To: libc-alpha@sourceware.org Delivered-To: libc-alpha@sourceware.org Received: from mail-pg1-x52f.google.com (mail-pg1-x52f.google.com [IPv6:2607:f8b0:4864:20::52f]) by sourceware.org (Postfix) with ESMTPS id A5DC9385042B for ; Mon, 19 Jul 2021 14:33:14 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org A5DC9385042B Received: by mail-pg1-x52f.google.com with SMTP id i16so1613742pgi.9 for ; Mon, 19 Jul 2021 07:33:14 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=SxDo260BfUim+6Nz9HyFfq7KO6/c6pVjWj2tYXSdI5k=; b=ebSuD5uO1OA9AR/ihJ98Riz/T5+RY7LPXrMocmj2DmWFgfQhK+6B6xeidoGnfv9NnM NYzywJqCUr7pBP6SrI6HggFVrdMMCeyxdIvLUNPOI2zLfi9iDDUD0UB9DiUNGmrlEw33 uMlRDoy6aYJqhIJvY0y5Fci8/EpoF39tnAE26r4F31EXEdBojlXLXGO1H7iN92JZwe2N amaZvpyu3RvfH3P+Pmj9RXCGUId20XeK53o0JHcCJ3mbcRCj772YoVjgEcIyjxTPMBot lnSwLLZnZmxgagOeQTF2kwSrkkv9OkQCNN4h1VH+MpgUEGFL1RK49VcK64KtwdqPZbuE PlRA== X-Gm-Message-State: AOAM533MIJosLIF5a7wxgIwsGzBDfXNvAFBoGnRMhPgO/ytKj4rKPejD mkhjNpvXaCw4Cl0obRPSNlHo8A0zAhsoPw== X-Google-Smtp-Source: ABdhPJzZGWbZfJYMiotcwx1b2iHGLCPp5YcC69Q1DCedH4bnFFQUxMCdSR8MhmbHg3argF2x5TPhzg== X-Received: by 2002:a63:3113:: with SMTP id x19mr19625724pgx.328.1626705193530; Mon, 19 Jul 2021 07:33:13 -0700 (PDT) Received: from birita.. ([2804:431:c7ca:1133:c8a4:b05d:5ba9:3665]) by smtp.gmail.com with ESMTPSA id y13sm21461214pgp.16.2021.07.19.07.33.12 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 19 Jul 2021 07:33:13 -0700 (PDT) To: libc-alpha@sourceware.org Subject: [PATCH v2 0/6] Some rtld-audit fixes Date: Mon, 19 Jul 2021 11:33:03 -0300 Message-Id: <20210719143309.2848878-1-adhemerval.zanella@linaro.org> X-Mailer: git-send-email 2.30.2 MIME-Version: 1.0 X-Spam-Status: No, score=-5.7 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, RCVD_IN_DNSWL_NONE, SPF_HELO_NONE, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.4 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) 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: Adhemerval Zanella via Libc-alpha From: Adhemerval Zanella Netto Reply-To: Adhemerval Zanella Cc: John Mellor-Crummey Errors-To: libc-alpha-bounces+incoming=patchwork.ozlabs.org@sourceware.org Sender: "Libc-alpha" Changes from v1 [1] - Fixed -fstack-protector-all tst-auditmod17. - Simplify the _dl_call_libc_early_init call the 'Fix audit regression' patch. - Remove symbind check fr BZ#15333. - Added the BZ#28096 fix. --- This patchset fixes some rtld-audit issues brought by John Mellor-Crummey [2] while trying to use it along with the HPCToolkit tool. This should cover the issues listed as 'Tier 1' [3], modulo the aarch64 onexi (which I plan to address in a different patch set) and also an important 'Tier2' issue (BZ#28096) which prevents the use of some glibc function that uses TLS internally on the audir module. The first patch fixes a regression issue introduced by a __libc_early_init() change. The second patch is long-standing issue where the lazy resolution trampolines are used even when the audit modules does not implement the PLT or symbol binding callback. The original patch from Alexander Monakov is incomplete, since it also requires to take la_symbind{32,64} in consideration. The third patch add some tests to check if TLSDESC works along with audit modules. The forth patch fixes an issue when a dlmopen failure in a audit module callback trigger an assert. The fifth patch fixes another dlmopen failure when audit module is used along with dlmopen. This patch was proposed along with RTLD_SHARED support, so I added a regression test. The final patch fixes an issue where the initial-exec TLS are reset after the audit modules is already loader (thus clearing any state that the library might update). [1] https://patchwork.sourceware.org/project/glibc/list/?series=2443 [2] https://sourceware.org/pipermail/libc-alpha/2021-June/127636.html [3] https://docs.google.com/document/d/1dVaDBdzySecxQqD6hLLzDrEF18M1UtjDna9gL5BWWI0/edit# Adhemerval Zanella (5): elf: Fix audit regression elf: Avoid unnecessary slowdown from profiling with audit (BZ#15533) elf: Add audit tests for modules with TLSDESC elf: Do not fail for failed dlopem on audit modules (BZ #28061) elf: Fix initial-exec TLS access on audit modules (BZ #28096) Vivek Das Mohapatra (1): elf: Suppress audit calls when a (new) namespace is empty (BZ #28062) NEWS | 4 ++ elf/Makefile | 43 ++++++++++- elf/dl-load.c | 7 +- elf/dl-object.c | 3 + elf/dl-open.c | 12 +--- elf/dl-reloc.c | 12 +++- elf/dl-tls.c | 16 +++-- elf/rtld.c | 10 +-- elf/tst-audit-tlsdesc-audit.c | 23 ++++++ elf/tst-audit-tlsdesc-dlopen.c | 67 +++++++++++++++++ elf/tst-audit-tlsdesc.c | 60 ++++++++++++++++ elf/tst-audit17.c | 25 +++++++ elf/tst-audit18.c | 39 ++++++++++ elf/tst-audit19.c | 25 +++++++ elf/tst-audit20.c | 128 +++++++++++++++++++++++++++++++++ elf/tst-audit20mod.c | 26 +++++++ elf/tst-audit21.c | 42 +++++++++++ elf/tst-auditmod-tlsdesc1.c | 41 +++++++++++ elf/tst-auditmod-tlsdesc2.c | 33 +++++++++ elf/tst-auditmod17.c | 23 ++++++ elf/tst-auditmod18.c | 24 +++++++ elf/tst-auditmod19.c | 57 +++++++++++++++ elf/tst-auditmod20.c | 73 +++++++++++++++++++ elf/tst-auditmod21.c | 69 ++++++++++++++++++ include/link.h | 4 ++ 25 files changed, 840 insertions(+), 26 deletions(-) create mode 100644 elf/tst-audit-tlsdesc-audit.c create mode 100644 elf/tst-audit-tlsdesc-dlopen.c create mode 100644 elf/tst-audit-tlsdesc.c create mode 100644 elf/tst-audit17.c create mode 100644 elf/tst-audit18.c create mode 100644 elf/tst-audit19.c create mode 100644 elf/tst-audit20.c create mode 100644 elf/tst-audit20mod.c create mode 100644 elf/tst-audit21.c create mode 100644 elf/tst-auditmod-tlsdesc1.c create mode 100644 elf/tst-auditmod-tlsdesc2.c create mode 100644 elf/tst-auditmod17.c create mode 100644 elf/tst-auditmod18.c create mode 100644 elf/tst-auditmod19.c create mode 100644 elf/tst-auditmod20.c create mode 100644 elf/tst-auditmod21.c