Received: by 2002:a05:6902:102b:0:0:0:0 with SMTP id x11csp1083743ybt; Wed, 1 Jul 2020 18:27:33 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwRngDyMDaaLgrE5iPjQlXUOvttCnhPach5SvrHvwozI36s9SGZ/iw6x35+45cUrKWsXhS5 X-Received: by 2002:a05:6402:1153:: with SMTP id g19mr31598587edw.127.1593653253409; Wed, 01 Jul 2020 18:27:33 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1593653253; cv=none; d=google.com; s=arc-20160816; b=T1M0OQrSZid2N0KRaStftWArC72rd8ERgO/lv1h8+rLgBSD36P1VdfVL8ME+7oZoPK kiHEkPwMx0cCsqYp3qLyfXd8dznhcfeaJyEjE90iVCgVlnqyVLTHRM/yNk78ao5vFxWw bTWPKqV/FPed6pXekGXl7yZxw+eStzqwwcSzlaoMWHCn914Omtq/Hy154cNTgpwuF2fV iG2TdCx30MBAjCFLDxitjsHUApevjs2qiyko/ZhYUl2K3OrL943+aU9EQYY24SSdzooz FTroOM2WSK81z34m0dJdvAXpgA3qDmujB2Nw7Ad8CtK019IUfK9WqyFPqPCnRfdTIgcW kLsg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=vgTKC+R8MA37QwGL8qHKu0QtRQUlCHjpCkAwTdPJGYw=; b=rz4v6p6nTIi5ehKjGeD75QyplDqTJaw03SGhMBbUDp+UwVePqibz0VJT5T9CA3y8CT Wqgmhmau+R6yZql/icUTMl4BTjQDgo1ajaHVk/7kFFTOTDcRaigJIn4T7Gxptpk4bTPW SzeSowjBvQEWsAY0azQi9ZSSTpVBpsPbUzOUCdMxN+WgK6Rw1q/50ogM5TiYtR+6j899 zMf5JTKFuw9yu1VN2A/yYTeq84Oki1yxkKcX1KSmmqWovwcGvrbjNJaGYNH0LZU55Zih yxKZEkXppvzAQR7b16kYcRzJhnc5na75ZAbXUKenGl90iIYC5+Pv/6igcTDoX4I+1mll Ocww== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=U8KZmcnx; 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 h19si4822761ejj.80.2020.07.01.18.27.10; Wed, 01 Jul 2020 18:27:33 -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=@kernel.org header.s=default header.b=U8KZmcnx; 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 S1728645AbgGBBYY (ORCPT + 99 others); Wed, 1 Jul 2020 21:24:24 -0400 Received: from mail.kernel.org ([198.145.29.99]:54804 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728574AbgGBBYB (ORCPT ); Wed, 1 Jul 2020 21:24:01 -0400 Received: from sasha-vm.mshome.net (c-73-47-72-35.hsd1.nh.comcast.net [73.47.72.35]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 0B83320A8B; Thu, 2 Jul 2020 01:23:59 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1593653040; bh=HaAsKCWBBL9WhNvqzM/UEu6YzDDzbzsYTbpsywnQiY0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=U8KZmcnxZSZDMddWJOm4jdvH8ipATT5WNxOIjZ1hdf7f3cNl89hLJu6cRWSir3iwM BaCc+PEh8DdMpXnm1jJnQoz/m4caPt5khSYpM41X0DY1BkGxRpTXHkpZ2lqrmgoNix GmjkotdGGoCDSKp82+mw5OowzGUlBcTMTwgxZPgU= From: Sasha Levin To: linux-kernel@vger.kernel.org, stable@vger.kernel.org Cc: Scott Wood , Sebastian Andrzej Siewior , Peter Zijlstra , Ingo Molnar , Sasha Levin Subject: [PATCH AUTOSEL 5.7 53/53] sched/core: Check cpus_mask, not cpus_ptr in __set_cpus_allowed_ptr(), to fix mask corruption Date: Wed, 1 Jul 2020 21:22:02 -0400 Message-Id: <20200702012202.2700645-53-sashal@kernel.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20200702012202.2700645-1-sashal@kernel.org> References: <20200702012202.2700645-1-sashal@kernel.org> MIME-Version: 1.0 X-stable: review X-Patchwork-Hint: Ignore Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Scott Wood [ Upstream commit fd844ba9ae59b51e34e77105d79f8eca780b3bd6 ] This function is concerned with the long-term CPU mask, not the transitory mask the task might have while migrate disabled. Before this patch, if a task was migrate-disabled at the time __set_cpus_allowed_ptr() was called, and the new mask happened to be equal to the CPU that the task was running on, then the mask update would be lost. Signed-off-by: Scott Wood Signed-off-by: Sebastian Andrzej Siewior Signed-off-by: Peter Zijlstra (Intel) Signed-off-by: Ingo Molnar Link: https://lkml.kernel.org/r/20200617121742.cpxppyi7twxmpin7@linutronix.de Signed-off-by: Sasha Levin --- kernel/sched/core.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/kernel/sched/core.c b/kernel/sched/core.c index 5eccfb816d23b..5f8130c27c7ab 100644 --- a/kernel/sched/core.c +++ b/kernel/sched/core.c @@ -1637,7 +1637,7 @@ static int __set_cpus_allowed_ptr(struct task_struct *p, goto out; } - if (cpumask_equal(p->cpus_ptr, new_mask)) + if (cpumask_equal(&p->cpus_mask, new_mask)) goto out; /* -- 2.25.1