Received: by 2002:a05:6a10:f347:0:0:0:0 with SMTP id d7csp2743363pxu; Mon, 7 Dec 2020 14:36:16 -0800 (PST) X-Google-Smtp-Source: ABdhPJwW9ps+aW2AJFmh0sSId7s23Dn/LPIUEneUBg85Yi3nV6xUFwThmiFRjxFGUYEUfJ0heloY X-Received: by 2002:a17:906:74c1:: with SMTP id z1mr21463075ejl.182.1607380576700; Mon, 07 Dec 2020 14:36:16 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1607380576; cv=none; d=google.com; s=arc-20160816; b=kqQz1RS5/iSjjBOK8JDDuJUOc7P6HhtI+XV1MAI/2v/6pt3qTRLNtmgrFGT8U+p/Qj AyyrvrZLlp4IG3QjmzYDYFTr6Lx6IX6qWWPpXpV2Z1mRZv39w2DUEtvhjYbyhaaVqmLg VFz5gwHHo1p1wE5JssLqlQ+4JDL0y4F0BiTXlAg9peebj3D0psTIq2IOT4SrWBurNtFh rpYx+7Fe1f0aUAKT88BxOcRJnKLHVbNMgIYwK00vFMJEN6xtRrwbcedjpGk2wmfVu1ib lPh3V0owMkR2Q/FPhZD++ekG1B/JMvJRf4qAnLjnHYVGigaUc6GrIGi/FPvDr2YRNkCg OK4g== 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; bh=m1LDzjq8444o+5fL+zIW+hOdaR5jl90/4jxkWayNvRg=; b=XiZXnRf8vQxft7/5NWu/1Nkrj8k1w0CElt6+MWZCFb/3RcrmFV9oHgWBpP0Wy9o+Se ClMmA68QnwF+Y5pmUNgSQh31UGvtwiYpj5qO0RkaSPuZiQE5ndaZGUZILJHM1KYHKlxQ AiHypbR37LF4wKS2ROMqfOHXdocmWYKDPiokR/V0z15L5ybeZ5FJi6giiluiVZxVhQk3 pcakMp9PE07kN7r9MUdTACg0d0JjQ5/xgrPEF28D5lpw4nzkX2rTYJGEjDmfHXelx6ma POVuXpkO8sit3kjlTLoF+9wC7jdR1B57tscTqF1XNxjlsTJfKHTck6Ti6iJkmIkCOTpl jA/g== ARC-Authentication-Results: i=1; mx.google.com; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id s23si6867071ejf.192.2020.12.07.14.35.53; Mon, 07 Dec 2020 14:36:16 -0800 (PST) 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; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727589AbgLGWdQ (ORCPT + 99 others); Mon, 7 Dec 2020 17:33:16 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59382 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726515AbgLGWdQ (ORCPT ); Mon, 7 Dec 2020 17:33:16 -0500 Received: from ZenIV.linux.org.uk (zeniv.linux.org.uk [IPv6:2002:c35c:fd02::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2F0E4C061793; Mon, 7 Dec 2020 14:32:36 -0800 (PST) Received: from viro by ZenIV.linux.org.uk with local (Exim 4.92.3 #3 (Red Hat Linux)) id 1kmP3P-00HGyz-WE; Mon, 07 Dec 2020 22:32:24 +0000 Date: Mon, 7 Dec 2020 22:32:23 +0000 From: Al Viro To: Linus Torvalds Cc: Oleg Nesterov , "Eric W. Biederman" , Linux Kernel Mailing List , linux-fsdevel , criu@openvz.org, bpf , Christian Brauner , Cyrill Gorcunov , Jann Horn , Kees Cook , Daniel P =?iso-8859-1?Q?=2E_Berrang=E9?= , Jeff Layton , Miklos Szeredi , Matthew Wilcox , "J. Bruce Fields" , Trond Myklebust , Chris Wright , Alexei Starovoitov , Daniel Borkmann , Martin KaFai Lau , Song Liu , Yonghong Song , Andrii Nakryiko , John Fastabend , KP Singh Subject: Re: [PATCH v2 02/24] exec: Simplify unshare_files Message-ID: <20201207223223.GB4115853@ZenIV.linux.org.uk> References: <87r1on1v62.fsf@x220.int.ebiederm.org> <20201120231441.29911-2-ebiederm@xmission.com> <20201123175052.GA20279@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: Sender: Al Viro Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, Nov 23, 2020 at 10:25:13AM -0800, Linus Torvalds wrote: > On Mon, Nov 23, 2020 at 9:52 AM Oleg Nesterov wrote: > > > > Can anyone explain why does do_coredump() need unshare_files() at all? > > Hmm. It goes back to 2012, and it's placed just before calling > "->core_dump()", so I assume some core dumping function messed with > the file table back when.. > > I can't see anything like that currently. > > The alternative is that core-dumping just keeps the file table around > for a long while, and thus files don't actually close in a timely > manner. So it might not be a "correctness" issue as much as a latency > issue. IIRC, it was "weird architecture hooks might be playing silly buggers with some per-descriptor information they want in coredumps, better make sure it can't change under them"; it doesn't cost much and it reduced the analysis surface nicely. Had been a while ago, so the memories might be faulty... Anyway, that reasoning seems to be applicable right now - rather than keeping an eye on coredump logics on random architectures that might be looking at descriptor table in unsafe way, just make sure they have a stable private table and be done with that. How much is simplified by not doing it there, anyway?