From mboxrd@z Thu Jan 1 00:00:00 1970 From: David Miller Subject: Re: [PATCH] ipv6: avoid copy_from_user() via ipv6_renew_options_kern() Date: Sun, 24 Jun 2018 16:48:37 +0900 (KST) Message-ID: <20180624.164837.37612664745856114.davem@davemloft.net> References: <20180623.105706.385733107379565893.davem@davemloft.net> <20180623212626.GD30522@ZenIV.linux.org.uk> <20180623222106.GE30522@ZenIV.linux.org.uk> Mime-Version: 1.0 Content-Type: Text/Plain; charset=us-ascii Content-Transfer-Encoding: 7bit Cc: pmoore@redhat.com, netdev@vger.kernel.org, selinux@tycho.nsa.gov, linux-security-module@vger.kernel.org To: viro@ZenIV.linux.org.uk Return-path: Received: from shards.monkeyblade.net ([23.128.96.9]:32990 "EHLO shards.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751323AbeFXHsn (ORCPT ); Sun, 24 Jun 2018 03:48:43 -0400 In-Reply-To: <20180623222106.GE30522@ZenIV.linux.org.uk> Sender: netdev-owner@vger.kernel.org List-ID: From: Al Viro Date: Sat, 23 Jun 2018 23:21:07 +0100 > BTW, I wonder if the life would be simpler with do_ipv6_setsockopt() doing > the copy-in and verifying ipv6_optlen(*hdr) <= newoptlen; that would've > simplified ipv6_renew_option{,s}() quite a bit and completely eliminated > ipv6_renew_options_kern()... I agree that this makes things a lot simpler. One thing that drives me crazy though is this inherit stuff: > + ipv6_renew_option(newtype == IPV6_HOPOPTS ? newopt : > + opt ? opt->hopopt : NULL, Why don't we pass the type into ipv6_renew_option() and have it do this pointer dance instead? That's going to definitely be easier to read. I don't know enough about this code to give feedback about the option length handling wrt. copies, sorry.