Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp6442698imu; Wed, 30 Jan 2019 15:01:26 -0800 (PST) X-Google-Smtp-Source: ALg8bN6+/ohrpZEQGI67wUSoZc/vfso/WgK7u9AJb54QqIZPuRWcX7Cua0z03SNeQ4Zr0/dt6hV8 X-Received: by 2002:a63:f844:: with SMTP id v4mr29038860pgj.82.1548889286107; Wed, 30 Jan 2019 15:01:26 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1548889286; cv=none; d=google.com; s=arc-20160816; b=hu7UvjupfpSk9dYNLhCanc9e7jmIh56t1QNrknCcXqdDVndzRbmv3McKzc6qRazQue 6U279r4rqdGXG2CH4DP59CpTfVr3krc09luzrrIaY5wdqZ3zp9BrG3np1FZlrD/2pV6V OrQZiZmNnAe+L0WIMs+plhbL7Vo09siosxd9hoIEpUyZUZFGE40tMCQxyCnfrFai76jq UHa3Yk0cSNyBXBjhK2qT/Yj+4TsfciqP5dUyqNCk5jSLMLcrCSZ3mMZWZ3uPVH8HFpoe eueeFaL/GaOga0ao9+8I1ANyLFL9Av0eWNlE40rvyOnB986Uf6v1eyjAE7ASpTaCZk8E CHSw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version; bh=uY8T3GlPQudUWKbMemLAjOad846iQpF0yrDVmtvchx4=; b=hkcs9EAJjgMs14RhOTmasn0MtkHnH87Nhl4co0dqTUU7VYJscIiutqugEmA8bGyW6z S5k4l5UbV/tajoHJTM7SeBwDl51owmndRVjDCj6UvMA7cGSU6l2gaYShtu/5FmRfE1me ST3WITUUsAaeziVDkmgrt0YQqzyXb2QEewpH6Pr7NEPgNPi6oKuXIZFIJRCqCXEUyTL2 9VxzQkss3CKFvEG057qcYnlT0jFYDRyMOaVxOnovKIt8pWc/EUGBvx7i4/GhRCinak93 SG6GUwNVFL8eD8vCWgiAPz3yPd4jlzN+TLHdkZenUv8l+vYlxh8lu4fkVUC1eAHzpdgQ pgrA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id k62si2640909pfc.208.2019.01.30.15.01.09; Wed, 30 Jan 2019 15:01:26 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2388143AbfA3Vaa (ORCPT + 99 others); Wed, 30 Jan 2019 16:30:30 -0500 Received: from mail-qk1-f195.google.com ([209.85.222.195]:35143 "EHLO mail-qk1-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1732048AbfA3Vaa (ORCPT ); Wed, 30 Jan 2019 16:30:30 -0500 Received: by mail-qk1-f195.google.com with SMTP id w204so695859qka.2 for ; Wed, 30 Jan 2019 13:30:30 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=uY8T3GlPQudUWKbMemLAjOad846iQpF0yrDVmtvchx4=; b=prUwiIUriFOXGr5AWnu+6eaxa4BBrqixoBJHr+srYUKrnOEj58eg85dP7/p9oI1O8W qsIU2vGIZdlv8uR7i6osM5gpmDqWmCcGn6FBCQIVMFJTvvxPukANhUXYY9aJ9nLwxXmZ m1MleVDeT4e5l7UFR+w5rr4bNX2CxHLNPnVMAD9I4mbCEJhslrf80C4gY8wkHOA/3MRv 2DC3xacjDZroHs2pzZsM8SxS6pqwO8xn7J9xpoBGdxNaB5C7zXGzVQ8YtJz1q/ov6EM9 hSK3B+kqOjpBqJGaGHc8XTTXfhhGzvQ0OVc2uak1vbE6KysrXjCNYXI1tilrdEFaYKka Wjuw== X-Gm-Message-State: AJcUukddnlAiGyhaOonBbC0iEPMg2bcKUGWNPLUegZ8Clxb5JdYGr095 BSAF8lkmLu7HkZxUflyp3Da5S6p5OmKfpfoFf+I= X-Received: by 2002:a37:9a89:: with SMTP id c131mr29322048qke.173.1548883829455; Wed, 30 Jan 2019 13:30:29 -0800 (PST) MIME-Version: 1.0 References: <20181217150326.30933-1-anders.roxell@linaro.org> <8bc73bbf-6c12-7fd1-3253-676731bf5ae5@virtuozzo.com> <20190129173634.ee579795b227b141efc8bd30@linux-foundation.org> <2370bfbc-762f-fb3f-79b1-483a095fdf7c@virtuozzo.com> In-Reply-To: <2370bfbc-762f-fb3f-79b1-483a095fdf7c@virtuozzo.com> From: Arnd Bergmann Date: Wed, 30 Jan 2019 22:30:12 +0100 Message-ID: Subject: Re: [PATCH] lib/ubsan: default UBSAN_ALIGNMENT to not set To: Andrey Ryabinin Cc: Andrew Morton , Anders Roxell , Linux Kernel Mailing List Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, Jan 30, 2019 at 6:12 PM Andrey Ryabinin wrote: > On 1/30/19 4:36 AM, Andrew Morton wrote: > > On Fri, 11 Jan 2019 22:01:16 +0300 Andrey Ryabinin wrote: > >> On 12/17/18 6:03 PM, Anders Roxell wrote: > >>> When booting an allmodconfig kernel, there are a lot of false-positives. > >>> With a message like this 'UBSAN: Undefined behaviour in...' with a call > >>> trace that follows. > >>> > >>> Reworked so that when building a allmodconfig kernel that turns > >>> everything into '=m' or '=y' will turn off UBSAN_ALIGNMENT. > >>> > >>> Suggested-by: Arnd Bergmann > >>> Signed-off-by: Anders Roxell > >>> --- > >> > >> Acked-by: Andrey Ryabinin > >> > > > > Confused. Why does allmodconfig result in UBSAN warnings? > > > > UBSAN warnings is a result of enabling noisy CONFIG_UBSAN_ALIGNMENT which is disabled > by default if HAVE_EFFICIENT_UNALIGNED_ACCESS=y. > It's noisy even if don't have efficient unaligned access, e.g. people often add > __cacheline_aligned_in_smp in structs, but forget to align allocations of such struct > (kmalloc() give 8-byte alignment in worst case). That would be a fixable issue, but there is another one that I looked at with Anders: We have a number of list_for_each_entry_safe() loops that use a list_head on the stack and add objects of a type with large alignment. When list_for_each_entry_safe() gets to the end of that list, it sees a pointer to an unaligned structure starting few bytes before the list_head on stack. The only element of that structure that is ever used is that list_head, so there is no actual problem, but the warning triggers nonetheless. Arnd