linux-wpan.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Stefan Schmidt <stefan@datenfreihafen.org>
To: Christoph Hellwig <hch@lst.de>, "David S. Miller" <davem@davemloft.net>
Cc: Alexei Starovoitov <ast@kernel.org>,
	Daniel Borkmann <daniel@iogearbox.net>,
	Chas Williams <3chas3@gmail.com>,
	Pablo Neira Ayuso <pablo@netfilter.org>,
	Jozsef Kadlecsik <kadlec@netfilter.org>,
	Florian Westphal <fw@strlen.de>,
	Alexey Kuznetsov <kuznet@ms2.inr.ac.ru>,
	Hideaki YOSHIFUJI <yoshfuji@linux-ipv6.org>,
	linux-kernel@vger.kernel.org, netdev@vger.kernel.org,
	bpf@vger.kernel.org, netfilter-devel@vger.kernel.org,
	linux-sctp@vger.kernel.org, linux-arch@vger.kernel.org,
	linux-bluetooth@vger.kernel.org,
	bridge@lists.linux-foundation.org, linux-can@vger.kernel.org,
	dccp@vger.kernel.org, linux-wpan@vger.kernel.org,
	mptcp@lists.01.org
Subject: Re: [PATCH 05/22] net: remove compat_sock_common_{get,set}sockopt
Date: Fri, 17 Jul 2020 11:26:34 +0200	[thread overview]
Message-ID: <52d031f9-70c2-89c1-941f-c8187a6a2b68@datenfreihafen.org> (raw)
In-Reply-To: <20200717062331.691152-6-hch@lst.de>

Hello.

