Received: by 2002:a05:6a10:6744:0:0:0:0 with SMTP id w4csp4690006pxu; Tue, 13 Oct 2020 05:02:30 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwIsQXPr2LYPMSMfJWbPIkWDYFf6yjSPSPROYjpaFEi17oCC1zN+GA30nMDw74xGb5DmuLW X-Received: by 2002:a17:906:f8d5:: with SMTP id lh21mr32340012ejb.185.1602590550573; Tue, 13 Oct 2020 05:02:30 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1602590550; cv=none; d=google.com; s=arc-20160816; b=nYriVeg7o6FDgNi9v5GaYNHTQo2bhwYtcyUT/NmCfDD6wU/zxPriaMQrjauHRjk7Ln fuN03Lbq98tPFpWa5inUqYK4XD7sk5qAr0PsIlcMFAnTmbD3NMhGt/6NTo1DEzW2Ba90 5n5BHgqkvLqlTph/WcbACriPxA0WSHiOa/40omE0ge3jZ84f9kDA/HVwgyFvqjXxJeHW xqObS5KJc8h/B+A3dyT84hnWARdoVXSJBelVbVDZrXig0Km4ACrLy878ewWHcRRRtJcB SPt/0CipcXtLGsGYuu7t5tySwKDkikyqwscd7n01yAw684ERkUVyQ4jicOws+f5VmdqX xiIg== 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; bh=5ujasMN43CkN2/roKSf/OFVPM4luboaqc0FmVeOIrG0=; b=GWhSFpZhJAJ0hDoVNCL1/D7aft9BAzpoPb0P86F/a69KKW3jpjQDM9i1j3dFpDgDNj Ht7n+tCChfF394DYmrT45drRdjlv/2BTZ9g70nUtwCg3IufWiqFwlbrZcpFQx5Rq0srz jHDprPUP/eaREXy/v0c9DYx3GN0wux6tfinhCsSlxjiLOXRAT4m++3NKv17fJxUJwxdo alv0TlmBHhntdULF/w4SFmMB1s8M8ph+ne6bMi217NG9PBfTWLSdSowM/T6joMEl3tJt 0M4tzJuqA9fFZ45ywEz6ZN0QCqdAgVph4WjYi5Xk/YFMOZn/mLbyZGAX0QccnEDkjFQ+ M3WQ== ARC-Authentication-Results: i=1; mx.google.com; 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=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id c14si14703852edj.174.2020.10.13.05.02.06; Tue, 13 Oct 2020 05:02:30 -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; 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=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2391053AbgJMJZ3 (ORCPT + 99 others); Tue, 13 Oct 2020 05:25:29 -0400 Received: from mail-wr1-f68.google.com ([209.85.221.68]:39946 "EHLO mail-wr1-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729391AbgJMJZ3 (ORCPT ); Tue, 13 Oct 2020 05:25:29 -0400 Received: by mail-wr1-f68.google.com with SMTP id h5so13051438wrv.7; Tue, 13 Oct 2020 02:25:27 -0700 (PDT) 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=5ujasMN43CkN2/roKSf/OFVPM4luboaqc0FmVeOIrG0=; b=TadbwUK/k4AOFdIC8YLRdgRm8l6eYxT1p8qtyOvJmI8EvNXG2tG71O3ir7iPiu4J4c uZE4b6fHHEVYa5D00KqlILonUDXN7jArYlXGWRubOcdUa3yvD7sWpT/8kuWn+m3MvVWS +fyCaVFSR532dVaXH6abCJH/nG4a50orR2tu59c0Bar6QQxFUKLbQkRFjgf4GtsJO5zs S731WTrid9oUbA4wkHtAxlH3mCB5y2WGZx5MzBZe26GNw9DYTi351erBrHZc7WDXrrXt oiOEZpCRaB77xaYjmLjRmGy65Vf670Yu0tY8s7KrJpCD3mIa8YS4erWRDRPLt9gWlfaU yNtA== X-Gm-Message-State: AOAM531Jv9UBXR+wABBISTnD4PTgsKgUDQiNAuUnIuLNAe9cJnQhsjUW S/4tYSBQH47+8WPhOoEIK+g= X-Received: by 2002:a5d:448b:: with SMTP id j11mr19786577wrq.129.1602581127306; Tue, 13 Oct 2020 02:25:27 -0700 (PDT) Received: from liuwe-devbox-debian-v2 ([51.145.34.42]) by smtp.gmail.com with ESMTPSA id v3sm29403029wre.17.2020.10.13.02.25.26 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 13 Oct 2020 02:25:26 -0700 (PDT) Date: Tue, 13 Oct 2020 09:25:25 +0000 From: Wei Liu To: Sasha Levin Cc: kys@microsoft.com, haiyangz@microsoft.com, sthemmin@microsoft.com, wei.liu@kernel.org, tglx@linutronix.de, mingo@redhat.com, bp@alien8.de, x86@kernel.org, hpa@zytor.com, vkuznets@redhat.com, mikelley@microsoft.com, linux-hyperv@vger.kernel.org, linux-kernel@vger.kernel.org, stable@kernel.org Subject: Re: [PATCH v2 1/2] x86/hyper-v: guard against cpu mask changes in hyperv_flush_tlb_others() Message-ID: <20201013092525.4po4glgjn2vodytf@liuwe-devbox-debian-v2> References: <20201005233739.2560641-1-sashal@kernel.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20201005233739.2560641-1-sashal@kernel.org> User-Agent: NeoMutt/20180716 Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, Oct 05, 2020 at 07:37:38PM -0400, Sasha Levin wrote: > cpumask can change underneath us, which is generally safe except when we > call into hv_cpu_number_to_vp_number(): if cpumask ends up empty we pass > num_cpu_possible() into hv_cpu_number_to_vp_number(), causing it to read > garbage. As reported by KASAN: > > [ 83.504763] BUG: KASAN: slab-out-of-bounds in hyperv_flush_tlb_others (include/asm-generic/mshyperv.h:128 arch/x86/hyperv/mmu.c:112) > [ 83.908636] Read of size 4 at addr ffff888267c01370 by task kworker/u8:2/106 > [ 84.196669] CPU: 0 PID: 106 Comm: kworker/u8:2 Tainted: G W 5.4.60 #1 > [ 84.196669] Hardware name: Microsoft Corporation Virtual Machine/Virtual Machine, BIOS 090008 12/07/2018 > [ 84.196669] Workqueue: writeback wb_workfn (flush-8:0) > [ 84.196669] Call Trace: > [ 84.196669] dump_stack (lib/dump_stack.c:120) > [ 84.196669] print_address_description.constprop.0 (mm/kasan/report.c:375) > [ 84.196669] __kasan_report.cold (mm/kasan/report.c:507) > [ 84.196669] kasan_report (arch/x86/include/asm/smap.h:71 mm/kasan/common.c:635) > [ 84.196669] hyperv_flush_tlb_others (include/asm-generic/mshyperv.h:128 arch/x86/hyperv/mmu.c:112) > [ 84.196669] flush_tlb_mm_range (arch/x86/include/asm/paravirt.h:68 arch/x86/mm/tlb.c:798) > [ 84.196669] ptep_clear_flush (arch/x86/include/asm/tlbflush.h:586 mm/pgtable-generic.c:88) > What is the easiest way to reproduce this? Just enable KASAN in the guest and run it normally? I want to have a chance to verify my earlier reply. Thanks, Wei.