Received: by 2002:a05:6358:d09b:b0:dc:cd0c:909e with SMTP id jc27csp1460275rwb; Tue, 29 Nov 2022 14:01:33 -0800 (PST) X-Google-Smtp-Source: AA0mqf73hqSo5elKhQO2POV8fjSN534EjrlMImhPG2C1U3izC6q6v2Y2a2/UF8Cp66AJudYZKgTx X-Received: by 2002:a17:90a:5d05:b0:219:57e:7790 with SMTP id s5-20020a17090a5d0500b00219057e7790mr26469533pji.3.1669759292787; Tue, 29 Nov 2022 14:01:32 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1669759292; cv=none; d=google.com; s=arc-20160816; b=QI7jzU4m8a9PzYf8Tx+aGnoPDsMJM3IjOzVtCmTvv3uS+HdlDUDV+ka/2njAY7u6N3 4o4yxmo1FIgxQng4ZNlQLds6SwSLXWrjDmxs1VIWenisV4ESU/PSau9m/Zr9nt0kaWPW 9rgtnOoLAWfg3GDJ5eiJn6zuLjrWmiD+varMjfyRKOZYtOCanHCKR0P/B5XshDqJId53 fbEYBxQkKQhbEaxcBrYkDPNPCx0amDofw5HPlPoNzLmbOOQQAqNT3H36Iq8dO74j1qn6 Vv6fa4ACfdZfEbN4SWTBbEXgIUFai/JSMNNNXRf5B5pCjkqk/+oLY05AH196iTn2Wmv/ Rzkg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:message-id:date:references :in-reply-to:subject:cc:to:dkim-signature:dkim-signature:from; bh=kE3agNpQbCMxGAh1tjuuMDPZbQ68guiLd4sGQzwul8w=; b=xvcGJjZY/BBC+vFO3Xz5YH7eLprQ1TorvNYEzOwybaxjJx7Pl8Vt1X/EXKPJonpTYR jXSiCRPqo3sKiT9SBOpBGis1BsvurSg3reLzwQtsztn4tf49VaJn2/eYPkzaTJku9LOJ C9vbaEHg/7zxLhJIkTXj4/yWxwGynX4Z2rUWDsWrgQbtn1yTZfHaIir2EChZGOiaHLgm 7zXzZl5g7S6fKiYWHr3dhy8DKiWqWjatMTttoB+vQaNfbq8AIrLfKIE74aEBFQ37IKUi ClQbz7kK5BNwDQz7UUX9KIQxsnxJ/RKczzeh8SvWYZmk1F1pyl8FxyuTLEOQS5MFJebd cV3A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linutronix.de header.s=2020 header.b=F2Xe4BKd; dkim=neutral (no key) header.i=@linutronix.de; 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 Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id h1-20020a63df41000000b00412607fea43si15053078pgj.617.2022.11.29.14.01.20; Tue, 29 Nov 2022 14:01:32 -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=F2Xe4BKd; dkim=neutral (no key) header.i=@linutronix.de; 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 S237050AbiK2VSi (ORCPT + 84 others); Tue, 29 Nov 2022 16:18:38 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48674 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236889AbiK2VSc (ORCPT ); Tue, 29 Nov 2022 16:18:32 -0500 Received: from galois.linutronix.de (Galois.linutronix.de [193.142.43.55]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E9E4A5CD24 for ; Tue, 29 Nov 2022 13:18:30 -0800 (PST) From: Thomas Gleixner DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020; t=1669756708; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=kE3agNpQbCMxGAh1tjuuMDPZbQ68guiLd4sGQzwul8w=; b=F2Xe4BKdR/KuHRBtBHesfNN2VV1yXl2PhtB82Dzj+CuLVpizvsQlji9g74pogDdYviPBuu g1b5P2YIB0DPU1zZk/VcTjoxPMudmHdZnY5hJnm20SqHrmDwrZ1CZfJCloObnHlWs9XyQ5 066i67bu82AZRvQVTJaSVjL55Wfqe4sV+GJcB7l3SnAMDi7Hm8w0+DJK1Pt0NpoKYLcRF2 KG5OrquCTUwqdf7y8CshvmuyJHOfOaWiM3SoVV+UApVYaYdDVsqJtaEF+q+xqSMgtsFjMx b5+KFncw0aSxQVs+Jnv8BnjT68nM2Z5gywCWVwbScS5oo11chGZYZ+sve+h7tw== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1669756708; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=kE3agNpQbCMxGAh1tjuuMDPZbQ68guiLd4sGQzwul8w=; b=QB/qfxQbauK5SgMGo2Oc15pcMvrjrrwURVIx0A+9Dm6/ZG/MzZndcGQM63VTu+cwl7mL2D fkzc5Dt2Zq4oZJAw== To: Jann Horn Cc: Andrei Vagin , linux-kernel@vger.kernel.org Subject: Re: [PATCH 2/2] time/namespace: Forbid timens page faults under kthread_use_mm() In-Reply-To: <20221129191839.2471308-2-jannh@google.com> References: <20221129191839.2471308-1-jannh@google.com> <20221129191839.2471308-2-jannh@google.com> Date: Tue, 29 Nov 2022 22:18:28 +0100 Message-ID: <87fse1v4rf.ffs@tglx> MIME-Version: 1.0 Content-Type: text/plain 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: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, Nov 29 2022 at 20:18, Jann Horn wrote: > find_timens_vvar_page() doesn't work when current's timens does not match > the timens associated with current->mm. > v6 of the series adding this code [1] had some complicated code to deal > with this case, but v7 [2] removed that. > > Since the vvar region is designed to only be accessed by vDSO code, and > vDSO code can't run in kthread context, it should be fine to error out in > this case. Should? Either it is correct or not. But the way more interesting question is: > struct page *find_timens_vvar_page(struct vm_area_struct *vma) > { > + /* > + * We can't handle faults where current's timens does not match the > + * timens associated with the mm_struct. This can happen if a page fault > + * occurs in a kthread that is using kthread_use_mm(). > + */ How does a kthread, which obvioulsy did kthread_use_mm(), end up trying to fault in the time namespace vvar page? It's probably something nasty, but the changelog has a big information void. It neither answers the obvious question why this is a problem of the time namespace vvar page and not a general issue versus a kthread, which borrowed a user mm, ending up in vdso_fault() in the first place? None of those VDSO (user space) addresses are subject to be faulted in by anything else than the associated user space task(s). Thanks, tglx