Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753375AbdLHKD6 convert rfc822-to-8bit (ORCPT ); Fri, 8 Dec 2017 05:03:58 -0500 Received: from smtp-out4.electric.net ([192.162.216.185]:58345 "EHLO smtp-out4.electric.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753975AbdLHKAi (ORCPT ); Fri, 8 Dec 2017 05:00:38 -0500 From: David Laight To: "'Andrew Morton'" , Andrey Ryabinin CC: Ding Tianhong , "linux-kernel@vger.kernel.org" , LinuxArm Subject: RE: [PATCH v2] ubsan: don't handle misaligned address when support unaligned access Thread-Topic: [PATCH v2] ubsan: don't handle misaligned address when support unaligned access Thread-Index: AQHTb7Kps4rZxZsopkiW0TBvojCGdqM5Nq2A Date: Fri, 8 Dec 2017 10:00:52 +0000 Message-ID: References: <5b905d56-609e-3822-096a-3b93b3eb7675@huawei.com> <20171206164916.687d5006b7a49ef1149e7154@linux-foundation.org> <022fdf6b-6e00-fe70-3124-80b8ff50a859@virtuozzo.com> <20171207152453.7aaf8f420ebf69d13c29a761@linux-foundation.org> In-Reply-To: <20171207152453.7aaf8f420ebf69d13c29a761@linux-foundation.org> Accept-Language: en-GB, en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-ms-exchange-transport-fromentityheader: Hosted x-originating-ip: [10.202.205.33] Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 8BIT MIME-Version: 1.0 X-Outbound-IP: 156.67.243.126 X-Env-From: David.Laight@ACULAB.COM X-Proto: esmtps X-Revdns: X-HELO: AcuMS.aculab.com X-TLS: TLSv1.2:ECDHE-RSA-AES256-SHA384:256 X-Authenticated_ID: X-PolicySMART: 3396946, 3397078 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1948 Lines: 46 From: Andrew Morton > Sent: 07 December 2017 23:25 > On Thu, 7 Dec 2017 16:31:23 +0300 Andrey Ryabinin wrote: > > > On 12/07/2017 03:49 AM, Andrew Morton wrote: > > > (correcting Andrey's email address) > > > > > > > > > From: Ding Tianhong > > > Subject: lib/ubsan.c: don't handle misaligned address when kernel supports unaligned access > > > > > > ubsan reports a warning like: > > > > > > UBSAN: Undefined behaviour in ../include/linux/etherdevice.h:386:9 > > > load of misaligned address ffffffc069ba0482 for type 'long unsigned int' > > > which requires 8 byte alignment > > > CPU: 0 PID: 901 Comm: sshd Not tainted 4.xx+ #1 > > > Hardware name: linux,dummy-virt (DT) > > > Call trace: > > > [] dump_backtrace+0x0/0x348 > > > [] show_stack+0x20/0x30 > > > [] dump_stack+0x144/0x1b4 > > > [] ubsan_epilogue+0x18/0x74 > > > [] __ubsan_handle_type_mismatch+0x1a0/0x25c > > > [] dev_gro_receive+0x17d8/0x1830 > > > [] napi_gro_receive+0x30/0x158 > > > [] virtnet_receive+0xad4/0x1fa8 > > > > > > The reason is that when enabling the CONFIG_UBSAN_ALIGNMENT, ubsan will > > > report the unaligned access even if the system supports it > > > (CONFIG_HAVE_EFFICIENT_UNALIGNED_ACCESS=y). This produces a lot of noise > > > in the log and causes confusion. > > > > > > > NACK. This doesn't make sense. If you don't want to see misaligned access reports > > you simply shouldn't enable CONFIG_UBSAN_ALIGNMENT. > > So should UBSAN Kconfig disable CONFIG_UBSAN_ALIGNMENT when > CONFIG_HAVE_EFFICIENT_UNALIGNED_ACCESS=y? >From the look of the code fragment it would appear that the function is called when the original request wasn't actioned. But you either want to action it or print the error. Jus suppressing the error message cannot be right. David