From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 61016C433EF for ; Wed, 11 May 2022 17:53:22 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1345866AbiEKRxU (ORCPT ); Wed, 11 May 2022 13:53:20 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36604 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1345844AbiEKRxJ (ORCPT ); Wed, 11 May 2022 13:53:09 -0400 Received: from out03.mta.xmission.com (out03.mta.xmission.com [166.70.13.233]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0CA7069287; Wed, 11 May 2022 10:53:09 -0700 (PDT) Received: from in02.mta.xmission.com ([166.70.13.52]:50264) by out03.mta.xmission.com with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.93) (envelope-from ) id 1noqWK-00FvKy-00; Wed, 11 May 2022 11:53:08 -0600 Received: from ip68-227-174-4.om.om.cox.net ([68.227.174.4]:37834 helo=email.froward.int.ebiederm.org.xmission.com) by in02.mta.xmission.com with esmtpsa (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.93) (envelope-from ) id 1noqWI-002gjC-Sf; Wed, 11 May 2022 11:53:07 -0600 From: "Eric W. Biederman" To: Linus Torvalds Cc: linux-arch , Tejun Heo , Peter Zijlstra , Vincent Guittot , Al Viro , Jens Axboe , Thomas Gleixner , Linux Kernel Mailing List References: <87a6czifo7.fsf@email.froward.int.ebiederm.org> <87ilrn1drx.ffs@tglx> <877d7zk1cf.ffs@tglx> <87y20fid4d.ffs@tglx> <87bkx5q3pk.fsf_-_@email.froward.int.ebiederm.org> <87mtfu4up3.fsf@email.froward.int.ebiederm.org> <87r150ug1l.fsf_-_@email.froward.int.ebiederm.org> Date: Wed, 11 May 2022 12:53:00 -0500 In-Reply-To: (Linus Torvalds's message of "Wed, 11 May 2022 10:42:21 -0700") Message-ID: <87zgjot0qr.fsf@email.froward.int.ebiederm.org> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.1 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-XM-SPF: eid=1noqWI-002gjC-Sf;;;mid=<87zgjot0qr.fsf@email.froward.int.ebiederm.org>;;;hst=in02.mta.xmission.com;;;ip=68.227.174.4;;;frm=ebiederm@xmission.com;;;spf=softfail X-XM-AID: U2FsdGVkX18EQ7vqdRIMDE/hVc5NAfTQ54XLnjwa7rg= X-SA-Exim-Connect-IP: 68.227.174.4 X-SA-Exim-Mail-From: ebiederm@xmission.com Subject: Re: [PATCH 8/7] sched: Update task_tick_numa to ignore tasks without an mm X-SA-Exim-Version: 4.2.1 (built Sat, 08 Feb 2020 21:53:50 +0000) X-SA-Exim-Scanned: Yes (on in02.mta.xmission.com) Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Linus Torvalds writes: On Wed, May 11, 2022 at 10:37 AM Eric W. Biederman > wrote: >> >> With the change to init and the user mode helper processes to not have >> PF_KTHREAD set before they call kernel_execve the PF_KTHREAD test in >> task_tick_numa became insufficient to detect all tasks that have >> "->mm == NULL". Correct that by testing for "->mm == NULL" directly. > > If you end up rebasing at any time for other reasons (I didn't even > check if you keep this series in a public git branch), please just > fold this fix into the original commit, so that we don't have > unnecessary bisection issues. I do have it in a public git branch. The testing in linux-next is what revealed this. However it is a topic branch that as far as I know no one depends on so I should be able to rebase it. I can rearrange the patches and tweak the description a bit. Say: sched: Update task_tick_numa to ignore tasks without an mm With the change to init and the user mode helper processes to not have PF_KTHREAD set before they call kernel_execve the PF_KTHREAD test in task_tick_numa became insufficient to detect all tasks that have "->mm == NULL". Correct that by testing for "->mm == NULL" directly. During testing Qian Cai found this and wrote: > Reverting the last 3 commits of the series fixed a boot crash. > > 1b2552cbdbe0 fork: Stop allowing kthreads to call execve > 753550eb0ce1 fork: Explicitly set PF_KTHREAD > 68d85f0a33b0 init: Deal with the init process being a user mode process > > BUG: KASAN: null-ptr-deref in task_nr_scan_windows.isra.0 > arch_atomic_long_read at ./include/linux/atomic/atomic-long.h:29 > (inlined by) atomic_long_read at ./include/linux/atomic/atomic-instrumented.h:1266 > (inlined by) get_mm_counter at ./include/linux/mm.h:1996 > (inlined by) get_mm_rss at ./include/linux/mm.h:2049 > (inlined by) task_nr_scan_windows at kernel/sched/fair.c:1123 > Read of size 8 at addr 00000000000003d0 by task swapper/0/1 Reported-by: Qian Cai Tested-by: Qian Cai Link: https://lkml.kernel.org/r/87r150ug1l.fsf_-_@email.froward.int.ebiederm.org Signed-off-by: "Eric W. Biederman" Does that sound reasonable? Eric