On 17.07.20 08:23, Christoph Hellwig wrote:
> Add the compat handling to sock_common_{get,set}sockopt instead,
> keyed of in_compat_syscall().  This allow to remove the now unused
> ->compat_{get,set}sockopt methods from struct proto_ops.
> 
> Signed-off-by: Christoph Hellwig <hch@lst.de>
> ---
>   include/linux/net.h      |  6 ------
>   include/net/sock.h       |  4 ----
>   net/core/sock.c          | 30 ++++++------------------------
>   net/dccp/ipv4.c          |  4 ----
>   net/dccp/ipv6.c          |  2 --
>   net/ieee802154/socket.c  |  8 --------
>   net/ipv4/af_inet.c       |  6 ------
>   net/ipv6/af_inet6.c      |  4 ----
>   net/ipv6/ipv6_sockglue.c | 12 ++----------
>   net/ipv6/raw.c           |  2 --
>   net/l2tp/l2tp_ip.c       |  4 ----
>   net/l2tp/l2tp_ip6.c      |  2 --
>   net/mptcp/protocol.c     |  6 ------
>   net/phonet/socket.c      |  8 --------
>   net/sctp/ipv6.c          |  2 --
>   net/sctp/protocol.c      |  4 ----
>   16 files changed, 8 insertions(+), 96 deletions(-)
> 
> diff --git a/include/linux/net.h b/include/linux/net.h
> index 016a9c5faa3479..858ff1d981540d 100644
> --- a/include/linux/net.h
> +++ b/include/linux/net.h
> @@ -165,12 +165,6 @@ struct proto_ops {
>   				      int optname, char __user *optval, unsigned int optlen);
>   	int		(*getsockopt)(struct socket *sock, int level,
>   				      int optname, char __user *optval, int __user *optlen);
> -#ifdef CONFIG_COMPAT
> -	int		(*compat_setsockopt)(struct socket *sock, int level,
> -				      int optname, char __user *optval, unsigned int optlen);
> -	int		(*compat_getsockopt)(struct socket *sock, int level,
> -				      int optname, char __user *optval, int __user *optlen);
> -#endif
>   	void		(*show_fdinfo)(struct seq_file *m, struct socket *sock);
>   	int		(*sendmsg)   (struct socket *sock, struct msghdr *m,
>   				      size_t total_len);
> diff --git a/include/net/sock.h b/include/net/sock.h
> index 4bf8841651486d..1fd7cf5fc7516c 100644
> --- a/include/net/sock.h
> +++ b/include/net/sock.h
> @@ -1744,10 +1744,6 @@ int sock_common_recvmsg(struct socket *sock, struct msghdr *msg, size_t size,
>   			int flags);
>   int sock_common_setsockopt(struct socket *sock, int level, int optname,
>   				  char __user *optval, unsigned int optlen);
> -int compat_sock_common_getsockopt(struct socket *sock, int level,
> -		int optname, char __user *optval, int __user *optlen);
> -int compat_sock_common_setsockopt(struct socket *sock, int level,
> -		int optname, char __user *optval, unsigned int optlen);
>   
>   void sk_common_release(struct sock *sk);
>   
> diff --git a/net/core/sock.c b/net/core/sock.c
> index e085df79482520..018404d1762682 100644
> --- a/net/core/sock.c
> +++ b/net/core/sock.c
> @@ -3199,23 +3199,14 @@ int sock_common_getsockopt(struct socket *sock, int level, int optname,
>   {
>   	struct sock *sk = sock->sk;
>   
> -	return sk->sk_prot->getsockopt(sk, level, optname, optval, optlen);
> -}
> -EXPORT_SYMBOL(sock_common_getsockopt);
> -
>   #ifdef CONFIG_COMPAT
> -int compat_sock_common_getsockopt(struct socket *sock, int level, int optname,
> -				  char __user *optval, int __user *optlen)
> -{
> -	struct sock *sk = sock->sk;
> -
> -	if (sk->sk_prot->compat_getsockopt != NULL)
> +	if (in_compat_syscal() && sk->sk_prot->compat_getsockopt)
>   		return sk->sk_prot->compat_getsockopt(sk, level, optname,
>   						      optval, optlen);
> +#endif
>   	return sk->sk_prot->getsockopt(sk, level, optname, optval, optlen);
>   }
> -EXPORT_SYMBOL(compat_sock_common_getsockopt);
> -#endif
> +EXPORT_SYMBOL(sock_common_getsockopt);
>   
>   int sock_common_recvmsg(struct socket *sock, struct msghdr *msg, size_t size,
>   			int flags)
> @@ -3240,23 +3231,14 @@ int sock_common_setsockopt(struct socket *sock, int level, int optname,
>   {
>   	struct sock *sk = sock->sk;
>   
> -	return sk->sk_prot->setsockopt(sk, level, optname, optval, optlen);
> -}
> -EXPORT_SYMBOL(sock_common_setsockopt);
> -
>   #ifdef CONFIG_COMPAT
> -int compat_sock_common_setsockopt(struct socket *sock, int level, int optname,
> -				  char __user *optval, unsigned int optlen)
> -{
> -	struct sock *sk = sock->sk;
> -
> -	if (sk->sk_prot->compat_setsockopt != NULL)
> +	if (in_compat_syscall() && sk->sk_prot->compat_setsockopt)
>   		return sk->sk_prot->compat_setsockopt(sk, level, optname,
>   						      optval, optlen);
> +#endif
>   	return sk->sk_prot->setsockopt(sk, level, optname, optval, optlen);
>   }
> -EXPORT_SYMBOL(compat_sock_common_setsockopt);
> -#endif
> +EXPORT_SYMBOL(sock_common_setsockopt);
>   
>   void sk_common_release(struct sock *sk)
>   {
> diff --git a/net/dccp/ipv4.c b/net/dccp/ipv4.c
> index a7e989919c5307..316cc5ac0da72b 100644
> --- a/net/dccp/ipv4.c
> +++ b/net/dccp/ipv4.c
> @@ -999,10 +999,6 @@ static const struct proto_ops inet_dccp_ops = {
>   	.recvmsg	   = sock_common_recvmsg,
>   	.mmap		   = sock_no_mmap,
>   	.sendpage	   = sock_no_sendpage,
> -#ifdef CONFIG_COMPAT
> -	.compat_setsockopt = compat_sock_common_setsockopt,
> -	.compat_getsockopt = compat_sock_common_getsockopt,
> -#endif
>   };
>   
>   static struct inet_protosw dccp_v4_protosw = {
> diff --git a/net/dccp/ipv6.c b/net/dccp/ipv6.c
> index 650187d688519c..b50f85a72cd5fc 100644
> --- a/net/dccp/ipv6.c
> +++ b/net/dccp/ipv6.c
> @@ -1083,8 +1083,6 @@ static const struct proto_ops inet6_dccp_ops = {
>   	.sendpage	   = sock_no_sendpage,
>   #ifdef CONFIG_COMPAT
>   	.compat_ioctl	   = inet6_compat_ioctl,
> -	.compat_setsockopt = compat_sock_common_setsockopt,
> -	.compat_getsockopt = compat_sock_common_getsockopt,
>   #endif
>   };
>   
> diff --git a/net/ieee802154/socket.c b/net/ieee802154/socket.c
> index d93d4531aa9bc5..94ae9662133e30 100644
> --- a/net/ieee802154/socket.c
> +++ b/net/ieee802154/socket.c
> @@ -423,10 +423,6 @@ static const struct proto_ops ieee802154_raw_ops = {
>   	.recvmsg	   = sock_common_recvmsg,
>   	.mmap		   = sock_no_mmap,
>   	.sendpage	   = sock_no_sendpage,
> -#ifdef CONFIG_COMPAT
> -	.compat_setsockopt = compat_sock_common_setsockopt,
> -	.compat_getsockopt = compat_sock_common_getsockopt,
> -#endif
>   };
>   
>   /* DGRAM Sockets (802.15.4 dataframes) */
> @@ -986,10 +982,6 @@ static const struct proto_ops ieee802154_dgram_ops = {
>   	.recvmsg	   = sock_common_recvmsg,
>   	.mmap		   = sock_no_mmap,
>   	.sendpage	   = sock_no_sendpage,
> -#ifdef CONFIG_COMPAT
> -	.compat_setsockopt = compat_sock_common_setsockopt,
> -	.compat_getsockopt = compat_sock_common_getsockopt,
> -#endif

For the ieee802154 part:

Acked-by: Stefan Schmidt <stefan@datenfreihafen.org>

regards
Stefan Schmidt

  parent reply	other threads:[~2020-07-17  9:26 UTC|newest]

Thread overview: 27+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-07-17  6:23 sockopt cleanups Christoph Hellwig
2020-07-17  6:23 ` [PATCH 01/22] net/atm: remove the atmdev_ops {get,set}sockopt methods Christoph Hellwig
2020-07-17  6:23 ` [PATCH 02/22] net: streamline __sys_setsockopt Christoph Hellwig
2020-07-17  6:23 ` [PATCH 03/22] net: streamline __sys_getsockopt Christoph Hellwig
2020-07-17  6:23 ` [PATCH 04/22] net: simplify cBPF setsockopt compat handling Christoph Hellwig
2020-07-17  6:23 ` [PATCH 05/22] net: remove compat_sock_common_{get,set}sockopt Christoph Hellwig
2020-07-17  9:18   ` [MPTCP] " Matthieu Baerts
2020-07-17  9:26   ` Stefan Schmidt [this message]
2020-07-17  6:23 ` [PATCH 06/22] net: remove compat_sys_{get,set}sockopt Christoph Hellwig
2020-07-17  6:23 ` [PATCH 07/22] netfilter/arp_tables: clean up compat {get,set}sockopt handling Christoph Hellwig
2020-07-17  6:23 ` [PATCH 08/22] netfilter/ip_tables: " Christoph Hellwig
2020-07-17  6:23 ` [PATCH 09/22] netfilter/ip6_tables: " Christoph Hellwig
2020-07-17  6:23 ` [PATCH 10/22] netfilter/ebtables: " Christoph Hellwig
2020-07-17  6:23 ` [PATCH 11/22] netfilter: remove the compat_{get,set} methods Christoph Hellwig
2020-07-17  6:23 ` [PATCH 12/22] netfilter: remove the compat argument to xt_copy_counters_from_user Christoph Hellwig
2020-07-17  6:23 ` [PATCH 13/22] netfilter: split nf_sockopt Christoph Hellwig
2020-07-17  6:23 ` [PATCH 14/22] net/ipv4: factor out MCAST_MSFILTER getsockopt helpers Christoph Hellwig
2020-07-17  6:23 ` [PATCH 15/22] net/ipv4: factor out MCAST_MSFILTER setsockopt helpers Christoph Hellwig
2020-07-17  6:23 ` [PATCH 16/22] net/ipv4: factor out mcast join/leave " Christoph Hellwig
2020-07-17  6:23 ` [PATCH 17/22] net/ipv4: remove compat_ip_{get,set}sockopt Christoph Hellwig
2020-07-17  6:23 ` [PATCH 18/22] net/ipv6: factor out MCAST_MSFILTER getsockopt helpers Christoph Hellwig
2020-07-17  6:23 ` [PATCH 19/22] net/ipv6: factor out MCAST_MSFILTER setsockopt helpers Christoph Hellwig
2020-07-17  6:23 ` [PATCH 20/22] net/ipv6: factor out mcast join/leave " Christoph Hellwig
2020-07-17  6:23 ` [PATCH 21/22] net/ipv6: remove compat_ipv6_{get,set}sockopt Christoph Hellwig
2020-07-17  6:23 ` [PATCH 22/22] net: make ->{get,set}sockopt in proto_ops optional Christoph Hellwig
2020-07-17  8:01   ` Marc Kleine-Budde
2020-07-20  1:16 ` sockopt cleanups David Miller

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=52d031f9-70c2-89c1-941f-c8187a6a2b68@datenfreihafen.org \
    --to=stefan@datenfreihafen.org \
    --cc=3chas3@gmail.com \
    --cc=ast@kernel.org \
    --cc=bpf@vger.kernel.org \
    --cc=bridge@lists.linux-foundation.org \
    --cc=daniel@iogearbox.net \
    --cc=davem@davemloft.net \
    --cc=dccp@vger.kernel.org \
    --cc=fw@strlen.de \
    --cc=hch@lst.de \
    --cc=kadlec@netfilter.org \
    --cc=kuznet@ms2.inr.ac.ru \
    --cc=linux-arch@vger.kernel.org \
    --cc=linux-bluetooth@vger.kernel.org \
    --cc=linux-can@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-sctp@vger.kernel.org \
    --cc=linux-wpan@vger.kernel.org \
    --cc=mptcp@lists.01.org \
    --cc=netdev@vger.kernel.org \
    --cc=netfilter-devel@vger.kernel.org \
    --cc=pablo@netfilter.org \
    --cc=yoshfuji@linux-ipv6.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).