From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-pj1-x1030.google.com (mail-pj1-x1030.google.com [IPv6:2607:f8b0:4864:20::1030]) by sourceware.org (Postfix) with ESMTPS id CB7B63858C39 for ; Wed, 6 Oct 2021 20:53:46 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org CB7B63858C39 Received: by mail-pj1-x1030.google.com with SMTP id ls18so3151576pjb.3 for ; Wed, 06 Oct 2021 13:53:46 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=FlogzVBn4/qmeIDXvkQeMV+PaOvAEVZJve00tCIXC7s=; b=uh403ljdhHPn+gWAS2eKcJGLuYPK6GUXlG1M+3//MKbYm0UZJ7Ff+ihdeCC5fAUUu2 dVZrI4wIvPm/6FbVsJltOMUwdtuk2cOihemHWWP+u9dNT1wtHQI8OPD/X9TMTPUS5uUE ctNCqDED/Rreh1nnKbSDv6Ut54kipMdLZmccz3e3/vPoqdsLcjYhB2JK+hBBg4/eTWX/ x+rHhD4FtPhnTZAqna6lCxRWYD3YfCfGcNWY8nuDY9Dp2/iC9GQgc53w89xjVgC1u+I1 d83n+M84Mi8zNZwKApcYCv8oOFo7EIp6v0O5ePBW23DOtRlFR2di3bDuFChj1fq1AZgz qdaw== X-Gm-Message-State: AOAM533xS3u5Vk2ct8cxqqyMNpSX+jEhUuhWP8EzTh+UwROvj9TBnvPy zphLEEPlpoBvOqzEIMjakfs= X-Google-Smtp-Source: ABdhPJxGORJoPLU+8jL1DNDTa4XFQk2AhKY4SNa/mipGKfvENie/lKvmbjKr5m7czflbbPb5BwTkiw== X-Received: by 2002:a17:90b:28d:: with SMTP id az13mr1019602pjb.30.1633553626055; Wed, 06 Oct 2021 13:53:46 -0700 (PDT) Received: from localhost ([2409:10:24a0:4700:e8ad:216a:2a9d:6d0c]) by smtp.gmail.com with ESMTPSA id a15sm9862976pfg.53.2021.10.06.13.53.44 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 06 Oct 2021 13:53:45 -0700 (PDT) Date: Thu, 7 Oct 2021 05:53:43 +0900 From: Stafford Horne To: Florian Weimer Cc: Adhemerval Zanella via Libc-alpha , Adhemerval Zanella Subject: Re: [PATCH] resolv: Fix tests by aligning hand crafted queries Message-ID: References: <20210614234011.2215641-1-shorne@gmail.com> <4da1fbe0-e1ac-09c2-de8b-2179344cf59b@linaro.org> <87ilykadx7.fsf@oldenburg.str.redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <87ilykadx7.fsf@oldenburg.str.redhat.com> X-Spam-Status: No, score=-4.3 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, FREEMAIL_FROM, 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, 06 Oct 2021 20:53:48 -0000 On Tue, Sep 28, 2021 at 06:00:04PM +0200, Florian Weimer wrote: > * 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 for the comments, in the mean time does that mean my patch should not go in as it is? -Stafford