Received: by 2002:a25:e7d8:0:0:0:0:0 with SMTP id e207csp1048784ybh; Tue, 10 Mar 2020 13:32:17 -0700 (PDT) X-Google-Smtp-Source: ADFU+vurYTkqkQ1N6SzTnxUvGSCtXBXxw+LYuwCIfte5E67nUWTjR2bgDL7tvD0Q53vEITkOwZ9L X-Received: by 2002:a9d:171e:: with SMTP id i30mr11735732ota.327.1583872337719; Tue, 10 Mar 2020 13:32:17 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1583872337; cv=none; d=google.com; s=arc-20160816; b=QFBzr7YVZ80Q3Fw9sBPf+E1bB1vLJfxbp5cnyhFRItoj9ISL6PRBd9gZ0XkM0SV5pd 3W+anjzXib4BRz8VjutcRckFxm+ZQj12vZzqFbL69EwK8ICnKqLy7Jd1JfzQ0e+NA4Hm 2uDVR9S/gyIEHc//gv7ht0b9G0L8BmC20BOhEZH3oDYUtRmEg5ePO4nTLVTXfOeyIpo/ Vlm3n9gLfa7KXDkOxNR3OAmRxEoY0nRCFBXDwzFrBdx0GTEAwagRSSxb9cfCul6+pnoF C1h7Ptm0HzcbOdE5cfP+oD506u9q9+mg21BVFpM/RiPFcNO21OV5BJZULJYqmG5QgiX2 GyEA== 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=SXv613ohwLZhXYr9jit6ve5UEm0jQz5ZLBUY3A1Qh/4=; b=PcP85YeqNj3NjxhxYScMdyejA00b8CIYpsMPjhKtkpoIAMNlInju3m6BskGMgRzSme 4IM4VR9RH23yi9349/hdVIOkduzEkz8BOue2C4huvPYY55u2Qot3kbu4IUEW6+51iHWo WjSsWevW9NUilk7pHlvNONLglJ4CZndv8t+EcoD4ZotnXCnXU4xrpvsh6vqQ1CsLWLmJ 0XupXeNsycT+lOCKZlqyku+07PPNoYUgsniCXvSi0Py62eH+yvpdcwSsEIwNBhRobrsj eDkjLPVkU1XKf5jdKG3OeCCAOmEHmgMaXc6bymQgCX2GjHyMur6iPnRi4PFP+GKgmJxf nUdQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=XK1ouSvI; 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 z65si659880otb.197.2020.03.10.13.32.04; Tue, 10 Mar 2020 13:32:17 -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=XK1ouSvI; 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 S1726641AbgCJUbU (ORCPT + 99 others); Tue, 10 Mar 2020 16:31:20 -0400 Received: from mail-pf1-f193.google.com ([209.85.210.193]:37241 "EHLO mail-pf1-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726467AbgCJUbU (ORCPT ); Tue, 10 Mar 2020 16:31:20 -0400 Received: by mail-pf1-f193.google.com with SMTP id p14so5198pfn.4 for ; Tue, 10 Mar 2020 13:31:19 -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=SXv613ohwLZhXYr9jit6ve5UEm0jQz5ZLBUY3A1Qh/4=; b=XK1ouSvIn1SrXrpE2jB7fPZ97wuSynEPpj4HhSXMNSXZWl5ShAjfCYXT5irwpY6R5K GhTb4r+GBtdXtwQ7AqZpQT4zG1MOZvavI8l7jKs0+HzwzxDheOxB6TKArYWjMCD7s5Ob TsIYA2DD/9E+2ADf9dPVRUDESK4sdz6wOBd0k= 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=SXv613ohwLZhXYr9jit6ve5UEm0jQz5ZLBUY3A1Qh/4=; b=m/gW3E8LIeagIf9YdyHUCOWCCUiiPRE1ZGuayXM7mU083bCck741Vtqx5FPAorarGf 7Ou5ItfqpyUjODJPZyV52doMHPUkx8+a2zyPRGgjsw/XKW1t3MUQcxYYd65kfTxI+60t oc28CBCFX+4fhnjq6m0xyC8iuj0NJRfkJ8LdAY0qbwtMEx/OxfrcE7yG6Ti72rM0OUGl gP8PZw92CPkH2aFzia8GoYgJMoR4WCZkpjvmXYwF8dVC0WWEhJmvSVocaDneLbJgI5Eh z2zk5qIOgdYoIaxDzhWWELo/mEEnS/qmejS+2nrj1y4KEoN8e72rspMied3DDzpPQ5pO gamQ== X-Gm-Message-State: ANhLgQ0124wIQX6pHlb3vJth7Micmdrfhhn6y+xekI3xpp2SLQFm+W2N vdVwTjEJ3onb7WDioGRfdzenwg== X-Received: by 2002:a63:fc18:: with SMTP id j24mr21853810pgi.16.1583872279279; Tue, 10 Mar 2020 13:31:19 -0700 (PDT) Received: from www.outflux.net (smtp.outflux.net. [198.145.64.163]) by smtp.gmail.com with ESMTPSA id d3sm2205705pfq.126.2020.03.10.13.31.18 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 10 Mar 2020 13:31:18 -0700 (PDT) Date: Tue, 10 Mar 2020 13:31:17 -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 3/5] exec: Move cleanup of posix timers on exec out of de_thread Message-ID: <202003101329.08B332F@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> <87eeu25y14.fsf_-_@x220.int.ebiederm.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <87eeu25y14.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:36:55PM -0500, Eric W. Biederman wrote: > > These functions have very little to do with de_thread move them out > of de_thread an into flush_old_exec proper so it can be more clearly > seen what flush_old_exec is doing. > > Signed-off-by: "Eric W. Biederman" > --- > fs/exec.c | 10 +++++----- > 1 file changed, 5 insertions(+), 5 deletions(-) > > diff --git a/fs/exec.c b/fs/exec.c > index ff74b9a74d34..215d86f77b63 100644 > --- a/fs/exec.c > +++ b/fs/exec.c > @@ -1189,11 +1189,6 @@ static int de_thread(struct task_struct *tsk) > /* we have changed execution domain */ > tsk->exit_signal = SIGCHLD; > > -#ifdef CONFIG_POSIX_TIMERS > - exit_itimers(sig); > - flush_itimer_signals(); > -#endif > - > BUG_ON(!thread_group_leader(tsk)); > return 0; > > @@ -1277,6 +1272,11 @@ int flush_old_exec(struct linux_binprm * bprm) > if (retval) > goto out; > > +#ifdef CONFIG_POSIX_TIMERS > + exit_itimers(me->signal); > + flush_itimer_signals(); > +#endif > + I twitch at seeing #ifdefs in .c instead of hidden in the .h declarations of these two functions, but as this is a copy/paste, I'll live. ;) Reviewed-by: Kees Cook -Kees > /* > * Make the signal table private. > */ > -- > 2.25.0 > -- Kees Cook