Received: by 2002:a05:6358:11c7:b0:104:8066:f915 with SMTP id i7csp1122607rwl; Wed, 12 Apr 2023 08:32:18 -0700 (PDT) X-Google-Smtp-Source: AKy350bZNF60kxumOOB5mmcHWFV8YKZjZPOnlgkpvOIArRWiT47/kafH2xe7H4NGRijKoLuL5gTs X-Received: by 2002:a17:902:d501:b0:1a6:66fd:75aa with SMTP id b1-20020a170902d50100b001a666fd75aamr4931409plg.63.1681313537745; Wed, 12 Apr 2023 08:32:17 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1681313537; cv=none; d=google.com; s=arc-20160816; b=RZN7K+x7luvXiOgGTx5gAxlaDrI0gKQi/nKYC22kDqKdq+RWohQIBwUh7ww6Euu1wd qeq6ImV2KdLNwWWkESROZKBwkZVj50zsRxjntNMa+V8hxSUui3N1zWftVk6834e/3iYf wtSWHTaOpu/YAkJfyGFgO5IRW9hKO4yHKr/iPxczMk7YxJCn+5GsjzmYYh0Yali41vWI 4h38acLZu5pyG/2bGIlUllpSvHzL1KKnbGm4NCK9u6Cmo47sDsIn9/SlI2nFPrXtCy5+ 3zaqP5DR0Wx7cuo7w7XHuEhW+xQNvgqQSy1x2/VcmSM2f/m0rcQp5x8NV7KL4DVJCmMS PuOg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:user-agent:in-reply-to:content-disposition :mime-version:references:message-id:subject:cc:to:from:date; bh=C9bYGUINarHjpjzC+MUSyS477Kq5L7ayduOrDCGsXhg=; b=kR765oKz4xot+27GUbKqLq0k6UB5/hNynsmeGBmiDvaicBWLKtHsL/jzc2uLDCAPol +effl8Ofsi0PzemjulO3kUv5tOishwj/Nj1FZEK8/v0Ze3zv/5GF3Wr8UnPViZw3w95o tOaUim5R4DgoMpLLFHShOBIPBIdOcTF9x3zwSiEhwPShbR80tGp8VdJxfQaV367Y+RKG vgt1xy3o8LcX1fLx9AseCo9ls8Sk+r33LtJBJlwUdVCvba8oIWwli9utyJRmwaOTFiBA 7fxb7Gl/r4dskuN2azGKYIVjpc1YDOYasOoZyav8NjCccsakbiUQ2qll29311JHhJxiD k8Ow== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id s16-20020a170902ea1000b0019e8c3cd415si16928410plg.260.2023.04.12.08.32.04; Wed, 12 Apr 2023 08:32:17 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230118AbjDLPZy (ORCPT + 99 others); Wed, 12 Apr 2023 11:25:54 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55726 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229814AbjDLPZx (ORCPT ); Wed, 12 Apr 2023 11:25:53 -0400 Received: from verein.lst.de (verein.lst.de [213.95.11.211]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 24DF219A8; Wed, 12 Apr 2023 08:25:52 -0700 (PDT) Received: by verein.lst.de (Postfix, from userid 2407) id C796A68AA6; Wed, 12 Apr 2023 17:25:48 +0200 (CEST) Date: Wed, 12 Apr 2023 17:25:48 +0200 From: Christoph Hellwig To: Kevin Brodsky Cc: netdev@vger.kernel.org, linux-kernel@vger.kernel.org, Christoph Hellwig , Eric Dumazet , "David S. Miller" , Jakub Kicinski Subject: Re: [PATCH] net: Finish up ->msg_control{,_user} split Message-ID: <20230412152548.GA26786@lst.de> References: <20230411122625.3902339-1-kevin.brodsky@arm.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20230411122625.3902339-1-kevin.brodsky@arm.com> User-Agent: Mutt/1.5.17 (2007-11-01) X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,SPF_HELO_NONE, SPF_NONE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, Apr 11, 2023 at 01:26:25PM +0100, Kevin Brodsky wrote: > This patch is attempting to complete the split. Most issues are about > msg_control being used when in fact a user pointer is stored in the > union; msg_control_user is now used instead. An exception is made > for null checks, as it should be safe to use msg_control > unconditionally for that purpose. So all of the fixes looks good to me. > Additionally, a special situation in > cmsghdr_from_user_compat_to_kern() is addressed. There the input > struct msghdr holds a user pointer (msg_control_user), but a kernel > pointer is stored in msg_control when returning. msg_control_is_user > is now updated accordingly. But this is a small isolated real bugfix. So I'd suggest to split this into a simple and easily backportable patch, and do the rest in another. > diff --git a/net/ipv6/ipv6_sockglue.c b/net/ipv6/ipv6_sockglue.c > index 2917dd8d198c..ae818ff46224 100644 > --- a/net/ipv6/ipv6_sockglue.c > +++ b/net/ipv6/ipv6_sockglue.c > @@ -716,6 +716,7 @@ int do_ipv6_setsockopt(struct sock *sk, int level, int optname, > goto done; > > msg.msg_controllen = optlen; > + msg.msg_control_is_user = false; And this is another one that has a real effect.