From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by sourceware.org (Postfix) with ESMTPS id 4F8853858C62 for ; Wed, 22 May 2024 22:04:29 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 4F8853858C62 Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=redhat.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=redhat.com ARC-Filter: OpenARC Filter v1.0.0 sourceware.org 4F8853858C62 Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=170.10.129.124 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1716415470; cv=none; b=IsI0IHZT7O4Z90Igwtvjy79fauDP0h8El+j+aB0cMNa4+UqTQPANphJ/4V+K+78f5/rPkh3ULa9VYwr4Bms1bv0OoGXoSpklP50MlppdjA9aRUtt0RcVEm7HoQk3DwiCzIE5uNVdVIGwO5UZqJG9hwHCV9w8FpaIxL7aP3fGJ+w= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1716415470; c=relaxed/simple; bh=+zbomfq9GVWc6kMcM5suTkXh9W4mKvsrIyDeBa5ggA8=; h=DKIM-Signature:MIME-Version:From:Date:Message-ID:Subject:To; b=iOEJUhjeykGspF48RX0FZ2fvhwu7HSNm3C58fALTUeloBneXhzL+VFAaldrwsypyeKjaS9HTXETnDkoHQ/tviJz+fXTR50Y0gRV3BM2h6BwozkhjFGyLOh3xg58jb+X4wzdaEMb89AFdSWXTVH5q6n6AyuDXjU6fIrJXoCufuKY= ARC-Authentication-Results: i=1; server2.sourceware.org DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1716415469; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=IzWLCaBiKzd6Kz+BZx5U7kYo+pI22GAG3XHarbAtrgw=; b=ZN2XFY+WQr9/QI14JAyCa6nZtjHeG0KgSoDMq5ktMaDrnA5+SfP+IpGEnHMXLipRqn/F0w YAaluc7lIbVtT79Sw9WTF41pft6hoZsCS56QZoLiqlXwUTKGgzeYYFJ6JjGj1sqJ0of03s n5ruUmTX4X/E2TkFJY3qJrPoiOrqSr8= Received: from mail-ot1-f71.google.com (mail-ot1-f71.google.com [209.85.210.71]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-615-5IRxEsx5M3KZ4U4qfX0URw-1; Wed, 22 May 2024 18:04:27 -0400 X-MC-Unique: 5IRxEsx5M3KZ4U4qfX0URw-1 Received: by mail-ot1-f71.google.com with SMTP id 46e09a7af769-6f7c863ff09so202027a34.1 for ; Wed, 22 May 2024 15:04:27 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1716415467; x=1717020267; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=IzWLCaBiKzd6Kz+BZx5U7kYo+pI22GAG3XHarbAtrgw=; b=nbqIZl45spiHsoj7WVcty21di9AbnahHuQALmfJYXLMPTQqgbI8W2F9pPQYo1I0AVo 6qvDND/Jj+2t/aCFKvDWxQeuR8K2zkHow96aZnL0zasU3h9Ig2wkN6gOm8NdQNoS3qPG csC7SyGOKrnIQcAkovsTqtI//3c5yEk3abIgn3BA+iJicALrZEWzUYxW25XccvgaV0uX krarmx0FgeV2cBMx7S4zL63to++ENUL1ivrcc9hUxtLrg8+y2uc1/C+Ju+zsZgPstRns Ww04f+j6ueiCcNVR2XK2+uQtp59Q+/f5S5PSuEys3umOaZTbzluH3odgu/JLd5J4hJ7V s+3w== X-Forwarded-Encrypted: i=1; AJvYcCW3LLKBcNDnqe6HJJHnIPbKQAWRZhPUoF8rDUFYMJMPtSqfbqqf0gjApmR6lrRIhWmCZOUBrBKW52qVb4NBqhVP5NNR+1lZf7AU X-Gm-Message-State: AOJu0YwUz8TqufsKFfkYkxYS4czItGj6snH9NjJ/iLQs7uPE7pg0Ecy5 Q/bqPfFae9csnkaEAuZuuOclFm9iI7PtEAGHutYY7hZH1Zjwwa/GJ8UwagR688lgQBxhZfQ8TBf br/xk0XhfW708T3XzeeAWUA52tR4sNTiy3eXz8r3hInNiG1lQj3QJqN4Dps7YfeUO/sUFTTqIh6 nU51OOnSRLuhgrw9eCVqHPVqSzbiUsL/fU X-Received: by 2002:a05:6808:188d:b0:3c9:98b4:d1f6 with SMTP id 5614622812f47-3d04526f52emr279616b6e.7.1716415466776; Wed, 22 May 2024 15:04:26 -0700 (PDT) X-Google-Smtp-Source: AGHT+IHvxRpdxgxyjvbVi5GunVTTXH/tqGgzSJTWn3XmYPK1wcxAKKQIOskmndX0FgyJONq6+BzjhFvULQ40UsCdiPo= X-Received: by 2002:a05:6808:188d:b0:3c9:98b4:d1f6 with SMTP id 5614622812f47-3d04526f52emr279593b6e.7.1716415466357; Wed, 22 May 2024 15:04:26 -0700 (PDT) MIME-Version: 1.0 References: <20240521151039.174595-1-saypaul@redhat.com> <7f72dead-9024-4385-847e-cb007ec8f772@app.fastmail.com> In-Reply-To: <7f72dead-9024-4385-847e-cb007ec8f772@app.fastmail.com> From: Arjun Shankar Date: Thu, 23 May 2024 00:04:15 +0200 Message-ID: Subject: Re: [PATCH v2] malloc:New test to check malloc alternate path using memory obstruction To: Zack Weinberg Cc: sayan paul , GNU libc development , tools-patches@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset="UTF-8" X-Spam-Status: No, score=-5.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H4,RCVD_IN_MSPIKE_WL,RCVD_IN_SORBS_WEB,SPF_HELO_NONE,SPF_NONE,TXREP autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org List-Id: > > + if (obstruction_addr == MAP_FAILED) > > + { > > + perror ("mmap"); > > + return 1; > > Isn't there a special exit code to distinguish "the test itself > malfunctioned" from "the test has failed"? Returning 99 instead of 1 > or something like that? I don't think there's a way to explicitly indicate test rig failures, but one change that could still be made for test assertions here is to use the (relatively) new way we make test assertions using support/check.h. e.g. the above block can reasonably be replaced with the single line "TEST_VERIFY_EXIT (obstruction_addr != MAP_FAILED);". The assertion and line number information this macro prints upon failure can possibly make it easier to recognize the cause of a test failure. It looks like both consecutive checks against obstruction_addr can possibly be replaced with a single check directly against the result of mmap, i.e. "TEST_VERIFY_EXIT (mmap (...) == next_page_boundary);". There is also TEST_VERIFY that can log errors (and guarantees test failure at the end of execution) but lets the test program continue executing.