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

From: Christoph Hellwig
Date: Fri May 15 2020 - 02:33:29 EST


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---