Received: by 2002:a25:23cc:0:0:0:0:0 with SMTP id j195csp980131ybj; Thu, 7 May 2020 11:55:40 -0700 (PDT) X-Google-Smtp-Source: APiQypLixSSpq6BE56a0rbrpMLCSMHbY5NfacDpn7Ws/R20tAvGZuuwGnxnG0z8WWsdnCGdisXhv X-Received: by 2002:a05:6402:1506:: with SMTP id f6mr13464653edw.217.1588877740670; Thu, 07 May 2020 11:55:40 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1588877740; cv=none; d=google.com; s=arc-20160816; b=rDoY76PSnaYss5j6tzn6lFzS4BLJ20HAtAMxsIiTOZWeMZ4DUxyvwulkZa9H+5++OQ JhL44PxRi1bIdttqaUGx7QOC93AXlhVYihVT1t1YPBQnLvTirk30QOunq4doQ1LSe8nH SaFNyjzTuRXgLUYRcEHaUAV4xD+oh+FOkgAeWNzZthr6Uk+JQDmS7TFENLOGP/gCF6+H Bgh0cao5ewnbiEwEhy9Uj2kcO64eMbtX4wOy0S3LPJ8Vttfvj8do7kxlIaHXIPNZfR/X 8GdLG4ssN84lJQNI0nvxhfGPIdZMW56m65hRiQILtdnpqTQU8yhRf9t94LZXqVSdPHNG MqGw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:to:references:message-id :content-transfer-encoding:cc:date:in-reply-to:from:subject :mime-version:dkim-signature; bh=HdnkYkSkwpLh+orrApa7Rm9CqGAa5Q8eU7irYvG3X2E=; b=0cIQPAdJXY3SLwTr44cPvlMpafNySOdsDTfBwDPFaHeKA0z0abuhlB9Ox462LRKu/w 5PR4ScsOuhF2CCuIqd6IALs6VDcvFHHd6u1fMTg5sneYxdO6d553nMRXzy5k3Y/ZUd1Y 2rxC/SIl285Buym66NKK76QYJv9UdafZjuS2+89Jop5lov3Esq9w8WwUdupe28CnC2Vu mpQ1lLUhloO3FZJr2UX0j9ukW2pycxDraVsnrd60phXSyKW7ZM4fcNMNIuMlOAwuE22p lV9iL5z5vbBnLJry0OXoRMWRffYfWo3irPIHqg9niunTrKV4KVWJ5/vnAd5S5JwG/GeB FASA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@lca.pw header.s=google header.b=AWpMVeNZ; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id y4si3605423edv.549.2020.05.07.11.55.17; Thu, 07 May 2020 11:55:40 -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=@lca.pw header.s=google header.b=AWpMVeNZ; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728431AbgEGSxr (ORCPT + 99 others); Thu, 7 May 2020 14:53:47 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34084 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-FAIL-OK-FAIL) by vger.kernel.org with ESMTP id S1726926AbgEGSxq (ORCPT ); Thu, 7 May 2020 14:53:46 -0400 Received: from mail-qk1-x742.google.com (mail-qk1-x742.google.com [IPv6:2607:f8b0:4864:20::742]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 27FE2C05BD43 for ; Thu, 7 May 2020 11:53:46 -0700 (PDT) Received: by mail-qk1-x742.google.com with SMTP id g185so579272qke.7 for ; Thu, 07 May 2020 11:53:46 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=lca.pw; s=google; h=mime-version:subject:from:in-reply-to:date:cc :content-transfer-encoding:message-id:references:to; bh=HdnkYkSkwpLh+orrApa7Rm9CqGAa5Q8eU7irYvG3X2E=; b=AWpMVeNZtOcDehpQv6YuIjQbfY2hoFmZeODxYBSwYnNCPscHVRQK1TfnTzoJ3IejYj 9sQQIK2kcFod+PFjfSF4IyqyWYNywT0GmAfJwJTEA+8n+DH25ZlBk1ZeQDdsGoUaCF0S 0EasjR5EywfSB6e5oZ4dg3aejrGFDmxnv24t+WwCji3bKD8DiOgJFDNIVx5RCidj3ecI ToHY3lm1/HKg/+1n1cVTgMbN8JrBQwlCZIma6JeMIGO4bZBE2QFRhwRMVw77DUwcSh+n cPfffJde16piheXEnT3pr3SBVXVIcyFxhq3o3oGVwAlDGvxhmTXRLhfM8h86M2IDVsEk EJfg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:subject:from:in-reply-to:date:cc :content-transfer-encoding:message-id:references:to; bh=HdnkYkSkwpLh+orrApa7Rm9CqGAa5Q8eU7irYvG3X2E=; b=kprFjRJa8z2QHqWmJ/Cjj/i9Sm3dKkeFA2d/6W4MVWhVSqXz6Tm5i6J6YY3WFWLOAQ OziGZSS8eKGy1gJf7AWdrJLO5X+eNxeji5bwD6Uab/s/K57aMnarFytwb786+9rRr5df e5RCl0J0CWUM6myhTOES5jeB6YznktUWbCrGCry0laHbWw7CIQ4at+S2Wlrh5+VhcN7b 2h8P0hRsLIGwHY7p5xo90coBvnW41VwS12pg/lMEEcUWkkNnzlzwgQJ93TppIWCvFHI8 hHgBx0Qhk6sDenYgxtRtOiznh1ucMxCiXdxei7FXnfo5H7QvJKSyzuODUUjwHLi0pwCj j2DA== X-Gm-Message-State: AGi0PuY3hsZ3QMA+zQFtJw3ptur6i+8CpvtMLylcIZ9wkFhEDJnDHwWa 2HpW+iZTysU8r0csw4ieeDxpOQ== X-Received: by 2002:a05:620a:2fa:: with SMTP id a26mr8474627qko.295.1588877625313; Thu, 07 May 2020 11:53:45 -0700 (PDT) Received: from [192.168.1.153] (pool-71-184-117-43.bstnma.fios.verizon.net. [71.184.117.43]) by smtp.gmail.com with ESMTPSA id q207sm146330qka.13.2020.05.07.11.53.44 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Thu, 07 May 2020 11:53:44 -0700 (PDT) Content-Type: text/plain; charset=us-ascii Mime-Version: 1.0 (Mac OS X Mail 13.4 \(3608.80.23.2.2\)) Subject: Re: Clang and UBSAN: member access within null pointer of type From: Qian Cai In-Reply-To: Date: Thu, 7 May 2020 14:53:43 -0400 Cc: Nathan Chancellor , clang-built-linux , LKML , Will Deacon Content-Transfer-Encoding: quoted-printable Message-Id: References: To: Nick Desaulniers X-Mailer: Apple Mail (2.3608.80.23.2.2) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org > On May 7, 2020, at 2:30 PM, Nick Desaulniers = wrote: >=20 > On Thu, May 7, 2020 at 6:42 AM Qian Cai wrote: >>=20 >> Running a Clang (9.0.1) build kernel with UBSAN generated a few = warnings during boot, >=20 > Very cool, these reports are so nice! They hand you everything on a > silver platter. Thanks for testing/sending! Let's take a look. >=20 >>=20 >> [ 0.000000] UBSAN: null-ptr-deref in = drivers/acpi/acpica/tbfadt.c:459:37 >> [ 0.000000] member access within null pointer of type 'struct = acpi_table_fadt' >> [ 0.000000] CPU: 0 PID: 0 Comm: swapper Not tainted = 5.7.0-rc4-next-20200507 #2 >> [ 0.000000] Call trace: >> [ 0.000000] dump_backtrace+0x0/0x22c >> [ 0.000000] show_stack+0x28/0x34 >> [ 0.000000] dump_stack+0x104/0x194 >> [ 0.000000] handle_null_ptr_deref+0xdc/0x10c >> [ 0.000000] __ubsan_handle_type_mismatch_v1+0x64/0x78 >> [ 0.000000] acpi_tb_create_local_fadt+0x104/0x6ec >=20 > ok so acpi_tb_create_local_fadt() dereferenced a `null pointer of type > 'struct acpi_table_fadt'` in null-ptr-deref in > drivers/acpi/acpica/tbfadt.c:459. >=20 > That line number doesn't line up with linux-next; which tree was this? > That will probably help track these down faster. It is linux-next indeed as in the signature. next-20200507 # ./scripts/faddr2line vmlinux acpi_tb_create_local_fadt+0x104/0x6ec acpi_tb_create_local_fadt+0x104/0x6ec: acpi_tb_convert_fadt at drivers/acpi/acpica/tbfadt.c:459 (inlined by) acpi_tb_create_local_fadt at = drivers/acpi/acpica/tbfadt.c:388 This line, if (acpi_gbl_FADT.header.length <=3D ACPI_FADT_V2_SIZE) { acpi_gbl_FADT was defined in, .//include/acpi/acpixf.h:266:ACPI_GLOBAL(struct acpi_table_fadt, = acpi_gbl_FADT); #ifdef DEFINE_ACPI_GLOBALS #define ACPI_GLOBAL(type,name) \ extern type name; \ type name #define ACPI_INIT_GLOBAL(type,name,value) \ type name=3Dvalue #else #ifndef ACPI_GLOBAL #define ACPI_GLOBAL(type,name) \ extern type name #endif #ifndef ACPI_INIT_GLOBAL #define ACPI_INIT_GLOBAL(type,name,value) \ extern type name #endif #endif I looks like DEFINE_ACPI_GLOBALS should be set in = drivers/acpi/acpica/utglobal.c.