Subject: Re: [PATCH 4/4] ipv6: symbol_get to access a sit symbol

From: Christoph Hellwig <[email-masked]>
Date: Fri, 15 May 2020 08:33:24 +0200

On Thu, May 14, 2020 at 05:53:55PM -0700, David Miller wrote:
> You're not undoing one, but two levels of abstraction here.
> 
> Is this "ipip6_tunnel_locate()" call part of the SIT ioctl implementation?

Yes.  Take a look at the convoluted case handling the
SIOCADDTUNNEL and SIOCCHGTUNNEL commands in ipip6_tunnel_ioctl.

> Where did it come from?   Why are ->ndo_do_ioctl() implementations no longer
> allowed from here?

The problem is that we feed kernel pointers to it, which requires
set_fs address space overrides that I plan to kill off entirely.

> Honestly, this feels like a bit much.

My initial plan was to add a ->tunnel_ctl method to the net_device_ops,
and lift the copy_{to,from}_user for SIOCADDTUNNEL, SIOCCHGTUNNEL,
SIOCDELTUNNEL and maybe SIOCGETTUNNEL to net/socket.c.  But that turned
out to have two problems:

 - first these ioctls names use SIOCDEVPRIVATE range, that can also
   be implemented by other drivers
 - the ip_tunnel_parm struture is only used by the ipv4 tunneling
   drivers (including sit), the "real" ipv6 tunnels use a
   ip6_tnl_parm or ip6_tnl_parm structure instead

But if you don't like the symbol_get approach, I could do the
tunnel_ctl operation, just for the іpv4-ish tunnels, and only for
the kernel callers.

---end quoted text---