Received: by 2002:a25:683:0:0:0:0:0 with SMTP id 125csp860644ybg; Mon, 1 Jun 2020 16:51:15 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwANHmNUh59MgPQQ9uTLDFZtWsX0aq21r7vSnfj9z4lB9Ea2fw2OtU2LCHwSh41JxmKVBPm X-Received: by 2002:a05:6402:393:: with SMTP id o19mr8308253edv.28.1591055475452; Mon, 01 Jun 2020 16:51:15 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1591055475; cv=none; d=google.com; s=arc-20160816; b=c+pHtg9DuGPl7m1JdD3PcBNeYbdx3bkiFAPFst4JxB9TzW0XMVqHYx2eHkT0lCxv3x bCjWM0q6b0Pbuh8vs19gEccciFE9C0WIOb3mBD2BFBZ/4dArmkr5YNWep8Rn0l9Fezno bWcmlhBokaWM6Zew+RGnYHSSlcu5nf7TuPCm+P+YV6mI11gOaXpr1RXnPvnzZa7hHZ/U Wr/VrJhQ7TZ+sWiqHLrv5yZIKnCfpDbR6oHlNZrBJTuAErLc5B3LA9xrF2sGPflDm+Fn xZ1ve+IKmiekwNMw/4GRVOj/BYNdaK0wGFMAN8WtQDG8Mq0mNRrFJZM8BIdnjlzjmBlD wHpQ== 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:dkim-signature; bh=dNBmHiSKwvMr5X38foIQI0sKfyxQ431ExlrJTn0/i7Y=; b=N3ML5zRv/aH2kgVqO1WyoJClkgBs/ICQxoZwoNBXPX4/K5N9qL/CNhgXYUj5pnMjI/ IwhvPxr0ctFy3Em6VpEhw++UgpH5p/qTvyY2OdV3KqCYHcxNwVVrtjKY6kNSA88UNpTf 1fSw5Ak0SOTXkVdMzk83PrPmd7/5zehlH7UA6+SQaj9GCUjhByI1QeMiuLYP6q30GcCx lTRZU6wqpj7MjEtOnhRwu1PldbJyHqRdufW/fsN0noT5habD0xZmsIfJ7UOVJvl4vsoe 0O5faJqXFi/RcvB//hUT6kqQjeFB8Nl+KZpW3je/PkY5XVDuUU1jPtqxlzoRLlJ91lZa lE8g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20161025 header.b="JP+Lp/jN"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id h14si630800ejq.198.2020.06.01.16.50.52; Mon, 01 Jun 2020 16:51:15 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@google.com header.s=20161025 header.b="JP+Lp/jN"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728746AbgFAXsn (ORCPT + 99 others); Mon, 1 Jun 2020 19:48:43 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35634 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725446AbgFAXsm (ORCPT ); Mon, 1 Jun 2020 19:48:42 -0400 Received: from mail-pj1-x1044.google.com (mail-pj1-x1044.google.com [IPv6:2607:f8b0:4864:20::1044]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id AA776C05BD43 for ; Mon, 1 Jun 2020 16:48:42 -0700 (PDT) Received: by mail-pj1-x1044.google.com with SMTP id 5so552578pjd.0 for ; Mon, 01 Jun 2020 16:48:42 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=dNBmHiSKwvMr5X38foIQI0sKfyxQ431ExlrJTn0/i7Y=; b=JP+Lp/jNYkdXX/HqPZKX2SgK5X0i+zDFGOg2ww7dtjG0sp6+PGSQ9bK3jx7AAwgHgJ o4FT4hVdzYCxXc0WH1nFHjqoOyqVRS88r7xLjnMssWgONz5eA+xjJ69RP6XO0zAq2X7M XJ3HbDqOKrcI58B5+9jcBtMDajE5h35bKOQBKIVMzttYj+uUId6KcRVn55gYO9ZYTHIJ 90CfC5AreAzmnRK53W2uiqONvL5NPR53F8EQR6ykK0w6XL51XbB86M2HVM8mWb/FGgEn JR5eXLsDjabEHuSKeT8o+NWzFLtsVkkP2y157PXkg56HkTU0VZ0WhUg8vG3zI/f55YC8 01Lg== 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=dNBmHiSKwvMr5X38foIQI0sKfyxQ431ExlrJTn0/i7Y=; b=qSjZ77qVsmiyOwSHZR0iC+AEVHrSiU4y52e1iRPDvxJXn4A9eTegLn4WVgEaV0VmeU qAQKn8+neYuji5A+tUt7Ogli+9yyPzzapZdV45+mTNDqmOpPP30TjvVJj1l47GWOnS0N jhcIW/Lko1QBJQUpif7/EpTVx9lSsKalO59h2nq+Tp63aTYP3ez7YcnZtNcazbNXFDKg Jq0tG41noI8dL9m0iShrLfyk83w62JIT/ziLItAc14K+Cm6ZvMa39+eluDAOnTR8S3QM 7AjivaPyYVg1qQ2ZuYr6i2WAB96qQqO03x5lKDVr0PRbyhuPR+b4kT32zNJfldKdNHGe aDzQ== X-Gm-Message-State: AOAM531duf75/ITTi/mLgDQRLJavaLXd3TKFCJ7UYZdt3d+FosNA40Jd IdrqZ9d24a6cYFPr61zdgIBZSCyxjIuDgwe5u89O3Q== X-Received: by 2002:a17:902:724a:: with SMTP id c10mr22127472pll.223.1591055321894; Mon, 01 Jun 2020 16:48:41 -0700 (PDT) MIME-Version: 1.0 References: <20200601231805.207441-1-ndesaulniers@google.com> In-Reply-To: From: Nick Desaulniers Date: Mon, 1 Jun 2020 16:48:29 -0700 Message-ID: Subject: Re: [PATCH] ACPICA: fix UBSAN warning using __builtin_offsetof To: Peter Collingbourne Cc: Robert Moore , Erik Kaneda , "Rafael J. Wysocki" , Len Brown , Ard Biesheuvel , Dmitry Vyukov , Alexander Potapenko , Hanjun Guo , Linux ARM , Linux Kernel Mailing List , Lorenzo Pieralisi , Mark Rutland , "Rafael J. Wysocki" , Will Deacon , "# 3.4.x" , linux-acpi@vger.kernel.org, devel@acpica.org 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 Mon, Jun 1, 2020 at 4:37 PM Peter Collingbourne wrote: > > On Mon, Jun 1, 2020 at 4:18 PM Nick Desaulniers wrote: > > > > Will reported UBSAN warnings: > > UBSAN: null-ptr-deref in drivers/acpi/acpica/tbfadt.c:459:37 > > UBSAN: null-ptr-deref in arch/arm64/kernel/smp.c:596:6 > > > > Looks like the emulated offsetof macro ACPI_OFFSET is causing these. We > > can avoid this by using the compiler builtin, __builtin_offsetof. > > Would it be better to s/ACPI_OFFSET/offsetof/g the existing users of > this macro and remove it? It looks like offsetof is already being used > pervasively in the kernel, and its definition comes from > . I count only 9 uses in the tree, so not too bad a yak shave. Good idea; I'll send tomorrow short of any other feedback. I still think we want the builtin, since we don't want to include stddef.h in the kernel, I think. -- Thanks, ~Nick Desaulniers