From patchwork Fri Sep 25 08:48:37 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Florian Weimer X-Patchwork-Id: 40501 Return-Path: X-Original-To: patchwork@sourceware.org Delivered-To: patchwork@sourceware.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 0D38F396E83D; Fri, 25 Sep 2020 08:48:49 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 0D38F396E83D DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1601023729; bh=qULHxo34ubrFAP/cecI98Yo/UFPvTWyuZCdfTUMV0sM=; h=To:Subject:Date:List-Id:List-Unsubscribe:List-Archive:List-Post: List-Help:List-Subscribe:From:Reply-To:Cc:From; b=sn11DIrds3yZ89RjbS8nnUemuoLgcsM2QgKMbR4/3GUVeDYR9+tXJUVQNH7NBOyRt 3L40Wgg9oaJGPN9g1wUBTSazxi4XupsOfPKLRK8IRZpPXwhd3XuSkMWunShG69b4LI MZortVSyIJ8lH1EvbtrRkG7UJON9e4quWsiGbkCo= X-Original-To: libc-alpha@sourceware.org Delivered-To: libc-alpha@sourceware.org Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [63.128.21.124]) by sourceware.org (Postfix) with ESMTP id 25787383E802 for ; Fri, 25 Sep 2020 08:48:46 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org 25787383E802 Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-274-G-SjrGfrMICftUsR3WGJEQ-1; Fri, 25 Sep 2020 04:48:43 -0400 X-MC-Unique: G-SjrGfrMICftUsR3WGJEQ-1 Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id D88B51084D81; Fri, 25 Sep 2020 08:48:42 +0000 (UTC) Received: from oldenburg2.str.redhat.com (ovpn-114-84.ams2.redhat.com [10.36.114.84]) by smtp.corp.redhat.com (Postfix) with ESMTPS id F2F0460C17; Fri, 25 Sep 2020 08:48:38 +0000 (UTC) To: linux-man@vger.kernel.org Subject: [PATCH] rtld-audit.7: Clarify la_version handshake Date: Fri, 25 Sep 2020 10:48:37 +0200 Message-ID: <87k0wifdi2.fsf@oldenburg2.str.redhat.com> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.1 (gnu/linux) MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 X-Spam-Status: No, score=-12.1 required=5.0 tests=BAYES_00, DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H5, RCVD_IN_MSPIKE_WL, SPF_HELO_NONE, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.2 X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) 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: Florian Weimer via Libc-alpha From: Florian Weimer Reply-To: Florian Weimer Cc: libc-alpha@sourceware.org Errors-To: libc-alpha-bounces@sourceware.org Sender: "Libc-alpha" Returning its argument without further checks is almost always wrong for la_version. Signed-off-by: Florian Weimer Reviewed-by: Carlos O'Donell --- man7/rtld-audit.7 | 36 +++++++++++++++++++++++++----------- 1 file changed, 25 insertions(+), 11 deletions(-) diff --git a/man7/rtld-audit.7 b/man7/rtld-audit.7 index b1b7dfebc..21cc339d0 100644 --- a/man7/rtld-audit.7 +++ b/man7/rtld-audit.7 @@ -70,17 +70,30 @@ the auditing library. When invoking this function, the dynamic linker passes, in .IR version , the highest version of the auditing interface that the linker supports. -If necessary, the auditing library can check that this version -is sufficient for its requirements. .PP -As its function result, -this function should return the version of the auditing interface -that this auditing library expects to use (returning +A typical implementation of this function simply returns the constant +.BR LAV_CURRENT , +which indicates the version of +.I +that was used to build the audit module. If the dynamic linker does +not support this version of the audit interface, it will refuse to +activate this audit module. If the function returns zero, the dynamic +linker also does not activate this audit module. +.PP +In order to enable backwards compatibility with older dynamic linkers, +an audit module can examine the +.I version +argument and return an earlier version than +.BR LAV_CURRENT , +assuming the module can adjust its implementation to match the +requirements of the previous version of the audit interface. The +.B la_version +function should not return the value of .I version -is acceptable). -If the returned value is 0, -or a version that is greater than that supported by the dynamic linker, -then the audit library is ignored. +without further checks because it could correspond to an interface +that does not match the +.I +definitions used to build the audit module. .SS la_objsearch() \& .nf @@ -508,9 +521,10 @@ This is reportedly fixed in glibc 2.10. unsigned int la_version(unsigned int version) { - printf("la_version(): %u\en", version); + printf("la_version(): version = %u; LAV_CURRENT = %u\en", + version, LAV_CURRENT); - return version; + return LAV_CURRENT; } char *