From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from smtp-out2.suse.de (smtp-out2.suse.de [IPv6:2001:67c:2178:6::1d]) by sourceware.org (Postfix) with ESMTPS id 8F7213858D32 for ; Tue, 5 Sep 2023 07:38:53 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 8F7213858D32 Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=suse.de Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=suse.de Received: from relay2.suse.de (relay2.suse.de [149.44.160.134]) by smtp-out2.suse.de (Postfix) with ESMTP id 5B2F51F74D; Tue, 5 Sep 2023 07:38:52 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1693899532; h=from:from:reply-to: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=dLmdu1uRU8YPC+akD5MLLw4/pD6+JX4nidsjBeg7eiY=; b=AjXHO3Iwsa8bykRu8QDMqACK1wCUBPcUZo+e04QGeQC8S9GQ+QDJjEdqJzB8LzuWMPq9v9 XpM6YYr1vSZsrd7YyNzEA9srzZziTnjS5KiDk00uUiqrM2DgGkQ1wp7LFrHfsO82ev7uH6 d0bCWbhO/pl7Ww0uEwWIzzurkVPrz6o= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1693899532; h=from:from:reply-to: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=dLmdu1uRU8YPC+akD5MLLw4/pD6+JX4nidsjBeg7eiY=; b=Cef7HMwcSODhigOw1InuxlZtpES9nPVvKucV5DunWXhXVHbqJWIMmkxfl4sEaGR1IsAuEd 8G2OiCZBctTzW5Aw== Received: from hawking.nue2.suse.org (unknown [10.168.4.11]) by relay2.suse.de (Postfix) with ESMTP id 2D2402C142; Tue, 5 Sep 2023 07:38:52 +0000 (UTC) Received: by hawking.nue2.suse.org (Postfix, from userid 17005) id 1D6B44AAD54; Tue, 5 Sep 2023 09:38:52 +0200 (CEST) From: Andreas Schwab To: Paul Eggert Cc: Peter Edwards , libc-alpha@sourceware.org Subject: Re: [PATCH v2] elf: Avoid pointer-arithmetic underflow in ldconfig In-Reply-To: (Paul Eggert's message of "Mon, 4 Sep 2023 16:51:12 -0700") References: <20230904170332.398424-1-peadar@arista.com> X-Yow: I'm meditating on the FORMALDEHYDE and the ASBESTOS leaking into my PERSONAL SPACE!! Date: Tue, 05 Sep 2023 09:38:52 +0200 Message-ID: User-Agent: Gnus/5.13 (Gnus v5.13) MIME-Version: 1.0 Content-Type: text/plain X-Spam-Status: No, score=-3.2 required=5.0 tests=BAYES_00,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_NONE,SPF_PASS,TXREP autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org List-Id: On Sep 04 2023, Paul Eggert wrote: > +/* A single bad_offset implementation is valid for both 32- and 64-bit code, > + so define it just once. */ > +#ifndef bad_offset_defined > +# define bad_offset_defined > + > +/* Check that OFFSET, ..., OFFSET + NITEMS * ITEMSIZE all fit within > + (or just at the end of) a file of length FILE_LENGTH. Also check > + that OFFSET is a multiple of ALIGNMENT. Return true (diagnosing > + with FILE_NAME) if the offsets are invalid. */ > +static bool > +bad_offset (ElfW(Xword) offset, ElfW(Xword) nitems, size_t itemsize, Please don't make it look like it depends on ElfW. -- Andreas Schwab, SUSE Labs, schwab@suse.de GPG Key fingerprint = 0196 BAD8 1CE9 1970 F4BE 1748 E4D4 88E3 0EEA B9D7 "And now for something completely different."