From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on dcvr.yhbt.net X-Spam-Level: X-Spam-Status: No, score=-4.1 required=3.0 tests=AWL,BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,MAILING_LIST_MULTI, SPF_HELO_PASS,SPF_PASS shortcircuit=no autolearn=ham autolearn_force=no version=3.4.2 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 dcvr.yhbt.net (Postfix) with ESMTPS id 442861F66F for ; Tue, 22 Sep 2020 12:28:45 +0000 (UTC) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 6535A3987802; Tue, 22 Sep 2020 12:28:44 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 6535A3987802 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1600777724; bh=kzltS1yIWjqToxeYvGQq9MoOqLs92JqdO4/cKxTS1WY=; h=References:In-Reply-To:Date:Subject:To:List-Id:List-Unsubscribe: List-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To:Cc: From; b=IcKqVH/A6ktFOixvX8YxoZ6VLaFKnV2ciT8V0qfM/K/pU8+o/NtRCQfX1aj+wQEVj ud4glyNiQMhMy5Ysc4qT4ndryZJecfSG2Q/7fXRYT724sGYk2oQBTUOdp8cJAroUkf IBuxQzYUJ37ebbNlu/IFJLl0j9dOH5q/zIHtrZeA= Received: from mail-il1-x143.google.com (mail-il1-x143.google.com [IPv6:2607:f8b0:4864:20::143]) by sourceware.org (Postfix) with ESMTPS id 2AD31384C004 for ; Tue, 22 Sep 2020 12:28:42 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org 2AD31384C004 Received: by mail-il1-x143.google.com with SMTP id s88so17056564ilb.6 for ; Tue, 22 Sep 2020 05:28:42 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=kzltS1yIWjqToxeYvGQq9MoOqLs92JqdO4/cKxTS1WY=; b=a9lFXG3ylDJmEIpZf7MjkldUcbxmPwwGC+qGUrq5n2Qyu2h/g6FZfemqTKgoGojAI0 PXrJ3o9JklN7WhmWoZjYsCNF309KMNBdJsEBQF7ZRjDJVZpkHxUwTDsOsctwnypHIxmG EWunpprFOd3o8qZ8pI2Rdj191kF4JIBmSQPFuZbmOZH70FhOXnC4GCvp3xAPzBUhH71n PD43tqjrqxRSVhhfHRpvDZtjxR0/nYwNy7CPPU9DSGNtcWmfN045ZBeAWmQ7Vbnid1pE E5aeR1/yYBpZstkRxRYOB1dqXHfEI8YfBXIEqghV599lhltKGc8CnFrA4hd2wBKBMiZq wUoA== X-Gm-Message-State: AOAM532PyXZpFUsoxpHaSi9O9mtQi8UAO0HW9s5e5l31/VpyvMKGornb rWg81CZzTJN/swqJbKMkQZt3aEWvgACuydv5L02bvpV6Oas= X-Google-Smtp-Source: ABdhPJyhgx2mJF+iyF3uY2+6wmuAC2FclaNhg3iFA5BRxynddMwisBmiGCnHH2FMakSpQoyxTbXd/MzQOOiQBzVV/y8= X-Received: by 2002:a92:6a0c:: with SMTP id f12mr3721300ilc.213.1600777721724; Tue, 22 Sep 2020 05:28:41 -0700 (PDT) MIME-Version: 1.0 References: <20200922121300.3503-1-eb@emlix.com> <20200922121300.3503-2-eb@emlix.com> In-Reply-To: <20200922121300.3503-2-eb@emlix.com> Date: Tue, 22 Sep 2020 05:28:05 -0700 Message-ID: Subject: Re: [PATCH 2/2] rtld: turn "Already zero" assumptions into asserts To: Rolf Eike Beer Content-Type: text/plain; charset="UTF-8" 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: , From: "H.J. Lu via Libc-alpha" Reply-To: "H.J. Lu" Cc: GNU C Library Errors-To: libc-alpha-bounces@sourceware.org Sender: "Libc-alpha" On Tue, Sep 22, 2020 at 5:13 AM Rolf Eike Beer wrote: > > --- > elf/rtld.c | 6 +++--- > 1 file changed, 3 insertions(+), 3 deletions(-) > > diff --git a/elf/rtld.c b/elf/rtld.c > index 99d130cd1c..441d837095 100644 > --- a/elf/rtld.c > +++ b/elf/rtld.c > @@ -1449,7 +1449,7 @@ of this helper program; chances are you did not intend to run this program.\n\ > the shared object is already loaded. */ > _dl_rtld_libname.name = ((const char *) main_map->l_addr > + ph->p_vaddr); > - /* _dl_rtld_libname.next = NULL; Already zero. */ > + assert(_dl_rtld_libname.next == NULL); Space after assert. Same applies to other changes. and there are rtld.c:static struct libname_list _dl_rtld_libname; rtld.c:static struct libname_list _dl_rtld_libname2; There is no need for assert of zero on static variables. > GL(dl_rtld_map).l_libname = &_dl_rtld_libname; > > /* Ordinarilly, we would get additional names for the loader from > @@ -1470,7 +1470,7 @@ of this helper program; chances are you did not intend to run this program.\n\ > if (p != NULL) > { > _dl_rtld_libname2.name = p; > - /* _dl_rtld_libname2.next = NULL; Already zero. */ > + assert(_dl_rtld_libname2.next == NULL); > _dl_rtld_libname.next = &_dl_rtld_libname2; > } > } > @@ -1555,7 +1555,7 @@ of this helper program; chances are you did not intend to run this program.\n\ > /* We were invoked directly, so the program might not have a > PT_INTERP. */ > _dl_rtld_libname.name = GL(dl_rtld_map).l_name; > - /* _dl_rtld_libname.next = NULL; Already zero. */ > + assert(_dl_rtld_libname.next == NULL); > GL(dl_rtld_map).l_libname = &_dl_rtld_libname; > } > else > -- > 2.28.0 > -- H.J.