Received: by 2002:a05:6358:3188:b0:123:57c1:9b43 with SMTP id q8csp1798267rwd; Wed, 17 May 2023 01:15:41 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ6upydRreqQDwEr11ofdCf7jT2OUhDcEOYwVDu7WKQcRmrFL1a96uFtWLyUFPbTE2s75ihY X-Received: by 2002:a17:902:f94b:b0:1a6:9d1b:e18f with SMTP id kx11-20020a170902f94b00b001a69d1be18fmr37840559plb.45.1684311341588; Wed, 17 May 2023 01:15:41 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1684311341; cv=none; d=google.com; s=arc-20160816; b=CmtD6VEbwIsmBNS5xyN6/7WF8R5hslxAZyaFgGIjdeENhfMbDwURhj2TAaJSrsTY+H OL35ytcA7o4XMM0vKETnS9+Jbb1p2cUCH1kRZo07VVXb8neFQVayShZn6bVXWKDjo9Lk dIRtJEayRk9LBf0c2GndL3yNl4K8tRh73v4G0Kvy2+Fa3K0m2mfQ2ETtRUnDPS+HtRzP 6vNqUMF9WCMErkgWzRZsz2lFtGzeGlzvtZxwnCPEhTW3gxA4YunAZdCtZ19NbMjwGJmO hseyXL/36buBJ3oBepWp3kKzemoypCxnPOlrrqhzB0ih283dWWYMuYsRxobB7kadP7uP COug== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:cc:to:subject :message-id:date:from:in-reply-to:references:mime-version :dkim-signature; bh=Prp+gvCFzgWy8Wr4AdCPMHWn8zkQL1ei83GgGU4GXHc=; b=JanGAQAZ92AnS02TzyEX11P+FI2ev5sCGYun609SOwnwaSaCHaUAlsbVrFg4lTCocl t2N6x7Q4bDbcw/pj2LL3Gy33DE5vq3s01+OUfAxsnRPunYOiN+1tWqzEOMTduzW9y9Fi eZsyTL3dui+TVqYaB6ohhZX8irpDpzR8+EtorVIRFaUibJrUNXAF51NyRHORLUXX5dvC g3JZThIwdG/ibrvbSbTnJkGcDWukkcCTLFR9oCfzwVMDvTnyP2a3OYoSDjtAa/LYIT5b jcf84YJiK00AjipnMI5uuJ2TdvZYTPynw0NYOC90dSLoGLwwWNjrLAt9yRDpZPvb1EMj +ikQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@canonical.com header.s=20210705 header.b=qaOWXoCC; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=canonical.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id i11-20020a170902c94b00b0019e88376e3csi22126736pla.162.2023.05.17.01.15.26; Wed, 17 May 2023 01:15:41 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@canonical.com header.s=20210705 header.b=qaOWXoCC; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=canonical.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229630AbjEQHrr (ORCPT + 99 others); Wed, 17 May 2023 03:47:47 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44302 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229878AbjEQHrp (ORCPT ); Wed, 17 May 2023 03:47:45 -0400 Received: from smtp-relay-internal-0.canonical.com (smtp-relay-internal-0.canonical.com [185.125.188.122]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 079693A9E for ; Wed, 17 May 2023 00:47:42 -0700 (PDT) Received: from mail-pf1-f200.google.com (mail-pf1-f200.google.com [209.85.210.200]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by smtp-relay-internal-0.canonical.com (Postfix) with ESMTPS id 470CB3F452 for ; Wed, 17 May 2023 07:47:38 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=canonical.com; s=20210705; t=1684309658; bh=Prp+gvCFzgWy8Wr4AdCPMHWn8zkQL1ei83GgGU4GXHc=; h=MIME-Version:References:In-Reply-To:From:Date:Message-ID:Subject: To:Cc:Content-Type; b=qaOWXoCC+8ZS/x3mPNaFVuGzssozdvh+pnN6vUaGFETdaKSCGvwephz2AASeWoVhE e7mMQIyififEl8rc8KqLZ7vAuyIU6cRqRXRVob91AE5eP8Z82og5FL4haVY4lCR5w1 0V+X+NHlRRONfSBShni2u82T2ykGporBIOKHjcbh0gfjt8IN0/seqDxDQ/nLl0e/P+ sMlGOFFc+hGHxtJS362hgCKGkuzErTCyadLWcMFrBz3z3ATdPvFfed6MOvEXZx6oTw 97+A1/ZYC5OnOFxzKoDIlgkXbS4ZZqnDyw0QWyA8Xe8NOKrEnmEqr5H2VTzZT3Ylvp O1P+L1qLMwH+g== Received: by mail-pf1-f200.google.com with SMTP id d2e1a72fcca58-648f83d2169so537901b3a.0 for ; Wed, 17 May 2023 00:47:38 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1684309656; x=1686901656; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=Prp+gvCFzgWy8Wr4AdCPMHWn8zkQL1ei83GgGU4GXHc=; b=PmWSmn1JrCeta8pCo+Tgwo3WTnGsfmETrvwp86w/3obVNCpLPlkkzUPGD4wQ+zQsbj i96Cd+9w1D808deK2igzTAyGmb1ZBuUlG92eebvp37TsSponXdBOdRWZx+0xfi2XyhmX S6k6olX7tLAG1OCeI3eRjtCrLc3YBeFPUTcjwPM/qRrGhu2d4466CZq5oNvY6kMn6Etc TSAha6Nb6VgNBznDAzuMpFc51gTdCyA8qhvQmDEbP68vnTSpSjXNIvzgWtUQ4TFZPPA2 uOkYbWjv6ldUbO4aLpMO91hdd3jk8YdmYm0n7Sd0Phrpmbq2HbVD5CH8h8zyWvvVxHZ4 5E5Q== X-Gm-Message-State: AC+VfDxbGuJt+fjXrSF/JMsCZLHxU0QcF8Z1eq9cWJ82CxMLy15JVV1J cUjR+nMfl0/kYcOUxFxId2BgJKxQH0NbagsvWLGo/OMJB8/c2R/HCN0zAMppYdYQQjwm4iXYVlj LjwFDq8LY1LM/VhBJAh+plNkx/Atc6j5c0EwjdkLKqq18bzXQH/I6hk80LA== X-Received: by 2002:a05:6a00:1507:b0:647:3de:c0ff with SMTP id q7-20020a056a00150700b0064703dec0ffmr42340788pfu.30.1684309656001; Wed, 17 May 2023 00:47:36 -0700 (PDT) X-Received: by 2002:a05:6a00:1507:b0:647:3de:c0ff with SMTP id q7-20020a056a00150700b0064703dec0ffmr42340764pfu.30.1684309655711; Wed, 17 May 2023 00:47:35 -0700 (PDT) MIME-Version: 1.0 References: <20230516033133.340936-1-kai.heng.feng@canonical.com> In-Reply-To: From: Kai-Heng Feng Date: Wed, 17 May 2023 15:47:24 +0800 Message-ID: Subject: Re: [PATCH] EDAC/Intel: Fix shift-out-of-bounds when DIMM/NVDIMM is absent To: "Zhuo, Qiuxu" Cc: "Luck, Tony" , "kao, acelan" , Borislav Petkov , James Morse , Mauro Carvalho Chehab , Robert Richter , "linux-edac@vger.kernel.org" , "linux-kernel@vger.kernel.org" Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Spam-Status: No, score=-4.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_MED, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, May 16, 2023 at 8:53=E2=80=AFPM Zhuo, Qiuxu = wrote: > > > From: Kai-Heng Feng > > ... > > Subject: [PATCH] EDAC/Intel: Fix shift-out-of-bounds when DIMM/NVDIMM > > is absent > > > > The following splat can be found on many systems equipped with EDAC: > > [ 13.875276] UBSAN: shift-out-of-bounds in > > drivers/edac/skx_common.c:369:16 > > [ 13.875279] shift exponent -66 is negative > > [ 13.875280] CPU: 11 PID: 519 Comm: systemd-udevd Not tainted 6.4.0-r= c1+ > > #1 > > [ 13.875282] Hardware name: HP HP Z4 G5 Workstation Desktop PC/8962, > > BIOS U61 Ver. 01.01.15 04/19/2023 > > [ 13.875283] Call Trace: > > [ 13.875285] > > [ 13.875287] dump_stack_lvl+0x48/0x70 > > [ 13.875295] dump_stack+0x10/0x20 > > [ 13.875297] __ubsan_handle_shift_out_of_bounds+0x156/0x310 > > [ 13.875302] ? __kmem_cache_alloc_node+0x196/0x300 > > [ 13.875307] skx_get_dimm_info.cold+0xac/0x15d [i10nm_edac] > > [ 13.875312] i10nm_get_dimm_config+0x240/0x360 [i10nm_edac] > > [ 13.875316] ? kasprintf+0x4e/0x80 > > [ 13.875321] skx_register_mci+0x12b/0x1d0 [i10nm_edac] > > [ 13.875324] ? __pfx_i10nm_get_dimm_config+0x10/0x10 [i10nm_edac] > > [ 13.875329] i10nm_init+0x89f/0x1d10 [i10nm_edac] > > [ 13.875333] ? __pfx_i10nm_init+0x10/0x10 [i10nm_edac] > > [ 13.875337] do_one_initcall+0x46/0x240 > > [ 13.875342] ? kmalloc_trace+0x2a/0xb0 > > [ 13.875346] do_init_module+0x6a/0x280 > > [ 13.875350] load_module+0x2419/0x2500 > > [ 13.875353] ? security_kernel_post_read_file+0x5c/0x80 > > [ 13.875358] __do_sys_finit_module+0xcc/0x150 > > [ 13.875360] ? __do_sys_finit_module+0xcc/0x150 > > [ 13.875363] __x64_sys_finit_module+0x18/0x30 > > [ 13.875365] do_syscall_64+0x59/0x90 > > [ 13.875368] ? syscall_exit_to_user_mode+0x2a/0x50 > > [ 13.875371] ? do_syscall_64+0x69/0x90 > > [ 13.875372] ? do_syscall_64+0x69/0x90 > > [ 13.875373] ? do_syscall_64+0x69/0x90 > > [ 13.875374] ? do_syscall_64+0x69/0x90 > > [ 13.875375] ? syscall_exit_to_user_mode+0x2a/0x50 > > [ 13.875376] ? do_syscall_64+0x69/0x90 > > [ 13.875377] ? do_syscall_64+0x69/0x90 > > [ 13.875378] ? do_syscall_64+0x69/0x90 > > [ 13.875379] ? sysvec_call_function+0x4e/0xb0 > > [ 13.875381] entry_SYSCALL_64_after_hwframe+0x72/0xdc > > > > When a DIMM slot is empty, the read value of mtr can be 0xffffffff, the= refore > > Looked like a buggy BIOS/hw that didn't set the mtr register. If that's the case, I suspect the bug comes from Intel BIOS RC, because the issue happens on different vendors' hardware. > > 1. Did you print the mtr register whose value was 0xffffffff? Yes, 0xffffffff is the value. mcddrtcfg is also 0xffffffff. > 2. Can you take a dmesg log with kernel "CONFIG_EDAC_DEBUG=3Dy" enabled? > 3. What was the CPU? Please take the output of "lscpu". Both attached in Bugzlla [1]. > 4. Did you verify your patch that the issue was fixed on your systems? I did, that's why I sent the patch to mailing list. [1] https://bugzilla.kernel.org/show_bug.cgi?id=3D217453 Kai-Heng > > Thanks! > -Qiuxu > > > the wrong "ranks" value creates shift-out-of-bounds error. The same iss= ue > > can be found on NVDIMM too. > > > > So only consider DIMM/NVDIMM is present when the value of > > mtr/mcddrtcfg is not ~0. > > ...