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 [216.205.24.124]) by sourceware.org (Postfix) with ESMTP id 60F693858D39 for ; Tue, 28 Sep 2021 16:00:11 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 60F693858D39 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-447-KZQZL0j5MHyCqf8KGNCV0w-1; Tue, 28 Sep 2021 12:00:08 -0400 X-MC-Unique: KZQZL0j5MHyCqf8KGNCV0w-1 Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.phx2.redhat.com [10.5.11.23]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id EAE2C1808305; Tue, 28 Sep 2021 16:00:06 +0000 (UTC) Received: from oldenburg.str.redhat.com (unknown [10.39.192.176]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 1DF5B26188; Tue, 28 Sep 2021 16:00:05 +0000 (UTC) From: Florian Weimer To: Adhemerval Zanella via Libc-alpha Subject: Re: [PATCH] resolv: Fix tests by aligning hand crafted queries References: <20210614234011.2215641-1-shorne@gmail.com> <4da1fbe0-e1ac-09c2-de8b-2179344cf59b@linaro.org> Date: Tue, 28 Sep 2021 18:00:04 +0200 In-Reply-To: <4da1fbe0-e1ac-09c2-de8b-2179344cf59b@linaro.org> (Adhemerval Zanella via Libc-alpha's message of "Tue, 28 Sep 2021 11:36:02 -0300") Message-ID: <87ilykadx7.fsf@oldenburg.str.redhat.com> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.2 (gnu/linux) MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.23 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain X-Spam-Status: No, score=-6.4 required=5.0 tests=BAYES_00, DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, RCVD_IN_DNSWL_LOW, RCVD_IN_MSPIKE_H2, SPF_HELO_NONE, SPF_NONE, 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: Tue, 28 Sep 2021 16:00:16 -0000 * Adhemerval Zanella via Libc-alpha: > On 14/06/2021 20:40, Stafford Horne via Libc-alpha wrote: >> When testing OpenRISC I get a bus error in res_send. This is due to the >> buf being cast to a (HEADER *) and trying the res_send code trying to read >> different bits of the HEADER struct including 16-bit id etc. >> >> On OpenRISC reads of 16-bits and 32-bits from structures need to be 2 >> byte and 4 byte aligned, respectively. >> >> To fix this we can align the hand crafted queries. > > > But the res_send() interface does specify that buffer is an 'unsigned char', > so I think the problem is in fact send_vc() (any any other code that consume > the buffer) where the cast is in fact undefined. I am not sure why it has > not show any issue on architecture that trap on unaligned access, may guess > is the stack buffer alignment is the same as the HEADER. > > The issue is resolv code seems to abuse this... Right, there is a separate bug for this: Misaligned access in res_query.c HEADER struct I really want to fix this, but each time I get side-tracked by other cleanups that appear to be necessary for this. 8-( Thanks, Florian