Received: by 2002:a05:6a10:9848:0:0:0:0 with SMTP id x8csp1492080pxf; Fri, 2 Apr 2021 12:02:10 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzBwXwo83y0YIoIOzAkjv50WSek1CwxXJSr6cdE9B94lXU+Voal09IUAzZxp5t64z+pSj0J X-Received: by 2002:a05:6402:51d4:: with SMTP id r20mr17038062edd.112.1617390130567; Fri, 02 Apr 2021 12:02:10 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1617390130; cv=none; d=google.com; s=arc-20160816; b=LcZXQlfSMh/P8/NTOtuvGwSJw/2bRtnxRritRXlLOTU904+Vwm0q0AT6RyZsuzHqGx efRKQoX+YbLzYShQL3vvRPfaMdwjA9gkbgSmS/lLf2bsSNx5exZAikOdG/C7QmJfQc49 M/U4qsk+TGr6R2OFleSA9gp42hDsFIsYC+2/1S+KOhVN9Pf3RQJiJB6nKbSGGA/VEwoB Bbo8n1F+LeX+s2gl4eu/+cEetYaFDHPRtTPjAfPYFoSmmdANFEmN4HpupCIK3NiUvoVv BBynLvigJjwWD8BZgktoC4OyasebgqXO8qBddNld8bxetROI/4jKJm9rcka1AjaO0wUx dC1A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=2BwKai1Z1q1tHkMJ9YrsZG4bHQkDjyUiaOSqIthmyIo=; b=QlPU3WF3rhD9njuIYDfkq+mrcA2PzwNY1aS9WSC7JvqDI9bKLrO0KSodUwQQo9dxVe kecfeps8yiujWSjNXUUjqVM3/cmr9VTdtFAJZFfIXv12qMcZvyxhMoRQxoVHNg6zanvZ nh/so+ewf9aUrBSXw/GTcn1AmR6/xJfv1kWbx71sBtoAEPF9rPa1fwUVb6iImcXOXuSC Vt+cZtC+hmlmBRmtqK90lArROiPbsIpSwUE0OrBUrbZ/zSKBB7w3avX+wzqxagzN96k1 hj17z/t/DRTuCudM5vOf0tq4T05vLo9zDh2J47hPaZBFpMTDhFElhtrqSeJicKHWhNDV 477A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=RgkoEa5F; 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 rl1si6662519ejb.115.2021.04.02.12.01.46; Fri, 02 Apr 2021 12:02:10 -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=RgkoEa5F; 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 S235392AbhDBTBL (ORCPT + 99 others); Fri, 2 Apr 2021 15:01:11 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48574 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229553AbhDBTBK (ORCPT ); Fri, 2 Apr 2021 15:01:10 -0400 Received: from mail-pg1-x536.google.com (mail-pg1-x536.google.com [IPv6:2607:f8b0:4864:20::536]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 43669C061788 for ; Fri, 2 Apr 2021 12:01:07 -0700 (PDT) Received: by mail-pg1-x536.google.com with SMTP id l76so4071025pga.6 for ; Fri, 02 Apr 2021 12:01:07 -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=2BwKai1Z1q1tHkMJ9YrsZG4bHQkDjyUiaOSqIthmyIo=; b=RgkoEa5FSuxCd//qvqnFqTLEAAucy8uoKkNxWxkH6m7312AlJvZhHdS5bNwpiezFzw +x1xptGRKcijwvf+W93wK4R08RQ2Yzpu98dsWbA7KpLFxnAdLtFFSbd+fuYuHvy/Vvnp lhuFlIW5GEantTu4ESS3GLUjFBA8SA7l4rsPE= 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=2BwKai1Z1q1tHkMJ9YrsZG4bHQkDjyUiaOSqIthmyIo=; b=jLU7Ndz7x7BrUBHi5ZpaMPweFPfVW0DOrSDXJyxfLGuMQbEsp8uvGUqz6BVDwuNRyD O+yUIkgFtWy2OzsNHwkQjA3zi1y03aedSEAzW0mgIKxVQr7q8esLsVPsLbCH34TwXFGR h2oWL6xcbnQgdbMPUiY21kzP2EDrqX4FB3FO0UB8x3gPx+GAC8RXr2W5djIOzCF04yEr R3srC+rkUXlcaPYCtIX8pDCopGYoM/ebbSaKXFCUK3v2PuQuukAO/w6dbXlCY1TjxB+5 p45HE+QSqiK4gF/UKFZMFdVBrcNLpMeV9XGXhruTRuww3saK0YMGqZiOe7vHvME+cS2O /oVQ== X-Gm-Message-State: AOAM5339vY555pynCzC9GOaBwBngHOedzs+OIwQVaq+DtK536x7Ciq9I LSD1YrPhCrbf9gC588p+UXYIBQ== X-Received: by 2002:a63:5a55:: with SMTP id k21mr12819957pgm.312.1617390066707; Fri, 02 Apr 2021 12:01:06 -0700 (PDT) Received: from www.outflux.net (smtp.outflux.net. [198.145.64.163]) by smtp.gmail.com with ESMTPSA id d1sm8984094pjc.24.2021.04.02.12.01.05 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 02 Apr 2021 12:01:06 -0700 (PDT) Date: Fri, 2 Apr 2021 12:01:05 -0700 From: Kees Cook To: Christoph Hellwig Cc: Al Viro , linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org, Andy Lutomirski , Will Drewry Subject: Re: [PATCH] fs: split receive_fd_replace from __receive_fd Message-ID: <202104021157.7B388D1B2@keescook> References: <20210325082209.1067987-1-hch@lst.de> <20210325082209.1067987-2-hch@lst.de> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20210325082209.1067987-2-hch@lst.de> Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, Mar 25, 2021 at 09:22:09AM +0100, Christoph Hellwig wrote: > receive_fd_replace shares almost no code with the general case, so split > it out. Also remove the "Bump the sock usage counts" comment from > both copies, as that is now what __receive_sock actually does. > > Signed-off-by: Christoph Hellwig I'm okay with repeating code in fs/file.c. What I wanted to avoid was open coded combinations in various callers. So, sure, this can be split, but as-is the patch breaks SECCOMP_IOCTL_NOTIF_ADDFD: https://lore.kernel.org/linux-fsdevel/20210329071939.GC3633@xsang-OptiPlex-9020/ -Kees -- Kees Cook