Received: by 2002:a25:23cc:0:0:0:0:0 with SMTP id j195csp1364834ybj; Thu, 7 May 2020 22:55:00 -0700 (PDT) X-Google-Smtp-Source: APiQypIg0SNjAFQef5odrfPJGWixJ33ntbe6CFlVxSRbGjCI3sEyi3yA7Fgt9t/u4bxTpmC+GXix X-Received: by 2002:a50:ce08:: with SMTP id y8mr787147edi.248.1588917300391; Thu, 07 May 2020 22:55:00 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1588917300; cv=none; d=google.com; s=arc-20160816; b=jv/373F198Q4c4MYL112n/b11Rton34P2SI4Lb44xzJLGrE5pSkf/LlkF19PiXFW0+ 5r3ClmkgavHY5ZkNiUtrLxuXm/D6qEmT08keEXpB6l4BIC0k1j/n4eLuwGytITpxGW6y 8eL/s595YaIiV36cipEkyLFIDC3z7+CnyIOldFfROUMtuKPA/qnPg+Jm1BxczpNA1diZ tiFk/ntCi4bN7iUtS1KYkvhWHJC+vEUhjWLQDW3PHeJYNDj/2A68kawZNIG+mrYBUmSs 9ORTlmj8FMSfelq7TsgaqQYRYP+keSl9l5Bq/CijqLIWcuZYBiWBTz6pXq874g9hmJhi hNSw== 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=7KizsQZiROV6EsP68AF78nG20gKxvU4xu7g/u2G/rfQ=; b=ApoO/kiHspG8/WrQzXKIZN495UIm7f1s26VWb2JaQqVq9Waq6M5I1nKJmPiHZ/mDsk Mk0hXBIhyLdloKHna5uNxB1Huc2yrCL9Fp/JL2DNpwTRW9ca+qzXSmSGyY5gmmpR+R5A 6zTkf4Ssr8iRPcNu/Yqywa4E4xgawD5Zq2wOAr0/FLOxOE+fT4a63OH6I0ZMVUJmeQ2R p5I/G0GSLjio7wsjYzRIQia+KUPnkJF2Ytc434vAKC9BzND9JosTGuxYUlCuVIz1l9lA XbY97DYbSz3kuiD5Zzj9J0BHFXTj1KYB2m391+Pdj3BnJ5g9ou4R+7RiyhdvajnRXC1r ZdfQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=GnzP1gSJ; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 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. [23.128.96.18]) by mx.google.com with ESMTP id ch10si389130edb.454.2020.05.07.22.54.36; Thu, 07 May 2020 22:55:00 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=GnzP1gSJ; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 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 S1726009AbgEHFu5 (ORCPT + 99 others); Fri, 8 May 2020 01:50:57 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51588 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725896AbgEHFu5 (ORCPT ); Fri, 8 May 2020 01:50:57 -0400 Received: from mail-pl1-x643.google.com (mail-pl1-x643.google.com [IPv6:2607:f8b0:4864:20::643]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id AA5EAC05BD09 for ; Thu, 7 May 2020 22:50:55 -0700 (PDT) Received: by mail-pl1-x643.google.com with SMTP id f8so260583plt.2 for ; Thu, 07 May 2020 22:50:55 -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=7KizsQZiROV6EsP68AF78nG20gKxvU4xu7g/u2G/rfQ=; b=GnzP1gSJOJe5VzGwl3UPI0/HY55joCCUajqsnrTMNQUOZaZgel2xDycfizHYUnzpF7 JELKuNlJlOoXj8e59IeVw8nOFIVL60dUapO4Yifd39sWXcSfTA2GHEEcyLhy9GkIPHZh YVaeNeMrD7GCZEmEA4Twebw5v19lpqqfQd3JQ= 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=7KizsQZiROV6EsP68AF78nG20gKxvU4xu7g/u2G/rfQ=; b=Gdy3JZ6di7DQFBH2/vCUhVt9NgOPDA5UHMMQvaXiqsVSGTWjgXKM05ZiaedQW565B0 YCjTjN7AK3ZmfHeSklYcyith320wEZbZZipKq3W1H1GKoDEQpNt2P/N4rKFw2Bd2opaK YfYw9kE6zbAMNpJtBmWunVRV9zV0GKqzgUMQ8aGAfi6Q2Tt0MdQhiKwxk+oc3ethXK/e G93wSc0c4SWuz8cKRFYYzmTXvu0A5HLBmPsoYUfb3MuBotvjIDUoB1EB9A4Hc+sDMxpt WbAIgiH0nRQi9QWEA0D1Xn6HnMTMUOP2LwYpzBqzQO/6Zoq/paYpIKJ5l0uCfbqyYab4 2Gkw== X-Gm-Message-State: AGi0PuYTpqgFJ4DGGRBsUmiJRGPSvmtmIrQ0QWE5Wb81HLPWe90dab3E /bB1JF/wssK+eF2E1T0aVh9ztA== X-Received: by 2002:a17:90a:c702:: with SMTP id o2mr4135072pjt.196.1588917055088; Thu, 07 May 2020 22:50:55 -0700 (PDT) Received: from www.outflux.net (smtp.outflux.net. [198.145.64.163]) by smtp.gmail.com with ESMTPSA id 9sm526352pgr.17.2020.05.07.22.50.53 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 07 May 2020 22:50:54 -0700 (PDT) Date: Thu, 7 May 2020 22:50:53 -0700 From: Kees Cook To: "Eric W. Biederman" Cc: linux-kernel@vger.kernel.org, Linus Torvalds , Oleg Nesterov , Jann Horn , Greg Ungerer , Rob Landley , Bernd Edlinger , linux-fsdevel@vger.kernel.org, Al Viro , Alexey Dobriyan , Andrew Morton Subject: Re: [PATCH 6/7] exec: Move most of setup_new_exec into flush_old_exec Message-ID: <202005072249.81159F29@keescook> References: <87h7wujhmz.fsf@x220.int.ebiederm.org> <87ftcei2si.fsf@x220.int.ebiederm.org> <202005051354.C7E2278688@keescook> <87blmz8lda.fsf@x220.int.ebiederm.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <87blmz8lda.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 Thu, May 07, 2020 at 04:51:13PM -0500, Eric W. Biederman wrote: > I intend to the following text to the changelog. At this point I > believe I have read through everything and nothing raises any concerns > for me: > > --- text begin --- > > To see why it is safe to move this code please note that effectively > this change moves the personality setting in the binfmt and the following > three lines of code after everything except unlocking the mutexes: > arch_pick_mmap_layout > arch_setup_new_exec > mm->task_size = TASK_SIZE > > The function arch_pick_mmap_layout at most sets: > mm->get_unmapped_area > mm->mmap_base > mm->mmap_legacy_base > mm->mmap_compat_base > mm->mmap_compat_legacy_base > which nothing in flush_old_exec or setup_new_exec depends on. > > The function arch_setup_new_exec only sets architecture specific > state and the rest of the functions only deal in state that applies > to all architectures. > > The last line just sets mm->task_size and again nothing in flush_old_exec > or setup_new_exec depend on task_size. > > --- text end --- > [...] > > So, with a bit larger changelog discussing what's moving "earlier", > > I think this looks good: > > Please see above. Awesome! Thanks for checking my checking of your checking. ;) Acked-by: Kees Cook -- Kees Cook