Received: by 2002:a25:e7d8:0:0:0:0:0 with SMTP id e207csp1060474ybh; Tue, 10 Mar 2020 13:48:50 -0700 (PDT) X-Google-Smtp-Source: ADFU+vvTPGLZZzpWMBQD97/3HCIE5GkrqSFt/QgdBlcimW3upbKL2WUk7Y3ucbZr/Kpp0naIkwU7 X-Received: by 2002:a9d:4b15:: with SMTP id q21mr9558352otf.84.1583873330696; Tue, 10 Mar 2020 13:48:50 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1583873330; cv=none; d=google.com; s=arc-20160816; b=gLxUi31xITHjpEBmjJMQ0dR+CamsB8W0Fnnyu+cM9vstPN4X2Y/g5vVob3SOJprSyT 2qHh9YM2b+J7+g3M7IXbpQ9B6lSD/k7apgvaHGK9z3R5EsivCm6z5kKVeG5ncwOi32b/ GmoEqhDMZYdKnajQ1CS2hqMZnEAZU+J0zXNJDxAIb8FtiXMa9dYoSXLU82BiMp7aCjzx 44N3sdh+1IBruavyIRVr7FJO4LSPp3fNUMnj7zEsmL30jbO+6rVmFGk+BqPbNU+PpTiB cF3ywDvCdNigjZgKmDtWRFzHcUZlhr40ZkHs2np/WheHNBC+fA1ONNowqM43G8BatKEp FaKw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:in-reply-to:content-disposition :mime-version:references:message-id:subject:cc:to:from:date :dkim-signature; bh=DUcwxxFRcgJR1d4ydhPOJt5zpra6K7hoDMr6GJuC66g=; b=ahiaVO8vupBcGJ5LEr9DUS5ggrCGmY+KdnUYDoLIM0yX96m3kJGwEOdMbmGOG4aDFW IcT4SB5S13ScXhEDNkMvkOxuGvWKbSkeV3dgklQ2JTvMgOUCarTi3fYHn1I+iu+cDt9k UWywRAHDPVljXXePn8VAYW6iO6QgxNKRET2A0q4St3yC/Al3/o5QP3sWj3xgyinvWODz SrT+Aqo13rLWg3qmTVMypKe+DuW22ipLbwU7tScgok10HQCZZGfH6XaOJr6TXn+uSlzI vFodtVW6xvOVe0THUKZdpj3jMmeQZpfGT2KBUWibnWiNM5cguIWAHeUFggj4BpgFOu8i Fyuw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=fMgZFq3z; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=chromium.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id q25si3822928ota.36.2020.03.10.13.48.38; Tue, 10 Mar 2020 13:48:50 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=fMgZFq3z; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=chromium.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727508AbgCJUrz (ORCPT + 99 others); Tue, 10 Mar 2020 16:47:55 -0400 Received: from mail-pj1-f66.google.com ([209.85.216.66]:36238 "EHLO mail-pj1-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726307AbgCJUrz (ORCPT ); Tue, 10 Mar 2020 16:47:55 -0400 Received: by mail-pj1-f66.google.com with SMTP id l41so948194pjb.1 for ; Tue, 10 Mar 2020 13:47:53 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to; bh=DUcwxxFRcgJR1d4ydhPOJt5zpra6K7hoDMr6GJuC66g=; b=fMgZFq3zdtsmjgrmZ83y+dSJSkDsZ1RxXFLnaUXLAWftyCsRbpnOPIZELEJvQYB2uH DCaJNkF/BmiZuR2IY7of7B5eWU3CYM1Bp+RKbcTdNqEPhwk3h5BL4rLBDUiAP20fc1Ps c+5viBYTEXQxtAUajXiZWTdBthiDog7IGOpM4= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=DUcwxxFRcgJR1d4ydhPOJt5zpra6K7hoDMr6GJuC66g=; b=NJLcwLLV7C18IwRjHSjg0RNa/Gl/xTT6x31nVhGjoweU0ZjSD7T1W/D0Q7QmievMPL +NdKjSviH7zUa3/rh7ple5WCjZUTaNYtQ3vh5+P8yazxOS/x6wRACEUtfabvOYXjMVHf B6Ta+H3IXnHVyizUSWZ7wKAnQXRtzPJPZENTyuwOSzvunrjLuxo6ZHFb5Bc1FVL5xfzl LIy6tkRVOzSnXxxVZa0x+wtA9hn99Ts6+aZwlok/SnMlmHZn5dwJuil/XHsgwBJZLjkL R2T6bM66BgGzk0jcy+PWl16JMTNA7b+5+JPjjIMSDX6HkkC1QzsFoZQu8w0uiHgi7JBA eTiQ== X-Gm-Message-State: ANhLgQ1//pBqIwxMZVorpvfzmLcAV1d7OeSrGmAEk3YhHknhWCLFeNue +fCuUfxlQ/bNGkZJEuErnWYxgg== X-Received: by 2002:a17:902:bf0b:: with SMTP id bi11mr10776957plb.245.1583873273478; Tue, 10 Mar 2020 13:47:53 -0700 (PDT) Received: from www.outflux.net (smtp.outflux.net. [198.145.64.163]) by smtp.gmail.com with ESMTPSA id t6sm16907149pfb.172.2020.03.10.13.47.52 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 10 Mar 2020 13:47:52 -0700 (PDT) Date: Tue, 10 Mar 2020 13:47:51 -0700 From: Kees Cook To: "Eric W. Biederman" Cc: Bernd Edlinger , Christian Brauner , Jann Horn , Jonathan Corbet , Alexander Viro , Andrew Morton , Alexey Dobriyan , Thomas Gleixner , Oleg Nesterov , Frederic Weisbecker , Andrei Vagin , Ingo Molnar , "Peter Zijlstra (Intel)" , Yuyang Du , David Hildenbrand , Sebastian Andrzej Siewior , Anshuman Khandual , David Howells , James Morris , Greg Kroah-Hartman , Shakeel Butt , Jason Gunthorpe , Christian Kellner , Andrea Arcangeli , Aleksa Sarai , "Dmitry V. Levin" , "linux-doc@vger.kernel.org" , "linux-kernel@vger.kernel.org" , "linux-fsdevel@vger.kernel.org" , "linux-mm@kvack.org" , "stable@vger.kernel.org" , "linux-api@vger.kernel.org" Subject: Re: [PATCH v2 4/5] exec: Move exec_mmap right after de_thread in flush_old_exec Message-ID: <202003101344.8777D43A44@keescook> References: <87v9nlii0b.fsf@x220.int.ebiederm.org> <87a74xi4kz.fsf@x220.int.ebiederm.org> <87r1y8dqqz.fsf@x220.int.ebiederm.org> <87tv32cxmf.fsf_-_@x220.int.ebiederm.org> <87v9ne5y4y.fsf_-_@x220.int.ebiederm.org> <875zfe5xzb.fsf_-_@x220.int.ebiederm.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <875zfe5xzb.fsf_-_@x220.int.ebiederm.org> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Sun, Mar 08, 2020 at 04:38:00PM -0500, Eric W. Biederman wrote: > Futher this consolidates all of the possible indefinite waits for > userspace together at the top of flush_old_exec. The possible wait > for a ptracer on PTRACE_EVENT_EXIT, the possible wait for a page fault > to be resolved in clear_child_tid, and the possible wait for a page > fault in exit_robust_list. I forgot to mention, just as a point of clarity, there are lots of other page faults possible, but they're _before_ flush_old_exec() (i.e. all the copy_strings() calls). Is it worth clarifying this to "before or at the top of flush_old_exec()" or do you mean something else? (And as always: perhaps expand flush_old_exec()'s comment to describe the newly intended state.) -- Kees Cook