Received: by 2002:a6b:500f:0:0:0:0:0 with SMTP id e15csp297579iob; Wed, 11 May 2022 14:51:28 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxp6AhWEEE8ONFcSb4dz9f7fOhYdm5tnl5cHWJ+7yQ3Vtjbg1fALLpEaA57jpBa5irIH3IF X-Received: by 2002:a05:6402:2c4:b0:427:f4a3:2e94 with SMTP id b4-20020a05640202c400b00427f4a32e94mr30978091edx.138.1652305888547; Wed, 11 May 2022 14:51:28 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1652305888; cv=none; d=google.com; s=arc-20160816; b=NfEIitf+5zsMO2GDrgbCJAjR0j2xcIcqAdhnF/NVTD6fLop+AxrPSPq4a205+F0wxq sp94lFAmkGmnQ2RiSFZQHlqErhNBwuWEuFiNgNA9amgt4FAvl2SE2Z3isgkkQ8BIje4z uRSOPONQmZ1c3XTrUJne7Gx4l0r/fiyIe+6qwNAll7LV1IsCiAuJxstt/FS5OkQuZYCz azxLbug6uT/kFgpPgM+3Bu8wKdDoK76JCYX79IgYwnU1Fs/LFNgCFnWbbc4PpjTC1zAr b8jZV8ZYsScsJ6XRY/PMJbQFJZT1WQ+P6cflkKlzp3KrXMXI6pyLVceLZm0SpjhqY9nc HcCA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:subject:mime-version:user-agent:message-id :in-reply-to:date:references:cc:to:from; bh=TmlZnR7SYpBuaa8zNaeixqOsaJBSiOtUsfF2ZSW1FtU=; b=tVZ0G3Jj01cTN29FLaU77AIv5wvAJe8GZd+dKME973PFsKkmAIT0Ebew1PiXWPukWo WrpgYd87ng8PeD6ZL0OVIvz4ygyQvDuyIZIXcE/QVbERYyWk6WExrA6ccie8/FLD7CPf fxq1zUJG/4k9unu4ZtjS3kIWSxH3iuQpGrMTa9+9E+Q8lGqKNzrlUEJHmajLyouwyhdJ VN0veH1OfFijsraj0HNvPUsEWBZyXheXgUaApfn10ARwus4+eFDhHHgOAPd4USv1oTuC w120NTCO7X1t6kAzxd1hLoemVmsQLcVgHghvupj2NPa1I8NhypLa+9Iw3gy6HEDnZHoU JxWg== ARC-Authentication-Results: i=1; mx.google.com; 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=fail (p=NONE sp=NONE dis=NONE) header.from=xmission.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id qb31-20020a1709077e9f00b006f4b5f578c7si3908943ejc.867.2022.05.11.14.51.00; Wed, 11 May 2022 14:51:28 -0700 (PDT) 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; 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=fail (p=NONE sp=NONE dis=NONE) header.from=xmission.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1345860AbiEKRxT (ORCPT + 99 others); Wed, 11 May 2022 13:53:19 -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 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net X-Spam-Status: No, score=-2.6 required=5.0 tests=BAYES_00,RCVD_IN_DNSWL_LOW, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-DCC: XMission; sa07 1397; Body=1 Fuz1=1 Fuz2=1 X-Spam-Combo: ****;Linus Torvalds X-Spam-Relay-Country: X-Spam-Timing: total 509 ms - load_scoreonly_sql: 0.08 (0.0%), signal_user_changed: 12 (2.4%), b_tie_ro: 11 (2.1%), parse: 1.33 (0.3%), extract_message_metadata: 22 (4.3%), get_uri_detail_list: 2.7 (0.5%), tests_pri_-1000: 36 (7.1%), tests_pri_-950: 1.31 (0.3%), tests_pri_-900: 1.07 (0.2%), tests_pri_-90: 148 (29.1%), check_bayes: 147 (28.8%), b_tokenize: 8 (1.6%), b_tok_get_all: 9 (1.8%), b_comp_prob: 3.1 (0.6%), b_tok_touch_all: 122 (24.0%), b_finish: 1.00 (0.2%), tests_pri_0: 273 (53.6%), check_dkim_signature: 0.62 (0.1%), check_dkim_adsp: 3.0 (0.6%), poll_dns_idle: 1.04 (0.2%), tests_pri_10: 2.4 (0.5%), tests_pri_500: 8 (1.6%), rewrite_mail: 0.00 (0.0%) 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