Received: by 2002:a05:6a10:9848:0:0:0:0 with SMTP id x8csp3727229pxf; Mon, 29 Mar 2021 09:44:24 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyjrcmBwB+o43XFwetlCIt9UJzeXbcIIxGuv0HPOZTOEE2oBWsD9PJ8rixGSSAPGKtAgdgA X-Received: by 2002:a17:906:37db:: with SMTP id o27mr30081900ejc.60.1617036264003; Mon, 29 Mar 2021 09:44:24 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1617036263; cv=none; d=google.com; s=arc-20160816; b=Ju8n6+EI1uRPmr1NLEmfPZNXyZJTVxu31WwSecomJZjKRTCek4rE5NUwNGkI9BW9UE Gq0tseCwjuBgEOHKrY9dJZaiCcyu8GEuyBbLf+Q+JYA6Ws+8aTbTyRDT07bbJYq/MwpJ 8d+7bfYnGqLw/FebEgYwqGi5wcCbUO47U2X024yy+DLSxxcHE+8isNBKsIuy3zDWjmJR nSStmF+GUvf/kv99USbZPC3t+r6XZHiGGujZNcqEPRw2QhqiG2VvPQDnyZG6ERh5GoHN TTHBFBpGBBB/59cHPoIUZJXYTqN4BhlFsKgtsU/KYxpqltjS+9MTIcWo3Xrc7QyuDLov ZKiQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:user-agent:in-reply-to:content-disposition :mime-version:references:message-id:subject:cc:to:from:date :dkim-signature; bh=i3dCfNY+4sCEsAzr0CQ0LN7wBfZVpK7A0Ceu61hxU1s=; b=E38H/37mml1CnyWj5NIcUijWqZpDexQq73xRAV+r+PSSAjsKqKUB0VQeKN/+9VgGlA q6J5iuh+DyfZDrc5i6W2FO3ybJQHrIMIaHuKmJR9l+Frxb7WMvbt/WIHBMMMbaA/TUxm 4cveo/6Um/7pmPIoGIyoFUH6Y0k0Yvo5+RsAod3HulBsF9dewgfnfLopqMIrrGJvXAex MdCOEbXa4ZlaM5ttiFR+oSSS+75kyav9r4T7EWwhUYkXwrBQT5Di9938+84fHRQP84d3 DLpoU73JcJK0hPix9tFWMxXm6SmErr43/HG2L+9Emo8+eo8frYFoWh59O5iOgCaCNDvP XnFw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20161025 header.b=nBMEVFD3; 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 q27si14466360edi.328.2021.03.29.09.44.00; Mon, 29 Mar 2021 09:44:23 -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=nBMEVFD3; 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 S229674AbhC2QlM (ORCPT + 99 others); Mon, 29 Mar 2021 12:41:12 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45804 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231209AbhC2Qkp (ORCPT ); Mon, 29 Mar 2021 12:40:45 -0400 Received: from mail-wr1-x42d.google.com (mail-wr1-x42d.google.com [IPv6:2a00:1450:4864:20::42d]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 48481C061574 for ; Mon, 29 Mar 2021 09:40:45 -0700 (PDT) Received: by mail-wr1-x42d.google.com with SMTP id v4so13486633wrp.13 for ; Mon, 29 Mar 2021 09:40:45 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to:user-agent; bh=i3dCfNY+4sCEsAzr0CQ0LN7wBfZVpK7A0Ceu61hxU1s=; b=nBMEVFD3/Yhk0GiCpBp5e86ND6SxMpPkWarNAbzF3+egij9p7cl3HBlV3VA13sVytU NpL/Z9X8MCA/6lZXMkcOSv7DWZ2Skj9ZJSMmY7wnc4UeGgqyTpXt3p93lo2VHKovTelu YQiNOyJFGbZSESSclRQasDyQ1ZA+izauNy6dCBSKSW4ssNlXmXZFRrTnwNY5PdCwZ0Rb KrS1c9FTQYVG+l9vyOEVUxY8z54Cer5BpuZxc8U3RserLJv0A9QWFNKmsCbo/KbBUTRr RfcSdAL/23XDU3xA5ARSIVSUqqKGjV26XHV71p0r/YO6RS1f7EsAdX/LOwYkrPBjQ3MB nYAA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to:user-agent; bh=i3dCfNY+4sCEsAzr0CQ0LN7wBfZVpK7A0Ceu61hxU1s=; b=oOHcLZLCFEE90SX+faE/y4pi79/bMRu+2LBOdjKGkPhfSDMQ678sYKm2UQi47x65Me Y65Ar+QDaDtxnXvkm5/HWOKBKGNZ9QfqyUErRGl/gn9gctKaNFG25W4qkGkth3cvznKu 348gJT8gfLOuHPdzKXg1CRGx3BC/HRudwhwuje+xuYg0NGWXklNC080Zq9sxBjWhL4QO 1TBYTbErWxjHqG9OshmyzhwsfSAwFP/ryGwMM2dAuc6OtYw8v8xg4KFts+WvfRRgB6xz 6qD8+QMcWsIkTmHFlgIjnRMAxrbQXBsQLBBGmd7z7BsULKQScAbJCeyd1MdmyPaIT7fU PMOg== X-Gm-Message-State: AOAM530iFHtMtfnTKFh9NYuJn1UCTA+vSuZU0PZCsq73ue0NOic56XhJ JL5tUFGJTClAGmx5ZW9j/I+Pzg== X-Received: by 2002:adf:e38a:: with SMTP id e10mr29678375wrm.37.1617036043896; Mon, 29 Mar 2021 09:40:43 -0700 (PDT) Received: from elver.google.com ([2a00:79e0:15:13:755f:9d46:d671:14be]) by smtp.gmail.com with ESMTPSA id o11sm30017453wrq.74.2021.03.29.09.40.42 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 29 Mar 2021 09:40:43 -0700 (PDT) Date: Mon, 29 Mar 2021 18:40:36 +0200 From: Marco Elver To: "Sarvela, Tomi P" Cc: "kasan-dev@googlegroups.com" , Dave Hansen , Andy Lutomirski , Peter Zijlstra , Thomas Gleixner , Ingo Molnar , Borislav Petkov , x86@kernel.org, "H. Peter Anvin" , linux-kernel@vger.kernel.org Subject: Re: I915 CI-run with kfence enabled, issues found Message-ID: References: <66f453a79f2541d4b05bcd933204f1c9@intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <66f453a79f2541d4b05bcd933204f1c9@intel.com> User-Agent: Mutt/2.0.5 (2021-01-21) Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org [+Cc x86 maintainers] On Mon, Mar 29, 2021 at 11:11AM +0000, Sarvela, Tomi P wrote: > Hello, > > I'm Tomi Sarvela, maintainer and original creator of linux i915-CI: > https://intel-gfx-ci.01.org/ > > I got a hint from Martin Peres about kfence functionality in kernel, and it looked > something we'd like to enable in future CI runs so I made a trial run on DRM-Tip. > We've had regular KASAN-enabled runs, so the expectation was that there > wouldn't be too many new problems exposed. > > On this run two issues were found, where one is clearly kernel (GUC) issue, > but another looked a lot like kfence issue on old platforms. Affected > were IVB, SNB and ILK, with bug signature being: > > <3> [31.556004] BUG: using smp_processor_id() in preemptible [00000000] code: ... > <4> [31.556070] caller is invalidate_user_asid+0x13/0x50 > > I'm not a kernel developer myself, so I can't make hard assertions > where the issue originates. In comparison to kernel without kfence, > it looks like the newly enabled code is the cause because the > "BUG: KFENCE" signature is missing from the trace > > Can someone take a look at the traces and verify if the kfence issue > exists and is not related to the rest of the kernel? > > If there is an issue tracker, I can add this information there. > > Example traces: > https://intel-gfx-ci.01.org/tree/drm-tip/kfence_1/fi-ivb-3770/igt@gem_ctx_create@basic-files.html > > https://intel-gfx-ci.01.org/tree/drm-tip/kfence_1/fi-snb-2520m/igt@gem_ctx_create@basic-files.html > > https://intel-gfx-ci.01.org/tree/drm-tip/kfence_1/fi-ilk-650/igt@gem_exec_create@basic.html > > Kfence-exposed possible GUC issue: > https://intel-gfx-ci.01.org/tree/drm-tip/kfence_1/fi-kbl-guc/igt@kms_addfb_basic@addfb25-modifier-no-flag.html > > All results can be seen at: > https://intel-gfx-ci.01.org/tree/drm-tip/kfence_1/index.html > > CI_DRM_9910 is recent DRM-Tip commit without -rc5 pulled in yet. > kfence_1 is same commit with kfence defaults turned on: [...] It looks like the code path from flush_tlb_one_kernel() to invalidate_user_asid()'s this_cpu_ptr() has several feature checks, so probably some feature difference between systems where it triggers and it doesn't. As far as I'm aware, there is no restriction on where flush_tlb_one_kernel() is called. We could of course guard it but I think that's wrong. Other than that, I hope the x86 maintainers know what's going on here. Just for reference, the stack traces in the above logs start with: | <3> [31.556004] BUG: using smp_processor_id() in preemptible [00000000] code: dmesg/1075 | <4> [31.556070] caller is invalidate_user_asid+0x13/0x50 | <4> [31.556078] CPU: 6 PID: 1075 Comm: dmesg Not tainted 5.12.0-rc4-gda4a2b1a5479-kfence_1+ #1 | <4> [31.556081] Hardware name: Hewlett-Packard HP Pro 3500 Series/2ABF, BIOS 8.11 10/24/2012 | <4> [31.556084] Call Trace: | <4> [31.556088] dump_stack+0x7f/0xad | <4> [31.556097] check_preemption_disabled+0xc8/0xd0 | <4> [31.556104] invalidate_user_asid+0x13/0x50 | <4> [31.556109] flush_tlb_one_kernel+0x5/0x20 | <4> [31.556113] kfence_protect+0x56/0x80 | ........... Thanks, -- Marco