From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-oi1-x22a.google.com (mail-oi1-x22a.google.com [IPv6:2607:f8b0:4864:20::22a]) by sourceware.org (Postfix) with ESMTPS id 258A938515D9 for ; Wed, 26 Jan 2022 12:18:40 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 258A938515D9 Received: by mail-oi1-x22a.google.com with SMTP id y23so18775587oia.13 for ; Wed, 26 Jan 2022 04:18:40 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:message-id:date:mime-version:user-agent:subject :content-language:to:cc:references:from:in-reply-to :content-transfer-encoding; bh=vH4/XVpoosUw8RhFpajFETosvwwRMP0vIT1M5cYbOB4=; b=5QD6SxKMc8EC7Awkh7FW1t5zgtkBrdTnAkSD0aDMmIlTge57lVlqlcBA3h2Nx6jmRr FZedVCVk1haf/xFvVsezW/o8EofqHNQ0DE4sy4aspkFKvnclDGOdEzeUBhgosxe4Ddj1 icKve/1s0RphylSLp3LdaCjjiUhrqNw9rZNQ2hs1xFVk5pty2+c590WoTHgfHZo1b+lH GWn3SMfSfHUPiRCSthhqld8NGmfPJcNHkAPxJdfEwMjLlgkRVafZMBVef3CxEdIDwQRv Rp9qC0dhfnWgTraCKPY7xmM9S61aRzvwoid/o3Qhlt4mLou3pr6+MgCbA76MgcLoG3Kt YhPg== X-Gm-Message-State: AOAM531ggjSe+iawGRAeZka8E9wxTVFKJ3KzlXuO3kwEi17Yfwg1cRSp Qx4SN4WLvrsXRWQlKVdtzHftUA== X-Google-Smtp-Source: ABdhPJxY38DtyOEYocjNU6pbQbOJdEx6xmUNB51ZpZlZdhMa7DTps4N8a4Yj+zq5xAKWd/I3pOMZ/g== X-Received: by 2002:a05:6808:1490:: with SMTP id e16mr3345093oiw.206.1643199519609; Wed, 26 Jan 2022 04:18:39 -0800 (PST) Received: from ?IPV6:2804:431:c7cb:27f8:9b70:219c:7964:43d? ([2804:431:c7cb:27f8:9b70:219c:7964:43d]) by smtp.gmail.com with ESMTPSA id v31sm1887940ott.25.2022.01.26.04.18.37 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Wed, 26 Jan 2022 04:18:39 -0800 (PST) Message-ID: Date: Wed, 26 Jan 2022 09:18:36 -0300 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.5.0 Subject: Re: [PATCH v12 1/4] elf: Add la_activity during application exit Content-Language: en-US To: Florian Weimer , Adhemerval Zanella via Libc-alpha Cc: jma14 , Carlos O'Donell , John Mellor-Crummey References: <20220125183700.1280931-1-adhemerval.zanella@linaro.org> <20220125183700.1280931-2-adhemerval.zanella@linaro.org> <87sftau3j8.fsf@oldenburg.str.redhat.com> From: Adhemerval Zanella In-Reply-To: <87sftau3j8.fsf@oldenburg.str.redhat.com> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-6.1 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, NICE_REPLY_A, 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-List-Received-Date: Wed, 26 Jan 2022 12:18:41 -0000 On 26/01/2022 08:42, Florian Weimer wrote: > * Adhemerval Zanella via Libc-alpha: > >> +static int >> +do_test (int argc, char *argv[]) >> +{ >> + /* We must have either: >> + - One our fource parameters left if called initially: >> + + path to ld.so optional >> + + "--library-path" optional >> + + the library path optional >> + + the application name */ >> + if (restart) >> + return handle_restart (); >> + >> + char *spargv[9]; >> + int i = 0; >> + for (; i < argc - 1; i++) >> + spargv[i] = argv[i + 1]; >> + spargv[i++] = (char *) "--direct"; >> + spargv[i++] = (char *) "--restart"; >> + spargv[i] = NULL; >> + TEST_VERIFY_EXIT (i < array_length (spargv)); > > Sorry, I think this test is invalid because it happens after the > out-of-bounds write. I expect that compilers will eventually warn about > that. It seems that at least gcc 11 does not warn if the array is not large enough. Maybe this is better: char *spargv[9]; TEST_VERIFY_EXIT (((argc - 1) + 3) < array_length (spargv)); int i = 0; for (; i < argc - 1; i++) spargv[i] = argv[i + 1]; spargv[i++] = (char *) "--direct"; spargv[i++] = (char *) "--restart"; spargv[i] = NULL;