[tip:,sched/core] sched/rseq: Fix concurrency ID handling of usermodehelper kthreads
Message ID | 167267480086.4906.14665352998737768536.tip-bot2@tip-bot2 |
---|---|
State | New |
Headers |
Return-Path: <linux-kernel-owner@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4e01:0:0:0:0:0 with SMTP id p1csp4215782wrt; Mon, 2 Jan 2023 07:58:45 -0800 (PST) X-Google-Smtp-Source: AMrXdXtblP8irXN96GYchy3H9x7jvUPSBZacxXAo2u6H8e5uV35n6ZXWMEALYwTVRp4GVqHz0zVL X-Received: by 2002:a17:906:99c6:b0:7c1:539b:d027 with SMTP id s6-20020a17090699c600b007c1539bd027mr8593305ejn.6.1672675125463; Mon, 02 Jan 2023 07:58:45 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1672675125; cv=none; d=google.com; s=arc-20160816; b=v/ChBCJz//KX2V0E0wEiNydJcGWrV/ulMKB3tb89SZbceNz80yNMW4GERYd/u36Kzb l0sTRx+sI2ZNv7Nwf3WjPMDWJWgC0tvZ5jb+Dcy51AW5KxDjIMq8jPc+nNjc4uZYT+y3 kIzESv20N+sEqZ0uTRknCH6jq6g9gAnZdDFTdwhDR3K7auQseqsu2YM4K+xXBNgfYvVY SiSYKVUhbf3M1Kwu2IhyaaGgelp2GjSqmGtM+rrmyTl9Ocd0Cut+ugY0e5oK+nNxUCDN yd/6XNGiG20+Ik1u6GYDfvm/bNkm0fectKfJyCg+H5J1QgQ/Y1uge1treKeBf2gsfsIL Sg6g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:robot-unsubscribe :robot-id:message-id:mime-version:references:in-reply-to:cc:subject :to:reply-to:sender:from:dkim-signature:dkim-signature:date; bh=3P5pISwMYBYCrQ8Yr86Uym3gj8BN/L8IIlaMxfkhy08=; b=u1j2nyaH1iR1NUYyEWCYh0W+QBWvdgFSM2N0/SeZIcoZufnIxZ+g0k6NXkNGk0v0aI y/zOlrICdMCrXznSkNMXU3ugSkxF4UOG5RD7EGvd7Gy5H1QVqZSLZni0nw4wGI9lqqst ESIGhq+AoEO86W5Re5kff2bAuuYkeLSmXxy+Ee+rw6lBUbFhARcM3p/H8SGTzU/VYXdk PCYbnZizFcPVGmS39CFIF2yGSTfHezf8bTV+Qbt7PzqavitGelp38WK5zbQ3FrNgkiF8 Ziw/h1VZaBxX0u/mf8Ex83m8PfSB2Mc6HQAyqrNp+GXiTyo8ZQS7FE8lbzUSR2JcKU5F M52Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linutronix.de header.s=2020 header.b=WDIaj39z; dkim=neutral (no key) header.i=@linutronix.de header.s=2020e; 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=QUARANTINE dis=NONE) header.from=linutronix.de Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id xc2-20020a170907074200b007897abd2d17si24644944ejb.468.2023.01.02.07.58.21; Mon, 02 Jan 2023 07:58:45 -0800 (PST) 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=@linutronix.de header.s=2020 header.b=WDIaj39z; dkim=neutral (no key) header.i=@linutronix.de header.s=2020e; 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=QUARANTINE dis=NONE) header.from=linutronix.de Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236272AbjABPx1 (ORCPT <rfc822;yugsuo@gmail.com> + 99 others); Mon, 2 Jan 2023 10:53:27 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46644 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232107AbjABPxZ (ORCPT <rfc822;linux-kernel@vger.kernel.org>); Mon, 2 Jan 2023 10:53:25 -0500 Received: from galois.linutronix.de (Galois.linutronix.de [IPv6:2a0a:51c0:0:12e:550::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3809AB82; Mon, 2 Jan 2023 07:53:24 -0800 (PST) Date: Mon, 02 Jan 2023 15:53:20 -0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020; t=1672674801; h=from:from:sender:sender:reply-to:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=3P5pISwMYBYCrQ8Yr86Uym3gj8BN/L8IIlaMxfkhy08=; b=WDIaj39zarkxIy3RcXAEsQNsau423KjE7KQGAePWyn2aHanx9EtNzS9QA/UuUQq7qwccw7 zbvJ3sYAi4ReSi1N+H3FOs+IAyQo97tSiIkkNz8wtGdinUMWLFRWxGuq1b5DDSGpfUbCQW kFaVmDr39u610okCyxBAKADRvr6VS7khx2vYx5SU/tTS1orbO/QKjbV0DHkpPd+KBvDxeW aFMf66M+Mq0US/F/6+GR7INgIMoFzP5wlyLNbRoyYANMt+u+TvJFXhws8VZl2ZmejV1DEL DOMX6XAgG8CQZGlgvhmopnzgEJAzbBzwROZZSpTIzoIlOgMarV//96i9wekTxA== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1672674801; h=from:from:sender:sender:reply-to:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=3P5pISwMYBYCrQ8Yr86Uym3gj8BN/L8IIlaMxfkhy08=; b=lXFeWHI9Gp0KHaqnUtDDEMeHEE750GwMn4AA+3SZWgZVPNAov8+TElRUZJGJyihCOvdXq6 8anhNCCiB1WxDABQ== From: "tip-bot2 for Mathieu Desnoyers" <tip-bot2@linutronix.de> Sender: tip-bot2@linutronix.de Reply-to: linux-kernel@vger.kernel.org To: linux-tip-commits@vger.kernel.org Subject: [tip: sched/core] sched/rseq: Fix concurrency ID handling of usermodehelper kthreads Cc: kernel test robot <yujie.liu@intel.com>, Borislav Petkov <bp@alien8.de>, Mathieu Desnoyers <mathieu.desnoyers@efficios.com>, x86@kernel.org, linux-kernel@vger.kernel.org In-Reply-To: <202212301353.5c959d72-yujie.liu@intel.com> References: <202212301353.5c959d72-yujie.liu@intel.com> MIME-Version: 1.0 Message-ID: <167267480086.4906.14665352998737768536.tip-bot2@tip-bot2> Robot-ID: <tip-bot2@linutronix.de> Robot-Unsubscribe: Contact <mailto:tglx@linutronix.de> to get blacklisted from these emails Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-4.4 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_MED,SPF_HELO_NONE, SPF_PASS 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: <linux-kernel.vger.kernel.org> X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1753926992631969561?= X-GMAIL-MSGID: =?utf-8?q?1753926992631969561?= |
Series |
[tip:,sched/core] sched/rseq: Fix concurrency ID handling of usermodehelper kthreads
|
|
Commit Message
tip-bot2 for Thomas Gleixner
Jan. 2, 2023, 3:53 p.m. UTC
The following commit has been merged into the sched/core branch of tip: Commit-ID: bbd0b031509b880b4e9a880bb27ca2a30ad081ab Gitweb: https://git.kernel.org/tip/bbd0b031509b880b4e9a880bb27ca2a30ad081ab Author: Mathieu Desnoyers <mathieu.desnoyers@efficios.com> AuthorDate: Mon, 02 Jan 2023 10:12:16 -05:00 Committer: Borislav Petkov (AMD) <bp@alien8.de> CommitterDate: Mon, 02 Jan 2023 16:34:12 +01:00 sched/rseq: Fix concurrency ID handling of usermodehelper kthreads sched_mm_cid_after_execve() does not expect NULL t->mm, but it may happen if a usermodehelper kthread fails when attempting to execute a binary. sched_mm_cid_fork() can be issued from a usermodehelper kthread, which has t->flags PF_KTHREAD set. Fixes: af7f588d8f73 ("sched: Introduce per-memory-map concurrency ID") Reported-by: kernel test robot <yujie.liu@intel.com> Reported-by: Borislav Petkov <bp@alien8.de> Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com> Signed-off-by: Borislav Petkov (AMD) <bp@alien8.de> Link: https://lore.kernel.org/oe-lkp/202212301353.5c959d72-yujie.liu@intel.com --- kernel/sched/core.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/kernel/sched/core.c b/kernel/sched/core.c index 048ec24..f99ee69 100644 --- a/kernel/sched/core.c +++ b/kernel/sched/core.c @@ -11343,8 +11343,8 @@ void sched_mm_cid_after_execve(struct task_struct *t) struct mm_struct *mm = t->mm; unsigned long flags; - WARN_ON_ONCE((t->flags & PF_KTHREAD) || !t->mm); - + if (!mm) + return; local_irq_save(flags); t->mm_cid = mm_cid_get(mm); t->mm_cid_active = 1; @@ -11354,7 +11354,7 @@ void sched_mm_cid_after_execve(struct task_struct *t) void sched_mm_cid_fork(struct task_struct *t) { - WARN_ON_ONCE((t->flags & PF_KTHREAD) || !t->mm || t->mm_cid != -1); + WARN_ON_ONCE(!t->mm || t->mm_cid != -1); t->mm_cid_active = 1; } #endif