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.2 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 0D7581F5AE for ; Mon, 3 Aug 2020 16:08:11 +0000 (UTC) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 3A1623857C53; Mon, 3 Aug 2020 16:08:10 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 3A1623857C53 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1596470890; bh=L1QbcDAO1o6BzhAfIcw1KZiqXO/P6evVtgnFdS8BR/A=; h=To:Subject:References:Date:In-Reply-To:List-Id:List-Unsubscribe: List-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To:Cc: From; b=lDKrjcWeO2S37n37wmbw3AevQ8GcMV/H7IEYvuah+eXn0nWgoWH9cLPeuJ+qlQLl+ fC5DcKc5u3dXc+3S6REFiyspjsYV9i09v4FQdPO2uSeon+VN63pCi4lGF0LN4wdcZc JuSsUuOm8E9SiWEVEVgttiQlJyKV+LqfqgSHUNJo= Received: from us-smtp-1.mimecast.com (us-smtp-delivery-1.mimecast.com [207.211.31.120]) by sourceware.org (Postfix) with ESMTP id DAB3B3857C42 for ; Mon, 3 Aug 2020 16:08:07 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org DAB3B3857C42 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-401-oFri1SRLNXGFiAfJgX0Xdw-1; Mon, 03 Aug 2020 12:08:05 -0400 X-MC-Unique: oFri1SRLNXGFiAfJgX0Xdw-1 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id C8A1B8064AC; Mon, 3 Aug 2020 16:08:04 +0000 (UTC) Received: from oldenburg2.str.redhat.com (ovpn-112-2.ams2.redhat.com [10.36.112.2]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 0C4F787E2B; Mon, 3 Aug 2020 16:08:00 +0000 (UTC) To: Carlos O'Donell Subject: Re: [PATCH] powerpc: Fix incorrect cache line size load in memset (bug 26332) References: <87wo2g8639.fsf@oldenburg2.str.redhat.com> <31303210-1cf1-d201-68d7-e119bbe439d1@redhat.com> Date: Mon, 03 Aug 2020 18:07:59 +0200 In-Reply-To: <31303210-1cf1-d201-68d7-e119bbe439d1@redhat.com> (Carlos O'Donell's message of "Mon, 3 Aug 2020 12:05:20 -0400") Message-ID: <87imdz4srk.fsf@oldenburg2.str.redhat.com> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/26.3 (gnu/linux) MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain 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: Florian Weimer via Libc-alpha Reply-To: Florian Weimer Cc: Tulio Magno Quites Machado Filho , libc-alpha@sourceware.org Errors-To: libc-alpha-bounces@sourceware.org Sender: "Libc-alpha" * Carlos O'Donell: > On 8/3/20 4:51 AM, Florian Weimer wrote: >> __GLRO loaded the word after the requested variable on big-endian >> PowerPC, where LOWORD is 4. This can cause the memset implement >> go wrong because the masking with the cache line size produces >> wrong results, particularly if the loaded value happens to be 1. >> >> The __GLRO macro is not used in any place where loading the lower >> 32-bit word of a 64-bit value is desired, so the +4 offset is always >> wrong. > > Agreed. > > I reviewed sysdeps/powerpc/powerpc32/sysdep.h, and: > sysdeps/powerpc/powerpc32/power4/multiarch/init-arch.h > sysdeps/powerpc/powerpc32/sysdep.h > sysdeps/powerpc/powerpc32/memset.S > sysdeps/powerpc/powerpc32/a2/memcpy.S > > I see only 32-bit word accesses and so the +4 offset is wrong. This > was likely just a copy-and-paste that came from similar code which > accesses the 64-bit HWCAP/HWCAP2 e.g. uint64_t _dl_hwcap. > > The 64-bit sysdeps/powerpc/powerpc64/sysdep.h is different and doesn't > have this problem for obvious reasons (it can load a 64-bit value). > >> Fixes commit 18363b4f010da9ba459b13310b113ac0647c2fcc >> ("powerpc: Move cache line size to rtld_global_ro") and bug 26332. > > Reviewed-by: Carlos O'Donell Pushed as 7650321ce037302bfc2f026aa19e0213b8d02fe6. Thanks, Florian