#include <linux/bpf-cgroup.h>
#include <linux/ethtool.h>
#include <linux/mm.h>
#include <linux/socket.h>
#include <linux/file.h>
#include <linux/splice.h>
#include <linux/net.h>
#include <linux/interrupt.h>
#include <linux/thread_info.h>
#include <linux/rcupdate.h>
#include <linux/netdevice.h>
#include <linux/proc_fs.h>
#include <linux/seq_file.h>
#include <linux/mutex.h>
#include <linux/if_bridge.h>
#include <linux/if_vlan.h>
#include <linux/ptp_classify.h>
#include <linux/init.h>
#include <linux/poll.h>
#include <linux/cache.h>
#include <linux/module.h>
#include <linux/highmem.h>
#include <linux/mount.h>
#include <linux/pseudo_fs.h>
#include <linux/security.h>
#include <linux/syscalls.h>
#include <linux/compat.h>
#include <linux/kmod.h>
#include <linux/audit.h>
#include <linux/wireless.h>
#include <linux/nsproxy.h>
#include <linux/magic.h>
#include <linux/slab.h>
#include <linux/xattr.h>
#include <linux/nospec.h>
#include <linux/indirect_call_wrapper.h>
#include <linux/io_uring/net.h>
#include <linux/uaccess.h>
#include <asm/unistd.h>
#include <net/compat.h>
#include <net/wext.h>
#include <net/cls_cgroup.h>
#include <net/sock.h>
#include <linux/netfilter.h>
#include <linux/if_tun.h>
#include <linux/ipv6_route.h>
#include <linux/route.h>
#include <linux/termios.h>
#include <linux/sockios.h>
#include <net/busy_poll.h>
#include <linux/errqueue.h>
#include <linux/ptp_clock_kernel.h>
#include <trace/events/sock.h>
#ifdef CONFIG_NET_RX_BUSY_POLL
unsigned int sysctl_net_busy_read __read_mostly;
unsigned int sysctl_net_busy_poll __read_mostly;
#endif
static ssize_t sock_read_iter(struct kiocb *iocb, struct iov_iter *to);
static ssize_t sock_write_iter(struct kiocb *iocb, struct iov_iter *from);
static int sock_mmap(struct file *file, struct vm_area_struct *vma);
static int sock_close(struct inode *inode, struct file *file);
static __poll_t sock_poll(struct file *file,
struct poll_table_struct *wait);
static long sock_ioctl(struct file *file, unsigned int cmd, unsigned long arg);
#ifdef CONFIG_COMPAT
static long compat_sock_ioctl(struct file *file,
unsigned int cmd, unsigned long arg);
#endif
static int sock_fasync(int fd, struct file *filp, int on);
static ssize_t sock_splice_read(struct file *file, loff_t *ppos,
struct pipe_inode_info *pipe, size_t len,
unsigned int flags);
static void sock_splice_eof(struct file *file);
#ifdef CONFIG_PROC_FS
static void sock_show_fdinfo(struct seq_file *m, struct file *f)
{ … }
#else
#define sock_show_fdinfo …
#endif
static const struct file_operations socket_file_ops = …;
static const char * const pf_family_names[] = …;
static DEFINE_SPINLOCK(net_family_lock);
static const struct net_proto_family __rcu *net_families[NPROTO] __read_mostly;
int move_addr_to_kernel(void __user *uaddr, int ulen, struct sockaddr_storage *kaddr)
{ … }
static int move_addr_to_user(struct sockaddr_storage *kaddr, int klen,
void __user *uaddr, int __user *ulen)
{ … }
static struct kmem_cache *sock_inode_cachep __ro_after_init;
static struct inode *sock_alloc_inode(struct super_block *sb)
{ … }
static void sock_free_inode(struct inode *inode)
{ … }
static void init_once(void *foo)
{ … }
static void init_inodecache(void)
{ … }
static const struct super_operations sockfs_ops = …;
static char *sockfs_dname(struct dentry *dentry, char *buffer, int buflen)
{ … }
static const struct dentry_operations sockfs_dentry_operations = …;
static int sockfs_xattr_get(const struct xattr_handler *handler,
struct dentry *dentry, struct inode *inode,
const char *suffix, void *value, size_t size)
{ … }
#define XATTR_SOCKPROTONAME_SUFFIX …
#define XATTR_NAME_SOCKPROTONAME …
#define XATTR_NAME_SOCKPROTONAME_LEN …
static const struct xattr_handler sockfs_xattr_handler = …;
static int sockfs_security_xattr_set(const struct xattr_handler *handler,
struct mnt_idmap *idmap,
struct dentry *dentry, struct inode *inode,
const char *suffix, const void *value,
size_t size, int flags)
{ … }
static const struct xattr_handler sockfs_security_xattr_handler = …;
static const struct xattr_handler * const sockfs_xattr_handlers[] = …;
static int sockfs_init_fs_context(struct fs_context *fc)
{ … }
static struct vfsmount *sock_mnt __read_mostly;
static struct file_system_type sock_fs_type = …;
struct file *sock_alloc_file(struct socket *sock, int flags, const char *dname)
{ … }
EXPORT_SYMBOL(…);
static int sock_map_fd(struct socket *sock, int flags)
{ … }
struct socket *sock_from_file(struct file *file)
{ … }
EXPORT_SYMBOL(…);
struct socket *sockfd_lookup(int fd, int *err)
{ … }
EXPORT_SYMBOL(…);
static struct socket *sockfd_lookup_light(int fd, int *err, int *fput_needed)
{ … }
static ssize_t sockfs_listxattr(struct dentry *dentry, char *buffer,
size_t size)
{ … }
static int sockfs_setattr(struct mnt_idmap *idmap,
struct dentry *dentry, struct iattr *iattr)
{ … }
static const struct inode_operations sockfs_inode_ops = …;
struct socket *sock_alloc(void)
{ … }
EXPORT_SYMBOL(…);
static void __sock_release(struct socket *sock, struct inode *inode)
{ … }
void sock_release(struct socket *sock)
{ … }
EXPORT_SYMBOL(…);
void __sock_tx_timestamp(__u16 tsflags, __u8 *tx_flags)
{ … }
EXPORT_SYMBOL(…);
INDIRECT_CALLABLE_DECLARE(…);
INDIRECT_CALLABLE_DECLARE(…);
static noinline void call_trace_sock_send_length(struct sock *sk, int ret,
int flags)
{ … }
static inline int sock_sendmsg_nosec(struct socket *sock, struct msghdr *msg)
{ … }
static int __sock_sendmsg(struct socket *sock, struct msghdr *msg)
{ … }
int sock_sendmsg(struct socket *sock, struct msghdr *msg)
{ … }
EXPORT_SYMBOL(…);
int kernel_sendmsg(struct socket *sock, struct msghdr *msg,
struct kvec *vec, size_t num, size_t size)
{ … }
EXPORT_SYMBOL(…);
int kernel_sendmsg_locked(struct sock *sk, struct msghdr *msg,
struct kvec *vec, size_t num, size_t size)
{ … }
EXPORT_SYMBOL(…);
static bool skb_is_err_queue(const struct sk_buff *skb)
{ … }
static bool skb_is_swtx_tstamp(const struct sk_buff *skb, int false_tstamp)
{ … }
static ktime_t get_timestamp(struct sock *sk, struct sk_buff *skb, int *if_index)
{ … }
static void put_ts_pktinfo(struct msghdr *msg, struct sk_buff *skb,
int if_index)
{ … }
void __sock_recv_timestamp(struct msghdr *msg, struct sock *sk,
struct sk_buff *skb)
{ … }
EXPORT_SYMBOL_GPL(…);
#ifdef CONFIG_WIRELESS
void __sock_recv_wifi_status(struct msghdr *msg, struct sock *sk,
struct sk_buff *skb)
{ … }
EXPORT_SYMBOL_GPL(…);
#endif
static inline void sock_recv_drops(struct msghdr *msg, struct sock *sk,
struct sk_buff *skb)
{ … }
static void sock_recv_mark(struct msghdr *msg, struct sock *sk,
struct sk_buff *skb)
{ … }
void __sock_recv_cmsgs(struct msghdr *msg, struct sock *sk,
struct sk_buff *skb)
{ … }
EXPORT_SYMBOL_GPL(…);
INDIRECT_CALLABLE_DECLARE(…);
INDIRECT_CALLABLE_DECLARE(…);
static noinline void call_trace_sock_recv_length(struct sock *sk, int ret, int flags)
{ … }
static inline int sock_recvmsg_nosec(struct socket *sock, struct msghdr *msg,
int flags)
{ … }
int sock_recvmsg(struct socket *sock, struct msghdr *msg, int flags)
{ … }
EXPORT_SYMBOL(…);
int kernel_recvmsg(struct socket *sock, struct msghdr *msg,
struct kvec *vec, size_t num, size_t size, int flags)
{ … }
EXPORT_SYMBOL(…);
static ssize_t sock_splice_read(struct file *file, loff_t *ppos,
struct pipe_inode_info *pipe, size_t len,
unsigned int flags)
{ … }
static void sock_splice_eof(struct file *file)
{ … }
static ssize_t sock_read_iter(struct kiocb *iocb, struct iov_iter *to)
{ … }
static ssize_t sock_write_iter(struct kiocb *iocb, struct iov_iter *from)
{ … }
static DEFINE_MUTEX(br_ioctl_mutex);
static int (*br_ioctl_hook)(struct net *net, struct net_bridge *br,
unsigned int cmd, struct ifreq *ifr,
void __user *uarg);
void brioctl_set(int (*hook)(struct net *net, struct net_bridge *br,
unsigned int cmd, struct ifreq *ifr,
void __user *uarg))
{ … }
EXPORT_SYMBOL(…);
int br_ioctl_call(struct net *net, struct net_bridge *br, unsigned int cmd,
struct ifreq *ifr, void __user *uarg)
{ … }
static DEFINE_MUTEX(vlan_ioctl_mutex);
static int (*vlan_ioctl_hook) (struct net *, void __user *arg);
void vlan_ioctl_set(int (*hook) (struct net *, void __user *))
{ … }
EXPORT_SYMBOL(…);
static long sock_do_ioctl(struct net *net, struct socket *sock,
unsigned int cmd, unsigned long arg)
{ … }
static long sock_ioctl(struct file *file, unsigned cmd, unsigned long arg)
{ … }
int sock_create_lite(int family, int type, int protocol, struct socket **res)
{ … }
EXPORT_SYMBOL(…);
static __poll_t sock_poll(struct file *file, poll_table *wait)
{ … }
static int sock_mmap(struct file *file, struct vm_area_struct *vma)
{ … }
static int sock_close(struct inode *inode, struct file *filp)
{ … }
static int sock_fasync(int fd, struct file *filp, int on)
{ … }
int sock_wake_async(struct socket_wq *wq, int how, int band)
{ … }
EXPORT_SYMBOL(…);
int __sock_create(struct net *net, int family, int type, int protocol,
struct socket **res, int kern)
{ … }
EXPORT_SYMBOL(…);
int sock_create(int family, int type, int protocol, struct socket **res)
{ … }
EXPORT_SYMBOL(…);
int sock_create_kern(struct net *net, int family, int type, int protocol, struct socket **res)
{ … }
EXPORT_SYMBOL(…);
static struct socket *__sys_socket_create(int family, int type, int protocol)
{ … }
struct file *__sys_socket_file(int family, int type, int protocol)
{ … }
__bpf_hook_start();
__weak noinline int update_socket_protocol(int family, int type, int protocol)
{ … }
__bpf_hook_end();
int __sys_socket(int family, int type, int protocol)
{ … }
SYSCALL_DEFINE3(socket, int, family, int, type, int, protocol)
{ … }
int __sys_socketpair(int family, int type, int protocol, int __user *usockvec)
{ … }
SYSCALL_DEFINE4(socketpair, int, family, int, type, int, protocol,
int __user *, usockvec)
{ … }
int __sys_bind_socket(struct socket *sock, struct sockaddr_storage *address,
int addrlen)
{ … }
int __sys_bind(int fd, struct sockaddr __user *umyaddr, int addrlen)
{ … }
SYSCALL_DEFINE3(bind, int, fd, struct sockaddr __user *, umyaddr, int, addrlen)
{ … }
int __sys_listen_socket(struct socket *sock, int backlog)
{ … }
int __sys_listen(int fd, int backlog)
{ … }
SYSCALL_DEFINE2(listen, int, fd, int, backlog)
{ … }
struct file *do_accept(struct file *file, struct proto_accept_arg *arg,
struct sockaddr __user *upeer_sockaddr,
int __user *upeer_addrlen, int flags)
{ … }
static int __sys_accept4_file(struct file *file, struct sockaddr __user *upeer_sockaddr,
int __user *upeer_addrlen, int flags)
{ … }
int __sys_accept4(int fd, struct sockaddr __user *upeer_sockaddr,
int __user *upeer_addrlen, int flags)
{ … }
SYSCALL_DEFINE4(accept4, int, fd, struct sockaddr __user *, upeer_sockaddr,
int __user *, upeer_addrlen, int, flags)
{ … }
SYSCALL_DEFINE3(accept, int, fd, struct sockaddr __user *, upeer_sockaddr,
int __user *, upeer_addrlen)
{ … }
int __sys_connect_file(struct file *file, struct sockaddr_storage *address,
int addrlen, int file_flags)
{ … }
int __sys_connect(int fd, struct sockaddr __user *uservaddr, int addrlen)
{ … }
SYSCALL_DEFINE3(connect, int, fd, struct sockaddr __user *, uservaddr,
int, addrlen)
{ … }
int __sys_getsockname(int fd, struct sockaddr __user *usockaddr,
int __user *usockaddr_len)
{ … }
SYSCALL_DEFINE3(getsockname, int, fd, struct sockaddr __user *, usockaddr,
int __user *, usockaddr_len)
{ … }
int __sys_getpeername(int fd, struct sockaddr __user *usockaddr,
int __user *usockaddr_len)
{ … }
SYSCALL_DEFINE3(getpeername, int, fd, struct sockaddr __user *, usockaddr,
int __user *, usockaddr_len)
{ … }
int __sys_sendto(int fd, void __user *buff, size_t len, unsigned int flags,
struct sockaddr __user *addr, int addr_len)
{ … }
SYSCALL_DEFINE6(sendto, int, fd, void __user *, buff, size_t, len,
unsigned int, flags, struct sockaddr __user *, addr,
int, addr_len)
{ … }
SYSCALL_DEFINE4(send, int, fd, void __user *, buff, size_t, len,
unsigned int, flags)
{ … }
int __sys_recvfrom(int fd, void __user *ubuf, size_t size, unsigned int flags,
struct sockaddr __user *addr, int __user *addr_len)
{ … }
SYSCALL_DEFINE6(recvfrom, int, fd, void __user *, ubuf, size_t, size,
unsigned int, flags, struct sockaddr __user *, addr,
int __user *, addr_len)
{ … }
SYSCALL_DEFINE4(recv, int, fd, void __user *, ubuf, size_t, size,
unsigned int, flags)
{ … }
static bool sock_use_custom_sol_socket(const struct socket *sock)
{ … }
int do_sock_setsockopt(struct socket *sock, bool compat, int level,
int optname, sockptr_t optval, int optlen)
{ … }
EXPORT_SYMBOL(…);
int __sys_setsockopt(int fd, int level, int optname, char __user *user_optval,
int optlen)
{ … }
SYSCALL_DEFINE5(setsockopt, int, fd, int, level, int, optname,
char __user *, optval, int, optlen)
{ … }
INDIRECT_CALLABLE_DECLARE(…);
int do_sock_getsockopt(struct socket *sock, bool compat, int level,
int optname, sockptr_t optval, sockptr_t optlen)
{ … }
EXPORT_SYMBOL(…);
int __sys_getsockopt(int fd, int level, int optname, char __user *optval,
int __user *optlen)
{ … }
SYSCALL_DEFINE5(getsockopt, int, fd, int, level, int, optname,
char __user *, optval, int __user *, optlen)
{ … }
int __sys_shutdown_sock(struct socket *sock, int how)
{ … }
int __sys_shutdown(int fd, int how)
{ … }
SYSCALL_DEFINE2(shutdown, int, fd, int, how)
{ … }
#define COMPAT_MSG(msg, member) …
#define COMPAT_NAMELEN(msg) …
#define COMPAT_FLAGS(msg) …
struct used_address { … };
int __copy_msghdr(struct msghdr *kmsg,
struct user_msghdr *msg,
struct sockaddr __user **save_addr)
{ … }
static int copy_msghdr_from_user(struct msghdr *kmsg,
struct user_msghdr __user *umsg,
struct sockaddr __user **save_addr,
struct iovec **iov)
{ … }
static int ____sys_sendmsg(struct socket *sock, struct msghdr *msg_sys,
unsigned int flags, struct used_address *used_address,
unsigned int allowed_msghdr_flags)
{ … }
static int sendmsg_copy_msghdr(struct msghdr *msg,
struct user_msghdr __user *umsg, unsigned flags,
struct iovec **iov)
{ … }
static int ___sys_sendmsg(struct socket *sock, struct user_msghdr __user *msg,
struct msghdr *msg_sys, unsigned int flags,
struct used_address *used_address,
unsigned int allowed_msghdr_flags)
{ … }
long __sys_sendmsg_sock(struct socket *sock, struct msghdr *msg,
unsigned int flags)
{ … }
long __sys_sendmsg(int fd, struct user_msghdr __user *msg, unsigned int flags,
bool forbid_cmsg_compat)
{ … }
SYSCALL_DEFINE3(sendmsg, int, fd, struct user_msghdr __user *, msg, unsigned int, flags)
{ … }
int __sys_sendmmsg(int fd, struct mmsghdr __user *mmsg, unsigned int vlen,
unsigned int flags, bool forbid_cmsg_compat)
{ … }
SYSCALL_DEFINE4(sendmmsg, int, fd, struct mmsghdr __user *, mmsg,
unsigned int, vlen, unsigned int, flags)
{ … }
static int recvmsg_copy_msghdr(struct msghdr *msg,
struct user_msghdr __user *umsg, unsigned flags,
struct sockaddr __user **uaddr,
struct iovec **iov)
{ … }
static int ____sys_recvmsg(struct socket *sock, struct msghdr *msg_sys,
struct user_msghdr __user *msg,
struct sockaddr __user *uaddr,
unsigned int flags, int nosec)
{ … }
static int ___sys_recvmsg(struct socket *sock, struct user_msghdr __user *msg,
struct msghdr *msg_sys, unsigned int flags, int nosec)
{ … }
long __sys_recvmsg_sock(struct socket *sock, struct msghdr *msg,
struct user_msghdr __user *umsg,
struct sockaddr __user *uaddr, unsigned int flags)
{ … }
long __sys_recvmsg(int fd, struct user_msghdr __user *msg, unsigned int flags,
bool forbid_cmsg_compat)
{ … }
SYSCALL_DEFINE3(recvmsg, int, fd, struct user_msghdr __user *, msg,
unsigned int, flags)
{ … }
static int do_recvmmsg(int fd, struct mmsghdr __user *mmsg,
unsigned int vlen, unsigned int flags,
struct timespec64 *timeout)
{ … }
int __sys_recvmmsg(int fd, struct mmsghdr __user *mmsg,
unsigned int vlen, unsigned int flags,
struct __kernel_timespec __user *timeout,
struct old_timespec32 __user *timeout32)
{ … }
SYSCALL_DEFINE5(recvmmsg, int, fd, struct mmsghdr __user *, mmsg,
unsigned int, vlen, unsigned int, flags,
struct __kernel_timespec __user *, timeout)
{ … }
#ifdef CONFIG_COMPAT_32BIT_TIME
SYSCALL_DEFINE5(recvmmsg_time32, int, fd, struct mmsghdr __user *, mmsg,
unsigned int, vlen, unsigned int, flags,
struct old_timespec32 __user *, timeout)
{ … }
#endif
#ifdef __ARCH_WANT_SYS_SOCKETCALL
#define AL …
static const unsigned char nargs[21] = …;
#undef AL
SYSCALL_DEFINE2(socketcall, int, call, unsigned long __user *, args)
{ … }
#endif
int sock_register(const struct net_proto_family *ops)
{ … }
EXPORT_SYMBOL(…);
void sock_unregister(int family)
{ … }
EXPORT_SYMBOL(…);
bool sock_is_registered(int family)
{ … }
static int __init sock_init(void)
{ … }
core_initcall(sock_init);
#ifdef CONFIG_PROC_FS
void socket_seq_show(struct seq_file *seq)
{ … }
#endif
int get_user_ifreq(struct ifreq *ifr, void __user **ifrdata, void __user *arg)
{ … }
EXPORT_SYMBOL(…);
int put_user_ifreq(struct ifreq *ifr, void __user *arg)
{ … }
EXPORT_SYMBOL(…);
#ifdef CONFIG_COMPAT
static int compat_siocwandev(struct net *net, struct compat_ifreq __user *uifr32)
{ … }
static int compat_ifr_data_ioctl(struct net *net, unsigned int cmd,
struct compat_ifreq __user *u_ifreq32)
{ … }
static int compat_sock_ioctl_trans(struct file *file, struct socket *sock,
unsigned int cmd, unsigned long arg)
{ … }
static long compat_sock_ioctl(struct file *file, unsigned int cmd,
unsigned long arg)
{ … }
#endif
int kernel_bind(struct socket *sock, struct sockaddr *addr, int addrlen)
{ … }
EXPORT_SYMBOL(…);
int kernel_listen(struct socket *sock, int backlog)
{ … }
EXPORT_SYMBOL(…);
int kernel_accept(struct socket *sock, struct socket **newsock, int flags)
{ … }
EXPORT_SYMBOL(…);
int kernel_connect(struct socket *sock, struct sockaddr *addr, int addrlen,
int flags)
{ … }
EXPORT_SYMBOL(…);
int kernel_getsockname(struct socket *sock, struct sockaddr *addr)
{ … }
EXPORT_SYMBOL(…);
int kernel_getpeername(struct socket *sock, struct sockaddr *addr)
{ … }
EXPORT_SYMBOL(…);
int kernel_sock_shutdown(struct socket *sock, enum sock_shutdown_cmd how)
{ … }
EXPORT_SYMBOL(…);
u32 kernel_sock_ip_overhead(struct sock *sk)
{ … }
EXPORT_SYMBOL(…);