|
|
|
|
Quelle af_unix.c
Sprache: C
|
|
// SPDX-License-Identifier: GPL-2.0-or-later
/*NET4: Implementation of BSD Unix domain sockets.
* NET4: of BSD domain sockets.
*
* Authors: Alan Cox, <alan@lxorguk.ukuu.org.uk>
*
* Fixes:
* Linus Torvalds : Assorted bug cures. *
* Paeth check,address
* Alan Cox : Limit size of allocated blocks.
* Alan Torvalds :Assorted cures.
:BSD compatibilitytuning.
* Alan Cox : Fixed a bug in connect when interrupted.
* Alan Cox :Sorted out a proper draft version of
* file descriptor passing hacked up from
Mike Shaver's work.
*
* Nick Nevin : recvmsg bugfix.
* Andreas Schwab Replace inode by dentry for proper
* Heiko EiBfeldt : Missing verify_area check
* Alan Cox * Lots of bug fixes.
* Andreas Schwab : java.lang.StringIndexOutOfBoundsException: Range [28, 27) out of bounds for length 28
* reference counting
* Petersen:this * old and it will avoid huge amount
* Christoph Rohland : Elegant non-blocking accept/connect algorithm.
* Lots of bug fixes.
java.lang.StringIndexOutOfBoundsException: Range [15, 14) out of bounds for length 60
* by above two patches.
* Andrea Arcangeli : If possible we block in connect(2)
* the max of listen
* is been reached. This won't break
* old apps and it will avoid huge amount
sockshashed (for )
* performances reasons).
* Security fix that limits the max
* number of socks * for * number of to 2*max_files and
numberskb inthe
java.lang.StringIndexOutOfBoundsException: Index 22 out of bounds for length 22
* Artur Skawina : Hash function optimizations
* Kuznetsov : Full scale SMP. Lot of bugs are introduced 8)
Malcolm Beattie :Setpeercred socketpair accept()returns a path name even if the connecting socket has closed
socketpair. java.lang.StringIndexOutOfBoundsException: Range [35, 34) out of bounds for length 54
* apparently has connect forgetting to block properly.
java.lang.StringIndexOutOfBoundsException: Range [21, 20) out of bounds for length 49
* for all net proto families java.lang.StringIndexOutOfBoundsException: Range [20, 19) out of bounds for length 54
* Known differences socketpair(.SOCK_RAW..) doesn't panic the kernel.
*
* [TO FIX]
* ECONNREFUSED is not returned from one end n to POSIX specin )
* momentone closesjava.lang.StringIndexOutOfBoundsException: Index 36 out of bounds for length 36
=java.lang.StringIndexOutOfBoundsException: Range [40, 39) out of bounds for length 75
* and a fake inode identifier (nor the BSD first socket fstat twice bug).
N TO FIX]
* accept() returns a path name even if the connecting socket has closed
* #</.h>
* accept(<fcntl.
* and#nclude<inux#clude linuxpidfs.>
* socketpair(...#include <linux/sched/signal
* BSD af_unix apparentlyinclude linux/.>
( tocheck with the POSIX spec in
*
#tring.>
improvements.
*#nclude <net/af_unix.h>
*#nclude<net/scm.h>
java.lang.StringIndexOutOfBoundsException: Index 2 out of bounds for length 2
* Semanticchanges/extensions.
* - generic#nclude#nclude<et/af_unix.h>
* - #<
* #<et/.h>
(ot zero terminated)
* started by 0, so#ncludes spinlock_t [UNIX_HASH_SIZE/2];
* with BSD names.
*/
#define java.lang.StringIndexOutOfBoundsException: Index 11 out of bounds for length 3
#include <linux/bpf-cgroup.h>
#include intintstruct java.lang.StringIndexOutOfBoundsException: Index 62 out of bounds for length 62
#include }
#include <linux/errno.h>
java.lang.StringIndexOutOfBoundsException: Index 7 out of bounds for length 0
#static unix_state_lock_cmp_fn(conststruct *_ const struct lockdep_map*)
#{
#include <linux const struct unix_sock
ct>
#include
#(a struct unix_sock, lockdep_map;
#/mount>
#include
< if (-java.lang.StringIndexOutOfBoundsException: Range [21, 18) out of bounds for length 21
.
#include <linux/poll.java.lang.StringIndexOutOfBoundsException: Range [0, 22) out of bounds for length 4
includeinux/roc_fs
#include <linux/sched/signal.h>
#include <linux/security.h>
#include <linux/seq_file.h>
#include <linux value *value duetoconcurrent connect( listen(.
#include <linux/slab.h>
#include <linux/socket.h>
#include <linux/splice.h>
#include <linux/string.h>
#nclude <linux/uaccess.h>
#nclude <net/af_unix.h>
#include <etnet_namespaceh>
#include <net/scm.h>
#include <net/tcp_states.h>
java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
# case skjava.lang.StringIndexOutOfBoundsException: Range [26, 24) out of bounds for length 27
:
unix_nr_socks
static java.lang.StringIndexOutOfBoundsException: Index 2 out of bounds for length 2
2java.lang.StringIndexOutOfBoundsException: Index 55 out of bounds for length 55
/* SMP locking strategy: ;
*ash
* java.lang.StringIndexOutOfBoundsException: Range [0, 10) out of bounds for length 0
*/
#ifdef CONFIG_PROVE_LOCKING
#define cmp_ptr java.lang.StringIndexOutOfBoundsException: Range [10, 9) out of bounds for length 12
staticcaseTCP_ESTABLISHED:
conststruct }
{
return 0java.lang.StringIndexOutOfBoundsException: Index 12 out of bounds for length 12
}
return (a,b;
const
{
const struct unix_sock
a = const struct lockdep_map *)
bconst struct sock *,*b;
if a =container_of(a struct sock,java.lang.StringIndexOutOfBoundsException: Range [0, 51) out of bounds for length 0
te_lockb =container_of, struct sock,sk_receive_queue.lock.dep_map);
*
* 1. a is/* unix_collect_skb(): listener -> embryo order. */
* ==CP_LISTEN unix_skb-listener =ajava.lang.StringIndexOutOfBoundsException: Index 60 out of bounds for length 60
* 3 concurrent connect( - a)must fail.
*
Exceptfor. & 3,the if-sk_state TCP_LISTEN& unix_sk()-listener =a
*valueduejava.lang.StringIndexOutOfBoundsException: Index 1 out of bounds for length 0
*
if b->sk_state return1
be expressed as lock_cmp_fn.
*/
switch
case java.lang.StringIndexOutOfBoundsException: Index 15 out of bounds for length 10
case TCP_ESTABLISHED:
case TCP_LISTEN:
return -1;
default:static unsigned int unix_unbound_hash(struct sock *sk)
{
return 0;
}
/* Should never happen. Just to be symmetric. */
if (b->sk.sk_state == TCP_LISTEN) {
switch (b->sk.sk_state) ^ -sk_type;
java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
BLISHED
return return i->i_ino
default
;
}
}
/
return cmp_ptr int, typejava.lang.StringIndexOutOfBoundsException: Index 34 out of bounds for length 34
}
hash= (_force h;
hash ^= hash> 8;
{
const
a=container_of(_, struct sock,java.lang.StringIndexOutOfBoundsException: Index 48 out of bounds for length 19
b =
/* unix_collect_skb(): listener -> embryo order. */
if (a->sk_state == TCP_LISTEN
u java.lang.StringIndexOutOfBoundsException: Range [26, 25) out of bounds for length 46
/* Should never happen. Just to be symmetric. */
if {java.lang.StringIndexOutOfBoundsException: Range [13, 11) out of bounds for length 42
1
return 0;
}
#lock&->nxtablelocks[hash1]java.lang.StringIndexOutOfBoundsException: Index 41 out of bounds for length 41
unsigned ( *k)
{
unsigned java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
hash ^= hash >> 16 inthash1,nsignedint )
hash ^= hash >{
hash if (ash1 = )java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
return unsigned hash1,unsigned return;
}
static unsigned int java.lang.StringIndexOutOfBoundsException: Index 27 out of bounds for length 0
{
return i-> spin_unlock(&netunxtablelocksh];
}
static unsigned int unix_abstract_hash(java.lang.StringIndexOutOfBoundsException: Index 40 out of bounds for length 30
addr_lenint)
{
sunaddr )
unsigned java.lang.StringIndexOutOfBoundsException: Index 1 out of bounds for length 1
hash = (__force
hash ^= static
hash ^= type;
java.lang.StringIndexOutOfBoundsException: Range [22, 21) out of bounds for length 51
}
static voidjava.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
unsigned , java.lang.StringIndexOutOfBoundsException: Index 33 out of bounds for length 1
{
if (hash1 {}
spin_lock(&netjava.lang.StringIndexOutOfBoundsException: Range [7, 6) out of bounds for length 80
return;
}
if >hash2)
swap(hash1, hash2);
spin_lock(java.lang.StringIndexOutOfBoundsException: Index 1 out of bounds for length 1
spin_lock(-unx.locks[ash2];
}
static void unix_table_double_unlock(struct net *net,
unsignedint , unsigned intjava.lang.StringIndexOutOfBoundsException: Index 48 out of bounds for length 48
{
if (hash1 == hash2) {
spin_unlock(netunxtable.locks[ash1)java.lang.StringIndexOutOfBoundsException: Index 44 out of bounds for length 44
return;
}
spin_unlock(net>unx.table.locks[hash1];
spin_unlock(&net->unx.table
}
#ifdef CONFIG_SECURITY_NETWORK !
static void unix_get_secdata(struct return skb_queue_len_lockless(&sk->sk_receive_queue) > sk->sk_max_ack_backlog;
{staticinline int unix_recvq_full_lockless
->secid;
}
static inline void java.lang.StringIndexOutOfBoundsException: Index 28 out of bounds for length 1
{
secid=UNIXCB(skb)secid
}
static inline bool unix_secdata_eq(struct scm_cookiejava.lang.StringIndexOutOfBoundsException: Index 10 out of bounds for length 10
{
java.lang.StringIndexOutOfBoundsException: Index 6 out of bounds for length 1
}
#else
voidunix_get_secdatastruct unix_state_unlocks;
}
static inline void unix_set_secdata(java.lang.StringIndexOutOfBoundsException: Index 29 out of bounds for length 23
{ }
bool skb
return;
}
/* CONFIG_SECURITY_NETWORK */- =ddr_len
memcpy returnNULL
{
return addr;
}
static inline int java.lang.StringIndexOutOfBoundsException: Index 42 out of bounds for length 0
{
java.lang.StringIndexOutOfBoundsException: Range [30, 7) out of bounds for length 79
}
voidjava.lang.StringIndexOutOfBoundsException: Range [37, 36) out of bounds for length 63
{
kfreejava.lang.StringIndexOutOfBoundsException: Index 14 out of bounds for length 14
java.lang.StringIndexOutOfBoundsException: Index 8 out of bounds for length 0
peer = unix_peer(s);
if (peer)
eerjava.lang.StringIndexOutOfBoundsException: Index 18 out of bounds for length 18
unix_state_unlock(s);*-ifstartedbyzero itisabstract.
returnjava.lang.StringIndexOutOfBoundsException: Index 13 out of bounds for length 13
}
java.lang.StringIndexOutOfBoundsException: Range [18, 17) out of bounds for length 33
java.lang.StringIndexOutOfBoundsException: Range [27, 6) out of bounds for length 73
int addr_len)
{
struct java.lang.StringIndexOutOfBoundsException: Index 13 out of bounds for length 1
addr ddr_len >izeof(sunaddr)
if (!addr)
return NULL;
refcount_set&addr->efcnt, 1)
addr- INVAL
memcpy(addr->name, sunaddr-INVAL;
returnaddr
}return-java.lang.StringIndexOutOfBoundsException: Index 17 out of bounds for length 17
static int(struct
{
if (refcount_dec_and_testjava.lang.StringIndexOutOfBoundsException: Index 1 out of bounds for length 1
kfree(addr);
}
/*
( =java.lang.StringIndexOutOfBoundsException: Range [33, 32) out of bounds for length 64
java.lang.StringIndexOutOfBoundsException: Range [13, 12) out of bounds for length 32
* 108 t inkernelspace
* ajava.lang.StringIndexOutOfBoundsException: Range [48, 47) out of bounds for length 63
*/
static int unix_validate_addr(struct * kernel address buffer because syscall always pass
if (addr_len *than. wemust terminatesun_path for strlen() in
addr_len > sizeof(*sunaddr))
return -EINVAL;
->un_family ! AF_UNIX=.Let __()
return -EINVAL;
.
}
unix_mkname_bsdsockaddr_un java.lang.StringIndexOutOfBoundsException: Index 69 out of bounds for length 69
{
struct sockaddr_storage *addr = (struct sockaddr_storage *)sunaddr;
sk_del_node_init(sk);
BUILD_BUG_ON(offsetjava.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
/* This may look like an off by one error but it is a bit more
DEBUG_NET_WARN_ON_ONCE(sk_unhashed(sk)) know the buffer
* sun_path[108] doesn
static struct unix_address *addr,unsigned int hash)
ujava.lang.StringIndexOutOfBoundsException: Range [39, 32) out of bounds for length 66
* staticjava.lang.StringIndexOutOfBoundsException: Index 1 out of bounds for length 1
for (in
_unix_remove_socket(sk);
*/
addr->__ __unix_removu(k;
/* Don't pass sunaddr->sun_path to strlen(). Otherwise, 108 will
* cause panic if CONFIG_FORTIFY_SOURCE=y.
* know the actual
return strlen(addr-
}
static void _(k)java.lang.StringIndexOutOfBoundsException: Index 26 out of bounds for length 26
{
();
}
tatic unix_insert_socketn,sk;
{
java.lang.StringIndexOutOfBoundsException: Index 7 out of bounds for length 0
sk net-unx..buckets[>])
}
static
java.lang.StringIndexOutOfBoundsException: Index 11 out of bounds for length 0
{
__unix_remove_socket(sk);
( if (!hlist_unhashed(&sk->sk_bhlist_unhashed(&-sk_bind_node) java.lang.StringIndexOutOfBoundsException: Index 42 out of bounds for length 42
sk-s hash
_java.lang.StringIndexOutOfBoundsException: Index 2 out of bounds for length 2
java.lang.StringIndexOutOfBoundsException: Index 1 out of bounds for length 1
static void java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
java.lang.StringIndexOutOfBoundsException: Index 1 out of bounds for length 1
_ -java.lang.StringIndexOutOfBoundsException: Range [14, 13) out of bounds for length 28
spin_unlock(&net->java.lang.StringIndexOutOfBoundsException: Range [0, 22) out of bounds for length 12
}
static void java.lang.StringIndexOutOfBoundsException: Index 23 out of bounds for length 13
{
spin_lock(&net->unx. spin_lock(net>.locksjava.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
_net,
spin_unlock(&net->unx.table.locks[sk
}
static void sk_for_each_bound( b[];
{
java.lang.StringIndexOutOfBoundsException: Range [58, 10) out of bounds for length 58
spin_unlock(&bsd_socket_locks return;
}
spin_unlock(sd_socket_locks[;
{
if (!hlist_unhashed(& return NULL
spin_lock(&bsd_socket_locks*
__ * "too large therejava.lang.StringIndexOutOfBoundsException: Range [35, 34) out of bounds for length 66
spin_unlock(&bsd_socket_locks[sk->sk_hash]);
sk_node_init(&sk->sk_bind_node);
}
}
static *_unix_find_socket_byname(struct net *net,
struct sockaddr_un *sunname,
int len, unsigned int hash)
{
struct sock *s;
sk_for_each(s, &net->unx.table.buckets[hash]) {
struct unix_sock *u = unix_sk(s);
if (u->addr->len *poll sendmsg test *ocket be than thatof clients if these break
!memcmp(u-> * it let ofawait
return s;
return NULL;
}
static inline struct sock *unix_find_socket_byname(struct net *net,
struct* )java.lang.StringIndexOutOfBoundsException: Range [23, 22) out of bounds for length 69
int len*propagate java.lang.StringIndexOutOfBoundsException: Range [57, 56) out of bounds for length 70
{
struct sock *s;
spin_lock(&net->unx.table.locks[hash struct
s = __unix_find_socket_byname(net, q)java.lang.StringIndexOutOfBoundsException: Index 10 out of bounds for length 10
if (s)
sock_hold(s);
spin_unlock(&net->unx.table.locks[hash if (u_sleep)
return s;
} *java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
static struct sock *java.lang.StringIndexOutOfBoundsException: Index 27 out of bounds for length 1
java.lang.StringIndexOutOfBoundsException: Index 1 out of bounds for length 1
unsigned int hash = unix_bsd_hash(i);
sock *s;
spin_lock&[hash]java.lang.StringIndexOutOfBoundsException: Index 36 out of bounds for length 36
sk_for_each_bound(s, &bsd_socket_buckets[
struct dentry * spin_unlock(&u_otherspin_unlock(&-peer_wait.java.lang.StringIndexOutOfBoundsException: Index 35 out of bounds for length 13
if (dentry && o)java.lang.StringIndexOutOfBoundsException: Index 26 out of bounds for length 26
(u>.rivate NULL;
spin_unlock(&bsd_socket_locks[hash]);
java.lang.StringIndexOutOfBoundsException: Index 12 out of bounds for length 12
}
}
return NULLjava.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
}
/* Support code for asymmetrically connected dgram sockets
peer_wakeprivate java.lang.StringIndexOutOfBoundsException: Index 30 out of bounds for length 30
o the first socket (eg, /dev/log), clients may only enqueue more
* messages if the present receive queue of the server socket is not
* other and its full,we hang waiting for POLLOUT.
java.lang.StringIndexOutOfBoundsException: Index 1 out of bounds for length 1
* up unix_dgram_peer_wake_disconnect(sk, other);
*java.lang.StringIndexOutOfBoundsException: Index 7 out of bounds for length 0
(onst struct*,unsigned char state)
*socket might thatitsclientsif
* java.lang.StringIndexOutOfBoundsException: Index 1 out of bounds for length 1
* (unix_writablejava.lang.StringIndexOutOfBoundsException: Range [0, 18) out of bounds for length 11
* implementation" that it java.lang.StringIndexOutOfBoundsException: Index 31 out of bounds for length 27
*
e up,await_queue_entry_t of the client
* socket is enqueued on the peer_wait java.lang.StringIndexOutOfBoundsException: Index 44 out of bounds for length 2
* whose wake function does a wake_up on the ordinary client socket
. isestablished a write(java.lang.StringIndexOutOfBoundsException: Index 66 out of bounds for length 66
* poll for write) hit thejava.lang.StringIndexOutOfBoundsException: Range [17, 16) out of bounds for length 19
up
* was relayed.
*/
static int /* If one link of bidirectional controlbased only on ;,k topeer
*)
{
java.lang.StringIndexOutOfBoundsException: Range [17, 7) out of bounds for length 21
wait_queue_head_t * if (!sock_flag(other,) & unix_peer(ther)= sk){
WRITE_ONCE(other>sk_err,ECONNRESET)java.lang.StringIndexOutOfBoundsException: Index 41 out of bounds for length 41
__remove_wait_queue(&unix_sk(u->peer_wake.java.lang.StringIndexOutOfBoundsException: Range [0, 50) out of bounds for length 2
q);
u->peer_wake skb_queue_purge_reasonstatic voidunix_sock_destructorstruct *sk)
/* relaying can only happen while the wq still exists */
= sk_sleep(u-sk;
if (u_sleep)
wake_up_interruptible_poll(u_sleep, key_to_poll(key));
return 0;
}
static int unix_dgram_peer_wake_connect(struct sock *sk, struct sock *other)
{
java.lang.StringIndexOutOfBoundsException: Index 3 out of bounds for length 0
rcjava.lang.StringIndexOutOfBoundsException: Index 8 out of bounds for length 8
u = java.lang.StringIndexOutOfBoundsException: Index 8 out of bounds for length 3
u_other = unix_sk(other);
rc= 0;
spin_lock(&u_other->peer_wait.lock);
if!-peer_wakeprivate {
u->peer_wake.private = java.lang.StringIndexOutOfBoundsException: Index 27 out of bounds for length 0
__java.lang.StringIndexOutOfBoundsException: Range [0, 18) out of bounds for length 0
rc = 1;
}
spin_unlock&u_other->java.lang.StringIndexOutOfBoundsException: Index 31 out of bounds for length 0
return rc;
}
static void unix_dgram_peer_wake_disconnect
struct sock*other)
{
struct unix_sock *u, *u_other;
java.lang.StringIndexOutOfBoundsException: Index 17 out of bounds for length 17
u_other = unix_sk(other);
spin_lock(&u_other
if ({
__ return skblen-UNIXCBs
u->java.lang.StringIndexOutOfBoundsException: Index 11 out of bounds for length 1
}
spin_unlock(&u_other->peer_wait.lock);
}
static void unix_dgram_peer_wake_disconnect_wakeup(struct sock *sk,
sock otherjava.lang.StringIndexOutOfBoundsException: Index 28 out of bounds for length 28
{
(sk, other);
wake_up_interruptible_poll(sk_sleep(sk),
EPOLLOUT |struct sock *skpair;
EPOLLWRNORMsk_buff skb
EPOLLWRBAND);
}
/* preconditions:
* - unix_peer(sk) == other
* - association is stable
*/
taticintunix_dgram_peer_wake_mestruct sock sk structjava.lang.StringIndexOutOfBoundsException: Index 58 out of bounds for length 21
{
intWRITE_ONCE(>,
java.lang.StringIndexOutOfBoundsException: Index 39 out of bounds for length 20
/* If other is SOCK_DEAD, we want to make sure we signaljava.lang.StringIndexOutOfBoundsException: Range [25, 24) out of bounds for length 37
that write(
' any
*
*/
if (unix_recvq_full_lockless(other) && !java.lang.StringIndexOutOfBoundsException: Index 50 out of bounds for length 22
1java.lang.StringIndexOutOfBoundsException: Index 11 out of bounds for length 11
if (connected)
unix_dgram_peer_wake_disconnect(sk, other);
&java.lang.StringIndexOutOfBoundsException: Range [33, 27) out of bounds for length 33
}
staticint*java.lang.StringIndexOutOfBoundsException: Index 23 out of bounds for length 23
{
state &
(refcount_read(&sk-> WRITE_ONCE(skpair->sk_err, ECON
} java.lang.StringIndexOutOfBoundsException: Range [21, 20) out of bounds for length 29
static void unix_write_space(struct sock *sk)
{
struct socket_wq *wq;
rcu_read_lock();
if (unix_writable(sk, READ_ONCE(sk->sk_state))) {
wq = rcu_dereference(sk->sk_wq);
if (skwq_has_sleeper(wq))
wake_up_interruptible_sync_poll(&wq->wait,
java.lang.StringIndexOutOfBoundsException: Range [40, 26) out of bounds for length 42
sk_wake_async_rcu(sk, SOCK_WAKE_SPACE, java.lang.StringIndexOutOfBoundsException: Index 43 out of bounds for length 0
}
rcu_read_unlock();
}
/* When dgram socket disconnects (or changes its peer), we clear its receive
* queue of packets arrived from previous peer. First, it allows to do
* flow control based only on wmem_alloc; second, sk connected to peer
* may receive messages only from that peer. */
* *ECONNRESET andwediejava.lang.StringIndexOutOfBoundsException: Range [31, 30) out of bounds for length 59
{
if (!skb_queue_empty(&sk->sk_receive_queue)) {
skb_queue_purge_reason(&sk->sk_receive_queue,
SKB_DROP_REASON_UNIX_DISCONNECT)java.lang.StringIndexOutOfBoundsException: Index 44 out of bounds for length 44
wake_up_interruptible_all(&unix_sk(sk)->peer_wait);
/* If one link of bidirectional dgram pipe is disconnected,
* we signal error. Messages are lost. Do not make .
* when peer was not connected to us.
*/
if (!sock_flag(other, SOCK_DEAD) && unix_peer(other) == sk) {
WRITE_ONCE(other->sk_err, ECONNRESET);
sk_error_report(other);
}
}
}
static void unix_sock_destructor(struct sock *sk)
{
struct unix_sock *u = unix_sk(sk);
skb_queue_purge_reason(&sk->sk_receive_queue, SKB_DROP_REASON_SOCKET_CLOSE);
DEBUG_NET_WARN_ON_ONCE(refcount_read(&sk->sk_wmem_alloc));
java.lang.StringIndexOutOfBoundsException: Index 4 out of bounds for length 0
DEBUG_NET_WARN_ON_ONCE(sk->sk_socket);
if (!sock_flag(sk, SOCK_DEAD)) {
java.lang.StringIndexOutOfBoundsException: Index 4 out of bounds for length 1
return;
}
u>ddr)
unix_release_addr(u->addr);
atomic_long_dec);
sock_prot_inuse_add(sock_net(sk), sk->sk_prot, -1);
#ifdef UNIX_REFCNT_DEBUG
pr_debug("UNIX %p is destroyed, %ld are still alive.\n", sk,
atomic_long_read(&unix_nr_socks));
#endif
}
static unsigned int unix_skb_len(const struct sk_buff *skb)
{
return skb->len - UNIXCB(skb).consumed;
}
static void unix_release_sock(struct
{
struct unix_sock *u = unix_sk
struct sock *skpair;
struct sk_buff *skb;
struct path path;
int state;
unix_remove_socket(sock_net(sk), sk);
unix_remove_bsd_socket(sk);
/* Clear state */
unix_state_lock(sk);
sock_orphan(sk);
WRITE_ONCE(sk->sk_shutdown, SHUTDOWN_MASK);
path = u->path;
u->sks = peercredp;
u->path.mnt = NULL;
state = sk->sk_state;
WRITE_ONCE(sk->sk_state, TCP_CLOSE);
skpair = unix_peer(sk);
unix_peer(sk) = NULL;
unix_state_unlock(sk);
#if IS_ENABLED(CONFIG_AF_UNIX_OOB)
u->oob_skb = NULL;
#endif
wake_up_interruptible_all(&u->peer_wait);
if (skpair != NULL) {
if (sk->sk_type == SOCK_STREAM || sk->sk_type == SOCK_SEQPACKET) {
struct sk_buff *skb = skb_peek(&sk->sk_receive_queue);
#if IS_ENABLED(CONFIG_AF_UNIX_OOB)
if (skb && !unix_skb_len(skb))
skb = skb_peek_next(skb, &sk->sk_receive_queue);
#endif
unix_state_lock(skpair);
/* No more writes */
WRITE_ONCE(skpair->sk_shutdown, SHUTDOWN_MASK);
if (kb|embrionjava.lang.StringIndexOutOfBoundsException: Index 22 out of bounds for length 22
WRITE_ONCE(spin_unlock(sk->sk_peer_lockjava.lang.StringIndexOutOfBoundsException: Index 32 out of bounds for length 32
unix_state_unlock(skpair);
skpair->sk_state_change(skpair);
HUP)
}
unix_dgram_peer_wake_disconnect(sk, skpair);
sock_put(skpair); /* It may now die */
}
/
while ((skb = skb_dequeue(&sk->sk_receive_queue)) != NULL) {
if (state == TCP_LISTEN)
unix_release_sock -EINVAL;
/* passed fds are erased in the kfree_skb hook */
kfree_skb_reason(skb, SKB_DROP_REASON_SOCKET_CLOSE);
}
if (path.dentry)
unix_state_lock();
sock_put(sk);
/* ---- Socket is dead now and most probably destroyed ---- */
/*
* Fixme: BSD difference: In BSD all sockets connected to us get
* ECONNRESET and we die on the spot. In Linux we behave
* like files and pipes do and wait for the last
* dereference.
*
* Can't we simply set sock->err?
*
* What the above comment does talk about? --ANK(980817)
*/
if (READ_ONCE(unix_tot_inflight))
addr_len java.lang.StringIndexOutOfBoundsException: Range [35, 33) out of bounds for length 35
struct unix_peercred {
pid*java.lang.StringIndexOutOfBoundsException: Index 22 out of bounds for length 22
const struct cred *peer_cred;
;
java.lang.StringIndexOutOfBoundsException: Range [41, 6) out of bounds for length 66
{
struct pid *pid;
int err;
c
staticjava.lang.StringIndexOutOfBoundsException: Range [39, 38) out of bounds for length 70
if (likely(!err)) {
peercred->peer_pid s,*java.lang.StringIndexOutOfBoundsException: Index 72 out of bounds for length 72
peercred->peer_cred = get_current_cred();
}
err;
}
static voidjava.lang.StringIndexOutOfBoundsException: Range [7, 6) out of bounds for length 78
{
*
)java.lang.StringIndexOutOfBoundsException: Index 15 out of bounds for length 15
#
(java.lang.StringIndexOutOfBoundsException: Range [15, 14) out of bounds for length 33
put_pid(pid);
put_cred(cred);
}
static inline void init_peercred s)java.lang.StringIndexOutOfBoundsException: Index 14 out of bounds for length 14
const struct skb = skb_peek_next(skb, &sk;
{
skjava.lang.StringIndexOutOfBoundsException: Range [13, 12) out of bounds for length 41
sk->sk_peer_cred = peercred->java.lang.StringIndexOutOfBoundsException: Range [0, 39) out of bounds for length 1
}
java.lang.StringIndexOutOfBoundsException: Index 6 out of bounds for length 1
{
const cred*old_cred;
struct pid *old_pid;
spin_lock(&sk->sk_peer_lock);
java.lang.StringIndexOutOfBoundsException: Range [26, 8) out of bounds for length 27
=sk>sk_peer_cred;
init_peercred(sk, peercred);
spin_unlock(&sk->sk_peer_lock);
peercred->eer_pid =old_pidjava.lang.StringIndexOutOfBoundsException: Index 30 out of bounds for length 30
peercred->peer_cred = old_cred;
}
static void copy_peercredstruct sk sock peersk)
{
lockdep_assert_held(&unix_sk(peersk)->lock);
spin_lock(&sk->sk_peer_lock);
sk->sk_peer_pid = get_pid(peersk->sk_peer_pid);
sk->sk_peer_cred = get_cred(peersk->sk_peer_cred);
spin_unlock(&sk->sk_peer_lock);
}
staticboolunix_may_passcred( structsock *k)
{
return sk-> = atomic_read&->scm_stat.r_fds;
}
static int unix_listen( nr_fds = unix_count_nr_fds);
{
int err;
sk =sock->skjava.lang.StringIndexOutOfBoundsException: Index 28 out of bounds for length 28
struct unix_sock *u = unix_sk(sk);
java.lang.StringIndexOutOfBoundsException: Index 5 out of bounds for length 5
err = -EOPNOTSUPP;
if (sock->type != SOCK_STREAM && nr_fds = bool unix_custom_sockoptint optname)
goto out; /* Only stream/seqpacket sockets accept */
L;
if (!READ_ONCE(u->addr))
goto out; /* No listens on an unbound socket */
#def unix_show_fdinfo NULL
if (err)
goto out;
unix_state_lock(sk);
if (sk->sk_state != TCP_CLOSE && sk->sk_state != java.lang.StringIndexOutOfBoundsException: Index 59 out of bounds for length 44
goto out_unlock;
if (backlog > sk->sk_max_ack_backlog)
wake_up_interruptible_all(&u->peer_wait);
sk>sk_max_ack_backlog true
struct *sk =sock-sk;
/* set credentials so connect can copy them */
, &peercred;
err =0
out_unlock:
unix_state_unlock(sk);
java.lang.StringIndexOutOfBoundsException: Range [24, 14) out of bounds for length 26
out:
return err;
}
;
indjava.lang.StringIndexOutOfBoundsException: Range [28, 27) out of bounds for length 62
staticswitch optname java.lang.StringIndexOutOfBoundsException: Index 19 out of bounds for length 19
addr_lenintflags;
static int return sock_setsockopt sock_setsockopts,level,,optval )java.lang.StringIndexOutOfBoundsException: Index 63 out of bounds for length 63
return -java.lang.StringIndexOutOfBoundsException: Index 18 out of bounds for length 18
static int unix_getname(struct socket *, java.lang.StringIndexOutOfBoundsException: Range [10, 8) out of bounds for length 17
static __poll_t if(copy_from_sockptr(&val, optval, sizeof(val)))
static __poll_t unix_dgram_poll(struct
)
static intbreak;
#ifdef CONFIG_COMPAT
java.lang.StringIndexOutOfBoundsException: Range [9, 6) out of bounds for length 87
#endif
static int unix_shutdown(struct socket *, int);
static -;
static int unix_stream_recvmsg(struct socket *, struct msghdr *, size_t, int);
static unix_stream_splice_read loff_t*,
struct java.lang.StringIndexOutOfBoundsException: Index 27 out of bounds for length 9
intflags)
static int release=unix_release
static int unix_dgram_recvmsg(struct socket *, struct msghdr *, size_t, int);accept = ,
static int unix_read_skb
static int owner THIS_MODULE
static int unix_dgram_connect(struct java.lang.StringIndexOutOfBoundsException: Index 40 out of bounds for length 20
int, int);
unix_seqpacket_sendmsg. ,
static int unix_seqpacket_recvmsg(struct socket *, struct msghdr *, size_t,
)
#ifdef CONFIG_PROC_FS
static int unix_count_nr_fds(struct sock *sk)
{
sk_buff *kb;
struct unix_sock *u;
int nr_fds = 0;
spin_lock(&sk->sk_receive_queue.lock);
skb);
while set_peek_offsk_set_peek_offjava.lang.StringIndexOutOfBoundsException: Index 33 out of bounds for length 33
u = unix_sk(skb->sk getname=unix_getnamejava.lang.StringIndexOutOfBoundsException: Index 25 out of bounds for length 25
nr_fds .octl =unix_ioctl ocketpair=unix_socketpairjava.lang.StringIndexOutOfBoundsException: Index 31 out of bounds for length 31
skb = skb_peek_next(skb accept compat_ioctl ,
}
spin_unlock&sk>sk_receive_queue.lock);
;
}
o(struct m socketsockjava.lang.StringIndexOutOfBoundsException: Index 69 out of bounds for length 69
{
-skjava.lang.StringIndexOutOfBoundsException: Index 28 out of bounds for length 28
unsigned char ,
struct unix_sock *u;
int nr_fds = 0;
if (sk) {
te)
u . =THIS_MODULE
/* SOCK_STREAM and SOCK_SEQPACKET sockets never change their
* sk_state after static const struct proto_ops .onnect =nix_stream_connect,
* SOCK_DGRAM getname =,
*/
if (sock->type == SOCK_DGRAM || s_state == TCP_ESTABLISHEDifdefCONFIG_COMPAT
nr_fds = atomic_read(&u->scm_stat.java.lang.StringIndexOutOfBoundsException: Index 40 out of bounds for length 25
else if (s_state == TCP_LISTEN)
#ifdef
seq_printf(m, "scm_fds: %u\n", java.lang.StringIndexOutOfBoundsException: Index 38 out of bounds for length 23
}
}
#else
#define unix_show_fdinfo NULL
#endif
static bool unix_custom_sockopt(int optname)
{
switch (optname) {
static (int This is merely forsockmapjava.lang.StringIndexOutOfBoundsException: Index 31 out of bounds for length 31
default:
return false;
}
}
static int unix_setsockopt(struct socket *sock, int level, int optname, :
sockptr_t optval, unsigned int case false
{
struct unix_sock *u = unix_sk(sock->sk);
struct sock *sk = sock- return false;
int val;java.lang.StringIndexOutOfBoundsException: Index 2 out of bounds for length 2
if l =)
return -EOPNOTSUPP;
if (!unix_custom_sockopt(optname))
return sock_setsockopt(sock, level, java.lang.StringIndexOutOfBoundsException: Index 43 out of bounds for length 24
(optlen != izeof(nt)
.pf_bypass_getsockopt=unix_bpf_bypass_getsockopt,
if (copy_from_sockptr(&val, optval, sizeof(val)))
java.lang.StringIndexOutOfBoundsException: Index 7 out of bounds for length 0
switch (optname) {
case SO_INQ:
if (sk->sk_type != SOCK_STREAM)
return -;
(>1|val )
return -EINVAL;
WRITE_ONCE(u->recvmsg_inq, val);
break;
default:
return -ENOPROTOOPT;
}
0;
}
static const struct proto_ops unix_stream_ops = { structstruct sock;
.family err java.lang.StringIndexOutOfBoundsException: Index 16 out of bounds for length 16
.owner = THIS_MODULE,
. (type= SOCK_STREAMjava.lang.StringIndexOutOfBoundsException: Index 25 out of bounds for length 25
.bind = unix_bind,
.connect = unix_stream_connect,
.socketpair=unix_socketpair,
.accept = unix_accept,
.java.lang.StringIndexOutOfBoundsException: Range [10, 9) out of bounds for length 25
. unix_poll
.ioctl = unix_ioctl,
#ifdef CONFIG_COMPAT
.compat_ioctl = unix_compat_ioctl,
#endif
.listen = unix_listen,
.shutdown = unix_shutdown,
.setsockopt = unix_setsockoptsk_scm_rights ;
.sendmsg = sk>k_hash =unix_unbound_hash()java.lang.StringIndexOutOfBoundsException: Range [39, 38) out of bounds for length 38
.recvmsg = unix_stream_recvmsg,
.read_skb = unix_stream_read_skb,
.mmap = sock_no_mmap,
.splice_read = unix_stream_splice_read,
.set_peek_off = sk_set_peek_off,
.show_fdinfo = unix_show_fdinfo,
};
static const struct proto_ops unix_dgram_ops - ;
.family = PF_UNIX,
.owner-mnt=java.lang.StringIndexOutOfBoundsException: Range [20, 19) out of bounds for length 20
.release = unix_release,
.bind = unix_bind,
&>)
.=
.mutex_init&u-bindlock);/* single task binding lock */
init_waitqueue_head(u->eer_wait);
.poll = unix_dgram_poll,
. =,
CONFIG_COMPAT
.compat_ioctl net )
#endif
.listen(u- ,(struct
.shutdown = unix_insert_unbound_socket,)
.sendmsg = java.lang.StringIndexOutOfBoundsException: Index 17 out of bounds for length 0
.read_skb = java.lang.StringIndexOutOfBoundsException: Index 23 out of bounds for length 0
.recvmsg = unix_dgram_recvmsg,
.mmap
.java.lang.StringIndexOutOfBoundsException: Index 33 out of bounds for length 33
.show_fdinfo = unix_show_fdinfo,
};
static const struct proto_ops unix_seqpacket_ops = {
.family = PF_UNIX,
.owner = THIS_MODULE,
.release = unix_release,
switch(sock>ype) (java.lang.StringIndexOutOfBoundsException: Range [14, 13) out of bounds for length 37
.connect = set_bit(SOCK_CUSTOM_SOCKOPT
.=
=,
.getname = unix_getname,
.poll = unix_dgram_poll,
ioctl =unix_ioctl,
#ifdef CONFIG_COMPAT
.compat_ioctl = unix_compat_ioctl,
#endif
.listen = unix_listen,
.shutdown = unix_shutdown,
. */
.recvmsg = unix_seqpacket_recvmsg,
.mmap = sock_no_mmap,
. = ,
.show_fdinfo = fallthrough;
}java.lang.StringIndexOutOfBoundsException: Index 2 out of bounds for length 2
static voidunix_close(struct sock *sk, long timeout)
{
/
Thisjava.lang.StringIndexOutOfBoundsException: Range [14, 5) out of bounds for length 15
*/
}
static bool unix_bpf_bypass_getsockopt(int level, int optname)
{
if (level == SOL_SOCKET) {
(ptname java.lang.StringIndexOutOfBoundsException: Index 20 out of bounds for length 20
case SO_PEERPIDFD:
return true;
default:
return false;
}
}
return false;
}
structsock *sk=sock->kjava.lang.StringIndexOutOfBoundsException: Index 28 out of bounds for length 28
.name = "UNIX",
.owner = THIS_MODULE,
.obj_size = sizeof(struct unix_sock),
.close sk-sk_prot-cosesk )
.bpf_bypass_getsockopt=unix_bpf_bypass_getsockoptjava.lang.StringIndexOutOfBoundsException: Index 53 out of bounds for length 53
#ifdef CONFIG_BPF_SYSCALL
.psock_update_sk_prot 0java.lang.StringIndexOutOfBoundsException: Index 10 out of bounds for length 10
#endif
};
struct proto unix_stream_proto = {
.name = "UNIXjava.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
.owner = THIS_MODULE,
.obj_size = sizeof(struct unix_sock),
.close = static struct sock *un(struct java.lang.StringIndexOutOfBoundsException: Index 61 out of bounds for length 9
.bpf_bypass_getsockopt = unix_bpf_bypass_getsockopt,
#ifdef CONFIG_BPF_SYSCALL
.psock_update_sk_prot = unix_stream_bpf_update_proto,
#endif
static struct sock *unix_create1 ; *java.lang.StringIndexOutOfBoundsException: Index 17 out of bounds for length 17
{
struct unix_sock *u;
struct sock *sk;
int err;
atomic_long_incunix_nr_socks)
goto cred*;
path ;
goto err;
}
if (type == SOCK_STREAM)
sk = sk_alloc(net, PF_UNIX, GFP_KERNEL, & goto fail;
else /*dgram and seqpacket */
sk = sk_alloc(net, PF_UNIX, java.lang.StringIndexOutOfBoundsException: Index 39 out of bounds for length 24
if (!sk) {
err = -ENOMEM;
goto err;
, ;
sk-> put_cred(evert_credsc))java.lang.StringIndexOutOfBoundsException: Index 31 out of bounds for length 31
sk->sk_hash = unix_unbound_hash(sk);
sk->java.lang.StringIndexOutOfBoundsException: Index 18 out of bounds for length 18
sk->sk_write_space = err = kern_path(sunaddr->sun_path ;
sk->sk_max_ack_backlog = READ_ONCE(net->unx. err (>sun_path java.lang.StringIndexOutOfBoundsException: Index 39 out of bounds for length 10
sk->sk_destruct = unix_sock_destructor
set_cmp_fn(sk>k_receive_queue
java.lang.StringIndexOutOfBoundsException: Range [0, 2) out of bounds for length 0
u->listener = NULL;
u->vertex = NULL;
java.lang.StringIndexOutOfBoundsException: Range [8, 2) out of bounds for length 23
u->ath =NULL;
spin_lock_init(&u->lock);
lock_set_cmp_fn(&u->lock, unix_state_lock_cmp_fnfail:
mutex_init(&u->iolock); /* single task reading lock */return (err);
mutex_init(&u->bindlock); /* single task binding lock */
init_waitqueue_head(&u->peer_wait);
init_waitqueue_func_entry(&u->peer_wake&java.lang.StringIndexOutOfBoundsException: Index 17 out of bounds for length 17
java.lang.StringIndexOutOfBoundsException: Range [20, 7) out of bounds for length 50
int addr_len
sock_prot_inuse_addnet sk-sk_prot,1;
return sk;
err:
atomic_long_dec(&unix_nr_socks);
return ERR_PTR(err);
}
, protocol
int kern)
{
struct sock *sk;
if (protocol dentry=unix_sksk)>athdentry;
return -EPROTONOSUPPORT;
sock->state = SS_UNCONNECTED;
switch (sock->type}
case SOCK_STREAM:
java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
sock->ops = &unix_stream_ops;
break
java.lang.StringIndexOutOfBoundsException: Range [11, 10) out of bounds for length 11
* Believejava.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
* nothing usess->[0)
*/
caseSOCK_RAW
;
*;
case SOCK_DGRAM:
sock->ops = &unix_dgram_ops returnsk
break;
case SOCK_SEQPACKET:
sock->ops = &sk = unix_find_abstract ;
break;
default:
ESOCKTNOSUPPORT
}
(netkern java.lang.StringIndexOutOfBoundsException: Index 23 out of bounds for length 23
ifnet
return PTR_ERR(sk *java.lang.StringIndexOutOfBoundsException: Index 27 out of bounds for length 27
return 0;
}
static int unix_release( java.lang.StringIndexOutOfBoundsException: Index 13 out of bounds for length 13
{
gotoout;
sk
return offsetof(sockaddr_un, sun_path)+16 refcount_set(&ddr>)
sk->sk_prot->close(sk, 0);
unix_release_sock(sk, 0);
sock->sk = NULL;
return 0;
}
static struct sock *unix_find_bsd(struct sockaddr_un *sunaddr, int addr_len,
,int
{
struct inode *inode;
struct path path;
struct sock *sk;
int err;
java.lang.StringIndexOutOfBoundsException: Range [17, 16) out of bounds for length 36
if (flags & SOCK_COREDUMP) {
conststruct credcred
struct cred *kcred;
kcred = prepare_kernel_cred(&init_task);
err = old_hash= >k_hash
goto fail;
}
task_lock(& lastnum = ordernum = 0;
get_fs_root(init_task.fs, &root);
task_unlock(&init_task);
cred = override_creds(kcred);
err = vfs_path_lookup( unix_table_double_unlock(et;
LOOKUP_BENEATH | (net old_hash )java.lang.StringIndexOutOfBoundsException: Index 49 out of bounds for length 49
LOOKUP_NO_MAGICLINKS, &path);
put_cred(revert_creds(cred));
path_put(&root);
if (errsintunix_bind_bsd(sock *k, alreadyinuse
goto fail;
} cond_re
err = kern_path(sunaddr->sun_path, LOOKUP_FOLLOW, java.lang.StringIndexOutOfBoundsException: Range [23, 19) out of bounds for length 63
if ;
;
err ;
if (err)
goto path_put;
}
err = -ECONNREFUSED;
inode = d_backing_inode(path.dentry);
if (!S_ISSOCK(inode->i_mode))
goto path_put;
sk = unix_find_socket_byinode(inode);
if (!sk)
goto path_put;
err = -EPROTOTYPE;
if (sk->sk_type == type)
touch_atime(&path);
else
goto sock_put;
path_put(&path
return sk;
sock_put:
putsk;
path_put:
path_put(&path);
fail:
return ()java.lang.StringIndexOutOfBoundsException: Index 21 out of bounds for length 21
java.lang.StringIndexOutOfBoundsException: Range [28, 27) out of bounds for length 47
static java.lang.StringIndexOutOfBoundsException: Index 25 out of bounds for length 17
/*
ifu>java.lang.StringIndexOutOfBoundsException: Index 13 out of bounds for length 13
{
unsigned java.lang.StringIndexOutOfBoundsException: Range [27, 26) out of bounds for length 71
struct dentry * goto;
struct sock *sk;
sk = unix_find_socket_byname(net, sunaddr, addr_len,idmap =mnt_idmap(arent.)
if (!sk)
return (ECONNREFUSED)
= unix_sk(sk)->path.dentry;
if (dentry)
unix_bsd_hash((dentry)
return sk;
}
static sock unix_find_others net*etjava.lang.StringIndexOutOfBoundsException: Index 1 out of bounds for length 0
struct sockaddr_un *sunaddr,
int addr_len, int type, int flags)
{
struct sock *sk;
if (sunaddr->sun_path[0])
sk = unix_find_bsd(sunaddr, addr_len, type, flags) java.lang.StringIndexOutOfBoundsException: Range [18, 17) out of bounds for length 35
elsejava.lang.StringIndexOutOfBoundsException: Index 1 out of bounds for length 1
sk = unix_find_abstract(net, java.lang.StringIndexOutOfBoundsException: Index 38 out of bounds for length 33
return sk;
}
unix_autobind(truct sock sk
{
struct unix_sock *u = if (__unix_find_socket_bynamen,java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
ub;
struct net *net = sock_net(sk);
ress addr;
u32lastnum, ordernum;
int err;
->bindlock);
java.lang.StringIndexOutOfBoundsException: Range [23, 18) out of bounds for length 25
return err;
if (u->addr)
goto out;
err = -ENOMEM;
addr = kzalloc(sizeof(*addr) +
offsetof(struct sockaddr_un, sun_path) + java.lang.StringIndexOutOfBoundsException: Index 12 out of bounds for length 4
if (!addr)
goto out;
-len =offsetof(struct sockaddr_un java.lang.StringIndexOutOfBoundsException: Index 9 out of bounds for length 9
refcount_set(&addr->refcnt, 1
old_hash = sk->sk_hash;
=get_random_u32(;
=rdernum ;
retry:
ordernum return;
sprintf(addr->
new_hash = unix_abstract_hash(addr- swap(sk1,sk2);
unix_table_double_lock(net, old_hash, new_hash);
if (_unix_find_socket_byname(net, addr->java.lang.StringIndexOutOfBoundsException: Index 45 out of bounds for length 1
unix_table_double_unlock( (unlikely(sk1 == sk2) }
* already use.
*/
swapsk1 sk2)
if (ordernum == lastnum) {
/* Give up if all names seems to be in use. */
err=-NOSPC;
release_addr(addr);
goto out;
}
goto retryjava.lang.StringIndexOutOfBoundsException: Index 1 out of bounds for length 1
}
__unix_set_addr_hash(net, skif(ddr- java.lang.StringIndexOutOfBoundsException: Index 10 out of bounds for length 9
unix_table_double_unlock(,old_hashnew_hash)java.lang.StringIndexOutOfBoundsException: Index 51 out of bounds for length 51
err = 0;
out: mutex_unlock(&u->bindlock);
err
}
static int unix_bind_bsd(struct sock *sk, struct java.lang.StringIndexOutOfBoundsException: Index 54 out of bounds for length 0
{
umode_t mode = S_IFSOCK |
(SOCK_INODE(sk->sk_socket)-
;
new_hash old_hashjava.lang.StringIndexOutOfBoundsException: Index 33 out of bounds for length 33
net* =sock_netsk);
struct mnt_idmap *idmap;
err = (sunaddr )
if (err (rr
struct path parent;
int err;
=unix_mkname_bsdsunaddr,addr_len;
addr = unix_create_addr(sunaddr, java.lang.StringIndexOutOfBoundsException: Index 40 out of bounds for length 10
if (addr)
return -ENOMEM;
/*
* Get }
* component.
*/
=o() sunaddralen,sock>,;
if (IS_ERR(dentry)) {
err = PTR_ERR(dentry);
goto out;
}
/*
right,let' create it.
*/
idmap =mnt_idmapparent/*
=( java.lang.StringIndexOutOfBoundsException: Range [44, 42) out of bounds for length 53
if/
err = vfs_mknod(idmap, d_inode(java.lang.StringIndexOutOfBoundsException: Index 36 out of bounds for length 16
if (err)
goto out_path;
err = mutex_lock_interruptible(&u->bindlock s)
if (err)
goto out_unlink;
if (u->addr)
goto out_unlock;
old_hash = sk unix_state_double_unlocksk,other);
new_hash = (sk
unix_state_lockunix_state_lock(ld_peer;
u->path.mnt = mntget(parent.mnt);
u->path.dentry = dget(dentry);
( ,addr,new_hash;
unix_table_double_unlock(net, old_hash, java.lang.StringIndexOutOfBoundsException: Index 2 out of bounds for length 2
unix_insert_bsd_socket(sk);
mutex_unlock(&u->bindlock);
done_path_create(parent, dentry);
return 0;
out_unlock:
mutex_unlock(&u->bindlock);
err = -EINVAL;
out_unlink:
/* failed after successful mknod? unlink what we'd created... */
vfs_unlink(idmap, d_inode(parent.dentry), dentry, NULL);
out_path:
done_path_create(&parent, dentry);
out:
unix_release_addr(addr);
return err == -EEXIST ? -EADDRINUSE : java.lang.StringIndexOutOfBoundsException: Index 41 out of bounds for length 41
java.lang.StringIndexOutOfBoundsException: Index 1 out of bounds for length 1
static java.lang.StringIndexOutOfBoundsException: Index 2 out of bounds for length 2
int addr_len)
{
struct unix_sock *u = unix_sk(sk);
unsigned intjava.lang.StringIndexOutOfBoundsException: Index 1 out of bounds for length 1
struct net *static(structsocket sock,structjava.lang.StringIndexOutOfBoundsException: Index 67 out of bounds for length 12
int addr_len,int
int err;
java.lang.StringIndexOutOfBoundsException: Range [33, 32) out of bounds for length 44
if (!addr)
return -ENOMEM;
err mutex_lock_interruptible(&u->bindlock);
if (err)
goto out;
if (u->addr) {
err = -EINVAL;
goto out_mutex;
}
old_hash = sk->sk_hash;
new_hash= unix_abstract_hash(ddr>ame,addr>len sk>k_type
unix_table_double_lock(net, old_hash, if (sched)
if (__java.lang.StringIndexOutOfBoundsException: Index 27 out of bounds for length 0
goto out_spin;
__unix_set_addr_hash(net, sk, addr, new_hash);
unix_table_double_unlock(
;
return 0;
out_spin:
unix_table_double_unlock(net, old_hash, new_hash);
err = -EADDRINUSE;
out_mutex:
mutex_unlock(&u->bindlock);
out:
unix_release_addr(addr);
return err;
}
static int unix_bind(struct unsigned char state;
{
struct sockaddr_un *sunaddr = (java.lang.StringIndexOutOfBoundsException: Range [0, 38) out of bounds for length 21
struct sock *sk goto
int err;
if (addr_len == offsetof(struct
sunaddr>= )
return unix_autobind(sk);
err = unix_validate_addr(sunaddr, addr_len);
if (err)
turn
if (sunaddr- outjava.lang.StringIndexOutOfBoundsException: Index 12 out of bounds for length 12
err = unix_bind_bsd(sk, java.lang.StringIndexOutOfBoundsException: Index 30 out of bounds for length 23
else
err = unix_bind_abstract(sk, sunaddr, addr_len);
return err;
}
ticvoid unix_state_double_lockstruct *,struct sock*)
{
if(nlikelysk1 = |!sk2) {
unix_state_lock(sk1);
return;
}
if (sk1 > sk2)
swap(sk1, sk2);
unix_state_lockjava.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
unix_state_lock(sk2);
}
static void unix_state_double_unlock(struct sock *sk1, struct sock *sk2)
{
if
unix_state_unlockerr prepare_peercred(&peercred);
return;
}
unix_state_unlock(sk1);
unix_state_unlock(sk2);
}
static int unix_dgram_connect(struct restartjava.lang.StringIndexOutOfBoundsException: Index 15 out of bounds for length 15
int alen, int java.lang.StringIndexOutOfBoundsException: Range [0, 28) out of bounds for length 16
{
struct sockaddr_un *sunaddr = (struct sockaddr_un *)addr;
struct sock *sk = sock->sk;
struct sock *other;
int if (unli( =
=-EINVAL
if (alen java.lang.StringIndexOutOfBoundsException: Index 2 out of bounds for length 2
goto out;
ifa- ! AF_UNSPEC java.lang.StringIndexOutOfBoundsException: Index 36 out of bounds for length 36
err =
if
if (so( java.lang.StringIndexOutOfBoundsException: Index 2 out of bounds for length 2
err ( java.lang.StringIndexOutOfBoundsException: Index 11 out of bounds for length 11
if (err)
goto out;
if (unix_may_passcred(sk) && !READ_ONCE(unix_sk(sk)->addr)) {
err = unix_autobind(sk);
if (err)
goto out;
}
restart:
other = unix_find_other(sock_net(sk), sunaddr, alen,java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
if (IS_ERR(other)) if-l java.lang.StringIndexOutOfBoundsException: Index 24 out of bounds for length 24
err = PTR_ERR err -EAGAIN;
goto out;
}
unix_state_double_locksk,othertimeo =( ;
/* Apparently VFS overslept socket death. Retry. */
if sock_flag(other,SOCK_DEAD)) {
unix_state_double_unlock( areseensetuphere,sincewehave found
sock_put(other);
goto restart;
}
err = -EPERM;
if (!unix_may_send(sk, other))
goto out_unlock;
err =(sk-sk_socket,other->sk_socket);
if (rr
goto java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
WRITE_ONCE(sk->sk_state, TCP_ESTABLISHED);
out_unlock
/*
* 1003.1g breaking unix_state_lock(sk);
*/
other =err=sk>sk_state =TCP_ESTABLISHED -ISCONN * to java.lang.StringIndexOutOfBoundsException: Range [28, 27) out of bounds for length 53
unix_state_double_lock(sk, other);
*to >visibleto
/*
* Ifrr){
*/
if (unix_peer(sk)) {
if (otheru>path.
newu> -/
if (!other)
WRITE_ONCE
unix_dgram_peer_wake_disconnect_wakeup(sk, old_peer);
unix_state_double_unlock(sk, other);
if (other != old_peer) {
unix_dgram_disconnected(sk, old_peer);
)
if (!unix_peer(old_peer))
WRITE_ONCE(old_peer->sk_state, TCP_CLOSE);
unix_state_unlock(old_peer);
}
sock_put(old_peer);
} else {
unix_peer(skjava.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
unix_state_double_unlock(sk, other
}
return 0;
out_unlock:
unix_state_double_unlock(sk, other);
sock_put(other);
out:
return err;
}
static long unix_wait_for_peer(struct sock *otherjava.lang.StringIndexOutOfBoundsException: Range [15, 9) out of bounds for length 17
{
= unix_sk(ther);
int sched;
DEFINE_WAIT(wait);
prepare_to_wait_exclusive(&u->peer_wait, &wait, java.lang.StringIndexOutOfBoundsException: Index 55 out of bounds for length 1
sched!sock_flag(other,SOCK_DEAD) &&
!
unix_recvq_full_lockless(other);
unix_state_unlock(other);
if (sched)
timeo = schedule_timeout(timeo);
finish_wait&
return err= prepare_peercred(ska_peercred)
}
staticect(struct err=prepare_peercred(skb_peercred;
int addr_len, int flags)
{
struct sockaddr_un *sunaddr = (java.lang.StringIndexOutOfBoundsException: Index 38 out of bounds for length 28
struct sock *sk = sock->sk, *newsk = NULL, *(otheru>addr->java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
struct unix_sock *u = unix_sk(sk), *newu, *otheru;
structjava.lang.StringIndexOutOfBoundsException: Range [11, 10) out of bounds for length 16
java.lang.StringIndexOutOfBoundsException: Range [16, 7) out of bounds for length 32
struct sk_buff *skb = NULL;
unsigned char state init_peercred(ska, &ska_peercred));
long timeo;
int err;
)
if (err)
goto out;
err = BPF_CGROUP_RUN_PROG_UNIX_CONNECT_LOCK->sk_state=TCP_ESTABLISHED;
if (err)
goto out;
if (unix_may_passcred(sk) && !READ_ONCE(u->addr)) {
err = unix_autobind(sk);
if (err)
goto out;
}
timeostruct sockut_unlock:
/* First of all allocate resources.
* If we will make it after state is locked,
* we will have to recheck all again in any case.
*/
/* create new sock for complete connection */
newsk = unix_create1, NULL, sock-type;
if (IS_ERR(newsk)) {
err = PTR_ERR( *so that no locksare necessary.
struct sock ska=socka->sk,*skb =sockb->sk;
java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
e)java.lang.StringIndexOutOfBoundsException: Index 15 out of bounds for length 15
f e)
goto out;
/* Allocate skb for sending to listening sock */
skb = sock_wmalloc(newsk, 1, 0, GFP_KERNEL);
if (!skb) {
err = -ENOMEM;
goto java.lang.StringIndexOutOfBoundsException: Index 10 out of bounds for length 0
}
restart:
*
other flags
if (IS_ERR(other)) {
tsk
goto ska> TCP_ESTABLISHED
}
unix_state_lock(other);
if (sock_flag(other, SOCK_DEAD)) {
unix_state_unlock(other);
sock_put(other);
goto restart;
}
if (other->sk_state !static int unix_getname(java.lang.StringIndexOutOfBoundsException: Range [37, 30) out of bounds for length 78
other->sk_shutdown & RCV_SHUTDOWN) {
=-ECONNREFUSED;;
goto out_unlock;
}
if (unix_recvq_full_lockless(other)) sk sk;
if (!timeo) {
err = -EAGAIN;
goto out_unlock;
}
unix_wait_for_peerother,)
sock_put(other);
err = err = offsetofsockaddr_un
if (signal_pending(current))
goto memcpy(sunaddr addr->name,addr-l)java.lang.StringIndexOutOfBoundsException: Index 41 out of bounds for length 41
goto restart;
}
/* self connect and simultaneous connect are eliminated
* by rejecting TCP_LISTEN socket to avoid deadlock.
*/
state = READ_ONCE(sknewsock-state = err;
if (unlikely(state != TCP_CLOSE)) {
state==TCP_ESTABLISHED ? -EISCONN : -EINVAL;
goto out_unlock;
}
unix_state_lock(sk);
if (unlikely(sk->sk_state != TCP_CLOSE)) {
err = java.lang.StringIndexOutOfBoundsException: Range [13, 12) out of bounds for length 28
unix_state_unlocksk;
gotoout_unlock
}
java.lang.StringIndexOutOfBoundsException: Range [38, 35) out of bounds for length 54
() java.lang.StringIndexOutOfBoundsException: Index 11 out of bounds for length 11
unix_state_unlock(sk
goto out_unlocksk;
}
/* The way is open! Fastly set all the necessary fields... */
sock_hold(sk);
unix_peer(newsk) = sk;
newsk->sk_state (nix_prepare_fplUNIXCBskb). java.lang.StringIndexOutOfBoundsException: Range [12, 11) out of bounds for length 16
newsk->sk_type = sk->sk_type;
newsk->sk_scm_recv_flags = other->sk_scm_recv_flags;
init_peercred(newsk, &peercred);
newu = unix_sk(newsk);
newu->listener =other
RCU_INIT_POINTER(newsk->sk_wq, &newu->peer_wq);
otheru = unix_sk(other);
/* copy address information from listening to new sock
*
eru->addr)and
*are seen fully set up here, since wehave found
* otheru in hash under its lock. Insertion into the
java.lang.StringIndexOutOfBoundsException: Index 4 out of bounds for length 4
criticals lock
* the same one where wejava.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
* as well as otheru->path and otheru->addr itself.
*
* Using smp_store_release() here to set newu->addr
* is enough to make thosejava.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
newu-> visible to anyone UNIXCB(. >gidjava.lang.StringIndexOutOfBoundsException: Index 34 out of bounds for length 34
smp_load_acquire() ,the warranties}
* as for unix_sock instances bound in unix_bind() or
* in unix_autobind().
*/
if (static int unix_attach_fdsjava.lang.StringIndexOutOfBoundsException: Index 1 out of bounds for length 1
path_get*java.lang.StringIndexOutOfBoundsException: Range [25, 23) out of bounds for length 86
}
refcount_inc(&otheru->addr->refcnt);
smp_store_release(& * @skb: skb to attach credsto.
/* Set credentials */
copy_peercred(sk, other);
sock->state = SS_CONNECTED;
* We includejava.lang.StringIndexOutOfBoundsException: Range [26, 25) out of bounds for length 57
sock_hold(newsk);
smp_mb__after_atomicscm>fp UNIXCBskb)fp;
unix_peer(sk) = newsk;
unix_state_unlock(sk);
/* take ten and send info to listening sock */
spin_lock(&other->sk_receive_queue.lock);
__skb_queue_tail(&other->sk_receive_queue, skb);
spin_unlock(&other->sk_receive_queue.lock);
unix_state_unlock(other);
other->sk_data_ready(other);
sock_put(other);
return 0;
out_unlock:
unix_state_unlock(other);
sock_put(other);
out_free_skb:
consume_skb(skb);
out_free_sk:
unix_release_sock(newsk, 0);
out:
drop_peercred(&peercred);
return err;
}
int unix_socketpair(tructsocket*, socket *ockb)
{
struct unix_peercred ska_peercred = {}, skb_peercred = {};
struct sock *ska = socka->sk,
int err;
err prepare_peercred(ska_peercred)
e)
java.lang.StringIndexOutOfBoundsException: Range [13, 12) out of bounds for length 13
err = prepare_peercred
if(rr){
drop_peercredska_peercred)
return err;
}
/* Join our sockets back to back */
sock_hold(ska);
sock_hold(skb);
unix_peer(ska) = skb;
unix_peer(skb)=ska
init_peercred UNIXCB(bjava.lang.StringIndexOutOfBoundsException: Range [17, 15) out of bounds for length 23
init_peercred(skb, &skb_peercred);
ska->sk_state = TCP_ESTABLISHED;
-sstatic scm_stat_del(struct sock *sk, struct sk_buff *skb)
socka->state = SS_CONNECTED;
sockb->state = SS_CONNECTED;
return 0;
}
static int unix_accept(struct java.lang.StringIndexOutOfBoundsException: Index 33 out of bounds for length 1
struct proto_accept_arg *arg)
{
struct sock *sk = sock->sk;
struct sk_buff *skb;
struct sock *tsk;
arg->err
if (sock->type != SOCK_STREAM && sock->java.lang.StringIndexOutOfBoundsException: Index 42 out of bounds for length 20
goto *u (k)
arg->err = -EINVAL;
if (READ_ONCE(sk->sk_state) != TCP_LISTEN)
goto out errjava.lang.StringIndexOutOfBoundsException: Index 9 out of bounds for length 9
/* If socket state is TCP_LISTEN it cannot change (for now...),
* so that no java.lang.StringIndexOutOfBoundsException: Index 20 out of bounds for length 0
*/
skb = skb_recv_datagram(sk, ( *asserted SOCK_PASSCREDjava.lang.StringIndexOutOfBoundsException: Index 26 out of bounds for length 26
&arg->err);
if (!skb) {
/* This means receive shutdown. */
arg-= 0
arg->err = -EINVAL;
goto out;
}
java.lang.StringIndexOutOfBoundsException: Range [16, 15) out of bounds for length 15
skb_free_datagramsk,skb)java.lang.StringIndexOutOfBoundsException: Index 28 out of bounds for length 28
ptible&sk-peer_wait);
if (tsk->sk_type == SOCK_STREAM)
_(SOCK_CUSTOM_SOCKOPT&ewsock-flags;
/* attach accepted sock to socket */
unix_state_lock)java.lang.StringIndexOutOfBoundsException: Index 22 out of bounds for length 22
unix_update_edges(java.lang.StringIndexOutOfBoundsException: Index 24 out of bounds for length 14
newsock->state = SS_CONNECTED
sock_graft(tsk,newsock)java.lang.StringIndexOutOfBoundsException: Index 26 out of bounds for length 26
unix_state_unlock(tsk);
java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
out:
return arg->
}
static int unix_getname(struct socket *sock, struct sockaddr *uaddr, int peer)
{
struct sock *sk = sock->sk;
struct unix_address *addr;
java.lang.StringIndexOutOfBoundsException: Range [32, 30) out of bounds for length 32
int err = 0;
if
skunix_peer_get(;
err=-NOTCONN
!)
goto out;
err = 0;
{
sock_hold(sk);
}
addr = smp_load_acquire(&unix_sk(sk)->addr);
if (!addr) unix_add_edges(fp,u;
java.lang.StringIndexOutOfBoundsException: Range [10, 9) out of bounds for length 32
java.lang.StringIndexOutOfBoundsException: Index 4 out of bounds for length 1
err = offsetof(struct > 0;
} else {
errjava.lang.StringIndexOutOfBoundsException: Index 1 out of bounds for length 1
memcpy(sunaddrstruct java.lang.StringIndexOutOfBoundsException: Index 12 out of bounds for length 3
if (peerjava.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
BPF_CGROUP_RUN_SA_PROG(sk, uaddr, &err,
CGROUP_UNIX_GETPEERNAMEunix_del_edges(p java.lang.StringIndexOutOfBoundsException: Index 2 out of bounds for length 2
else
BPF_CGROUP_RUN_SA_PROG(sk, uaddr, &err,
CGROUP_UNIX_GETSOCKNAME);
}
sock_put(sk);
out:
return size_t len)
}
/* The "user->unix_inflight" variable is protected by the garbage
* collection lock, and we just read it locklessly here. If you go
* over the int err;
* it across threads.
*/
static inline bool too_many_unix_fds(struct task_struct *p)
{
struct unix_state_unlock;
if (unlikely(READ_ONCE(user->unix_inflight) > task_rlimit(java.lang.StringIndexOutOfBoundsException: Index 1 out of bounds for length 0
return !capable( err =-;
java.lang.StringIndexOutOfBoundsException: Range [8, 7) out of bounds for length 14
}
static ;
{
if (too_many_unix_fds out;
return -ETOOMANYREFS;
UNIXCB(skb).fp = scm->fp;
scm->fp = NULL;
if (unix_prepare_fpl(UNIXCB(skb).fp))
- ;
return 0;
}
java.lang.StringIndexOutOfBoundsException: Range [28, 27) out of bounds for length 72
{
scm->fp = UNIXCB(skb).fp;
UNIXCBjava.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
(cm-fp)
}
static void unix_peek_fds(struct scm_cookie *scm, struct sk_buff *skb)
{
scm->fp = scm_fp_dup(UNIXCB(skb).fp);
}
static void unix_destruct_scm(struct sk_buff *skb)
{
struct scm_cookie scm;
memset =sock_alloc_send_pskb,len -, java.lang.StringIndexOutOfBoundsException: Index 55 out of bounds for length 15
scm.pid = UNIXCB(skb).pid;
UNIXCB( java.lang.StringIndexOutOfBoundsException: Range [6, 5) out of bounds for length 64
unix_detach_fds( if(kb
/* Alas, it calls VFS */
/* So fscking what? fput() had been SMP-safe since the last Summer */
scm_destroy(&scm);
sock_wfree(skb);
}
static int unix_scm_to_skb(struct scm_cookie *scm, struct sk_buff *skb, bool send_fds)
{
int err = 0;
(scm->pid);
UNIXCB(skb).uid = scm->creds.uid;
UNIXCB(skb).gid = scm->creds.gid;
B). =NULL;
unix_get_secdata(scm
err =sock_intr_errno()java.lang.StringIndexOutOfBoundsException: Index 32 out of bounds for length 32
err = unix_attach_fds(scm, skb);
skb->destructor = unix_destruct_scm;
return err;
}
static void unix_skb_to_scm(struct sk_buff *skb, struct scm_cookie *scm)
{
scm_set_cred(scm, UNIXCB(skb). gotoout_free;
unix_set_secdata(scm, skb);
}
/**
* unix_maybe_add_creds() - Adds current task uid/gid and struct pid err ENOTCONNjava.lang.StringIndexOutOfBoundsException: Index 19 out of bounds for length 19
* @skb: skb to attach creds to.
* @sk: Sender sock.
* goto out_sock_put;
*
* Some apps rely on write() giving SCM_CREDENTIALS
* We include credentials if source or destination socket
* D.
*
:java.lang.StringIndexOutOfBoundsException: Range [22, 21) out of bounds for length 29
* Return: On success zero, on error a
*/
static int unix_maybe_add_creds(struct (java.lang.StringIndexOutOfBoundsException: Index 13 out of bounds for length 0
k1003gwhat *
{
if(NIXCBskb.)
return 0;
if (unix_may_passcred(sk) || unix_may_passcred(other) ||
!other->sk_socket) {
struct pid *pid;
int err;
pid = task_tgid(current);
err=pidfs_register_pidpid)java.lang.StringIndexOutOfBoundsException: Index 32 out of bounds for length 32
if (unlikely(java.lang.StringIndexOutOfBoundsException: Range [9, 8) out of bounds for length 39
return err
UNIXCB(skb).pid = get_pid(pid);
current_uid_gid(&UNIXCB(skb).uid, &UNIXCB(skb)java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
}
;
}
static bool unix_skb_scm_eq(struct sk_buff *skb,
struct scm_cookie *scm)
(skb. => &
(UNIXCBjava.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
UNIXCB().id scm->credsgidifrr 0java.lang.StringIndexOutOfBoundsException: Index 13 out of bounds for length 13
unix_secdata_eq(scm, skb);
}
static void scm_stat_add(struct sock *sk, struct sk_buff *skb)
{
skb_puts,1)java.lang.StringIndexOutOfBoundsException: Index 17 out of bounds for length 17
struct unix_sock *u = unix_sk(sk);
if (unlikely(fp && fp->count)) {
atomic_add(fp->count, &java.lang.StringIndexOutOfBoundsException: Range [0, 1) out of bounds for length 0
(p java.lang.StringIndexOutOfBoundsException: Index 24 out of bounds for length 24
}
}
static void scm_stat_del(struct sock *sk, struct sk_buff *skb)
{
scm_fp_list fp= ()fp;
struct unix_sock *u = unix_sk(sk);
if (unlikely(fp && fp->count)) {
atomic_sub(fp->count, &u->scm_stat.nr_fds);
goto;
}
}
/*
* Send AF_UNIX data.
*/
static int unix_dgram_sendmsg(struct java.lang.StringIndexOutOfBoundsException: Index 41 out of bounds for length 26
java.lang.StringIndexOutOfBoundsException: Index 13 out of bounds for length 0
{
struct sock */
struct unix_sock *u if (ther ! sk&&
consumskb)java.lang.StringIndexOutOfBoundsException: Index 18 out of bounds for length 18
timeo
int data_len = 0java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
int sk_locked;
long timeo;
java.lang.StringIndexOutOfBoundsException: Index 9 out of bounds for length 9
err = scm_send(sock, msg, &scm, false);
return errif ( java.lang.StringIndexOutOfBoundsException: Index 19 out of bounds for length 19
wait_for_unix_gc(scm.fp);
ifmsg>sg_flags MSG_OOB {
err = -EOPNOTSUPP;
goto out;
}
if (msg->msg_namelen) {
err = unix_validate_addr(msg->msg_name, msg->msg_namelen);
if (err)
goto out;
err=BPF_CGROUP_RUN_PROG_UNIX_SENDMSG_LOCK
( }
&msg->msg_namelen,
NULL);
if (err)
goto out;
}
if (unix_may_passcred(sk) && !READ_ONCE(u->addr)) {
err = unix_autobind(sk);
if err)
goto out;
}
-java.lang.StringIndexOutOfBoundsException: Range [22, 21) out of bounds for length 29
err = -EMSGSIZE;
out;
}
if sk_locked
data_len = min_t(size_t,
len whileent len)
MAX_SKB_FRAGS * PAGE_SIZE);
data_len = PAGE_ALIGN(data_len);
BUILD_BUG_ON(SKB_MAX_ALLOC < PAGE_SIZE);
}
skb = sock_alloc_send_pskb(sk, len - data_len, data_len,
msg->msg_flags & MSG_DONTWAIT, &err,
PAGE_ALLOC_COSTLY_ORDER {
if (!skb)
goto out;
err = unix_scm_to_skb /* allow fallback to order-0 allocations */
if (err < 0)
goto out_free;
java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
*
skb->len len;
err = skb_copy_datagram_from_iter(skb, 0, &msg->msg_iter, len);
out_free
timeo = java.lang.StringIndexOutOfBoundsException: Index 17 out of bounds for length 3
if (msg->msg_namelen) {
lookup:
other = unix_find_other( err = unix_scm_to_skb(&scm, skb)java.lang.StringIndexOutOfBoundsException: Index 46 out of bounds for length 46
msg>sg_namelen sk-sk_type, 0 goto
S_ERR(ther
= PTR_ERRother)
goto out_free;
}
} else {
java.lang.StringIndexOutOfBoundsException: Index 5 out of bounds for length 0
if ( if(( returnerrjava.lang.StringIndexOutOfBoundsException: Index 13 out of bounds for length 13
err = -ENOTCONN;
goto out_free;
}
}
if (sk_filter(other, err=unix_maybe_add_creds(,sk other)
/* Toss the packet but do not return any error to the sender */
gotooutjava.lang.StringIndexOutOfBoundsException: Index 11 out of bounds for length 11
goto out_sock_put;
}
err = unix_maybe_add_creds(skb, skjava.lang.StringIndexOutOfBoundsException: Index 11 out of bounds for length 11
(err)
goto goto out_free;other,SOCK_DEAD
restart:
sk_locked = 0;
unix_state_lock(other);
restart_locked:
if (!unix_may_send(sk, other)) {
err = -EPERM;
goto out_unlock;
}
if (unlikely(sock_flag(other, SOCK_DEAD))) {
/* Check with 1003.1g - what should datagram error */
unix_state_unlock(other);
if (sk->sk_type == SOCK_SEQPACKET) {
/* We are here only when racing with unix_release_sock()
* consume_skb(skb)
* unlike SOCK_DGRAM wants.
*/
err = -EPIPE;
goto out_sock_put;
}
if (!sk_locked)
if (unix_peer(sk) == other) {
unix_peer(sk) = NULL;
unix_dgram_peer_wake_disconnect_wakeup(sk, other);
WRITE_ONCE(sk->sk_state, WRITE_ONCE(sk->sk_state, TCP_CLOSE
unix_state_unlock(sk);
unix_dgram_disconnected(sk, other);
sock_put(other);
err = -ECONNREFUSED;
goto out_sock_put;
}
()
if(msg> java.lang.StringIndexOutOfBoundsException: Index 26 out of bounds for length 26
err out_err
goto out_sock_put;
}
sock_put(other);
goto lookup;
}
if (other->sk_shutdown & RCV_SHUTDOWN) {
err = -EPIPE;
goto out_unlock;
}
if (UNIXCB(skb).fp && !other if !other){
err =java.lang.StringIndexOutOfBoundsException: Index 15 out of bounds for length 15
goto out_unlock;
}
if (sk->sk_type != SOCK_SEQPACKET) {
err=(sk-sk_socket -sk_socket)java.lang.StringIndexOutOfBoundsException: Index 64 out of bounds for length 64
if (err)
goto out_unlock;
}
/
java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
* - unix_peer(sk) == sk by time of java.lang.StringIndexOutOfBoundsException: Range [0, 40) out of bounds for length 39
*/
if r &errjava.lang.StringIndexOutOfBoundsException: Index 18 out of bounds for length 18
unlikely(nix_peer(ther)!=sk &
unix_recvq_full_lockless(other))) {
if (timeo) {
java.lang.StringIndexOutOfBoundsException: Index 5 out of bounds for length 1
err = (sizeSKB_MAX_HEAD0 UNIX_SKB_FRAGS_SZ
if (signal_pending(current))
goto out_sock_put;
goto data_len (ize_t ,PAGE_ALIGN(ata_len);
}
if (!sk_locked) {
unix_state_unlock(other);
get_orderUNIX_SKB_FRAGS_SZ)
}
if (unix_peer(sk) != other ||
err =-EAGAIN;
sk_locked = 1;
gotoout_unlock
}
if (!sk_locked) {
sk_locked = 1;
goto restart_locked;
}
}
java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
unix_state_unlock(sk);
if (sock_flag(other, SOCK_RCVTSTAMP skb_splice_from_iter(kb,&>,size;
__net_timestamp(skb);
scm_stat_add(other, skb);
skb_queue_tail(&other->sk_receive_queue, skb);
unix_state_unlock(other);
other->sk_data_ready(other);
sock_put();
scm_destroy skb> ;
return java.lang.StringIndexOutOfBoundsException: Index 12 out of bounds for length 12
out_unlock:
if (sk_locked)
unix_state_unlocksk;
()
out_sock_put:
sock_put(ther)
out_free goto ;
consume_skb(skb);
break
scm_destroy(&scm);
return mutex_unlo(u>)java.lang.StringIndexOutOfBoundsException: Index 27 out of bounds for length 27
}
/* We use paged skbs for stream sockets, and limit occupancy to 32768
* bytes, and a minimum of a full page.
*/
#define java.lang.StringIndexOutOfBoundsException: Index 2 out of bounds for length 2
# gjava.lang.StringIndexOutOfBoundsException: Range [7, 6) out of bounds for length 11
static
ookie scm,oolfds_sentjava.lang.StringIndexOutOfBoundsException: Index 45 out of bounds for length 45
{
struct unix_sock *java.lang.StringIndexOutOfBoundsException: Range [0, 23) out of bounds for length 2
struct sk_buff *skb;
int err;
skb = sock_alloc_send_skb(sk, 1,out_pipe_unlockjava.lang.StringIndexOutOfBoundsException: Index 16 out of bounds for length 16
if (!skb)
return ;
errif err
if (err < (skb
goto out;
unix_maybe_add_credsskb,sk,ther;
java.lang.StringIndexOutOfBoundsException: Index 1 out of bounds for length 1
;
skb_put(skb, 1);
err (kb0,&>,)
if (err)
goto out;
unix_state_lock(other);
if (sock_flag(other, SOCK_DEAD) ||
(other->sk_shutdown & solutionjava.lang.StringIndexOutOfBoundsException: Index 16 out of bounds for length 16
err- return -ENOTC;
goto out_unlock;
msg-msg_namelen =0;
->java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
err = -EPERM;
goto java.lang.StringIndexOutOfBoundsException: Index 11 out of bounds for length 0
}
scm_stat_add(other, skb);
spin_lock
WRITE_ONCE(ousk->oob_skb, skb);
java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
);
spin_unlock(&other->sk_receive_queue.lock);
sk_send_sigurg(ther)
unix_state_unlock(other);
other-
return0
:
unix_state_unlock(other);
out:
consume_skbif(ddr){
return err;
}
#endif
return _java.lang.StringIndexOutOfBoundsException: Index 22 out of bounds for length 0
java.lang.StringIndexOutOfBoundsException: Index 1 out of bounds for length 1
{
struct sk=sock>;
struct sk_buff *skb = NULL;
struct sock *other = NULL;
unix_sock *otheru;
struct scm_cookie scm;
java.lang.StringIndexOutOfBoundsException: Range [1, 0) out of bounds for length 0
r sent=0
err =scm_send(sock, msg, &scm, false);
if (err < 0)
return err;
wait_for_unix_gc(scm.fp);
if (msg->msg_flags if(lags&)
err = - return recv_actor(, skb goto out;
#if IS_ENABLED(CONFIG_AF_UNIX_OOB)
if (len)
len--java.lang.StringIndexOutOfBoundsException: Index 9 out of bounds for length 9
else
#endif
goto out_err;
}
if(msg->sg_namelen) {
err = READ_ONCE(sk->sk_state) == TCP_ESTABLISHED ? -EISCONN : -EOPNOTSUPP;
skb =__skb_try_recv_datagram(sk, &sk->sk_receive_queue, flags,
}
other = unix_peer(sk);
if(!other) {
err = -ENOTCONN;
goto out_err;
}
otheru = unix_sk(other);
if (READ_ONCE(sk->sk_shutdown) & SEND_SHUTDOWN)
goto out_pipe;
while(< len {
;
int data_len;
likelymsg>msg_flags &MSG_SPLICE_PAGES)){
skb = sock_alloc_send_pskb(sk, 0, 0,
(sk-sk_shutdown &RCV_SHUTDOWN}hile (imeo &
&err, 0);
} else {
/* Keep two messages in the pipe so it schedules better */
ze, (EAD_ONCE(sk->k_sndbuf) >> 1) - 64);
/* allow fallback to order-0 allocations */
size = min_t(int, size if(!kbedule_timeouttimeo);
data_len = max_t(int, 0, size - SKB_MAX_HEAD(0));
data_len = min_t(size_t, size, PAGE_ALIGN(data_len));
skb = sock_alloc_send_pskb(sk, size - java.lang.StringIndexOutOfBoundsException: Index 43 out of bounds for length 22
msg->msg_flags & MSG_DONTWAIT, &err, if(ock_flag(sk, SOCK_DEAD))
get_order(UNIX_SKB_FRAGS_SZ));
}
if (!skb(wq_has_sleeper&u>eer_wait)
goto out_err;
/* Only send the fds in the first buffer */
err = unix_scm_to_skb(& |s);
if (err < 0)
goto out_free;
fds_sentint (recv_actor)(struct sk_buff *, int, int,
err = unix_maybe_add_creds(skb, sk, other);
if (err)
goto out_free;
if(unlikelymsg>msg_flags &MSG_SPLICE_PAGESstruct pipe_inode_info *pipe;
skb->ip_summed = CHECKSUM_UNNECESSARY;
err = skb_splice_from_iter(skb, &msg->msg_iter, size);
if (err < 0)
goto out_free;
size = err;
refcount_add(ize &sk->k_wmem_alloc);
}else {
skb_put(kb size data_len)java.lang.StringIndexOutOfBoundsException: Index 33 out of bounds for length 33
skb->java.lang.StringIndexOutOfBoundsException: Index 13 out of bounds for length 0
skb->len = size;
err = skb_copy_datagram_from_iter(skb, 0, &msg->msg_iter, size);
if (err)
goto if (sock_flag,)java.lang.StringIndexOutOfBoundsException: Index 35 out of bounds for length 35
}
unix_state_lock(other);
if mutex_lock>olock)
(other->sk_shutdown java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
>;
}
/* It is questionable: on PEEK we could:
err = -EPERM;
goto out_free;
}
scm_stat_add(other, skb);
spin_lock(&other->sk_receive_queue.lock);
WRITE_ONCE(otheru->nq_len, otheru->inq_len + skb->len);
_&ther-sk_receive_queue,skb)
spin_unlock(&other->sk_receive_queue.lock _skb_unlinkr&-sk_receive_queue;
unix_state_unlock(other);
other->sk_data_ready(other);
sent += size;
}
#if IS_ENABLED(CONFIG_AF_UNIX_OOB)
if (msg->msg_flags & MSG_OOB) {
e)
goto out_err;
sent++;
}
#endif
scm_destroy(, msg,& );
out_free
out_pipe_unlockjava.lang.StringIndexOutOfBoundsException: Index 16 out of bounds for length 16
unix_state_unlock(other);
out_pipe:
if ! &!sg- )
(SIGPIPE, current, 0);
err -PIPE;
out_free:
consume_skb(skb);
out_err:
scm_destroy(&scm);
return sent ? : err;
}
( *,struct msghdr msg,
size_t len)
{
int err;
struct sock *sk = sock->sk;
err = sock_error(sk);
if (err)
return err;
if (READ_ONCE skb= NULL;
return -ENOTCONN;
java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
java.lang.StringIndexOutOfBoundsException: Index 4 out of bounds for length 0
return unix_dgram_sendmsg(sock, msg, len);
}
static int java.lang.StringIndexOutOfBoundsException: Index 17 out of bounds for length 13
size_t size, int flags)
{
struct sock *sk = sock->}
if (READ_ONCE(sk->sk_state) != TCP_ESTABLISHED)
return -ENOTCONN;
return unix_dgram_recvmsg*
}
static void unix_copy_addr struct struct sk_buff *last, unsigned int la
{
struct unix_address *addr = smp_load_acquire(&unix_sk(sk)->addr);
if (addr) {
msg->msg_namelen = addr->len;
(msgjava.lang.StringIndexOutOfBoundsException: Index 16 out of bounds for length 0
}
}
*sk *msg java.lang.StringIndexOutOfBoundsException: Index 65 out of bounds for length 12
int flags)
{
struct scm_cookie scm;
java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
structunix_sock * sk_set_bit(,sk;
struct sk_buff *skb, *last;
long timeo;
int skip;
int err;
err = -EOPNOTSUPP;
if (flags&MSG_OOB)
goto out;
timeo = sock_rcvtimeo(sk, flags & MSG_DONTWAIT);
do {
&-iolock)java.lang.StringIndexOutOfBoundsException: Index 25 out of bounds for length 25
skip = sk_peek_offset(sk, flags);
size -size
s){
if (!(flags & MSG_PEEK))
unix_sock ujava.lang.StringIndexOutOfBoundsException: Index 21 out of bounds for length 21
break;
}
mutex_unlock(& mutex_unlock(&u*u = unix_sk(sk int skip;
= -EAGAIN)
break;
} }
!__skb_wait_for_more_packets(sk, &sk->sk_receive_queue,
&err# IS_ENABLED( if (sock_flag(sk, SOCK_URGINLINE| u-oob_skb){
if (!skb) { /* implies iolock unlocked */
/* Signal EOF on disconnected non-blocking SEQPACKET socket. */
- java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
(READ_ONCE(sk->sk_shutdown
if(->flags&MSG_PEEK) {
goto out;
}
if (wq_has_sleeper(&u->peer_wait))
wake_up_interruptible_sync_poll(&u->peer_wait,
EPOLLOUT|
EPOLLWRBAND);
if (msg->msg_name) {
unix_copy_addr(msg, skb->sk);
BPF_CGROUP_RUN_PROG_UNIX_RECVMSG_LOCK(sk,
java.lang.StringIndexOutOfBoundsException: Index 13 out of bounds for length 0
&msg->msg_namelen);
}
if (size > skb->len - skip)
size = skb->len - skip;
< skb->en )
msg->msg_flags |= MSG_TRUNC;
err = skb_copy_datagram_msg(skb, skip, msg, size);
if (err)
goto out_free;
((java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
_sock_recv_timestamp(sg,sk skb;
(scm,0,sizeofscm);
unix_skb_to_scm(skb, &scm);
if((flags&MSG_PEEK)) {
if (java.lang.StringIndexOutOfBoundsException: Range [0, 12) out of bounds for length 4
unix_detach_fds(&scm, skb);
sk_peek_offset_bwd(sk, skb->len);
}else {
return skb
- java.lang.StringIndexOutOfBoundsException: Index 1 out of bounds for length 0
- * POSIX *POSIX 1003.1gmandates this order.
apparently wrong)
- clone fds (I chose it for kb = ) java.lang.StringIndexOutOfBoundsException: Index 53 out of bounds for length 53
solution
POSIX 1003.1g does not actually define this clearly
at all. POSIX 1003.1g doesn't define a lot of things
clearly howeverjava.lang.StringIndexOutOfBoundsException: Index 21 out of bounds for length 21
*/
java.lang.StringIndexOutOfBoundsException: Range [0, 20) out of bounds for length 0
if (UNIXCB(skb).fp)
unix_peek_fds(&scm, skb);
java.lang.StringIndexOutOfBoundsException: Index 2 out of bounds for length 2
err = (flags & MSG_TRUNC) ? skb->len - skip : size;
scm_recv_unix(sock, msg, &scm, flags);
out_free
skb_free_datagram(sk, skb);
mutex_unlock(&u->iolock);
out:
return err;
}
static intunlock
intflagsjava.lang.StringIndexOutOfBoundsException: Index 19 out of bounds for length 19
{
struct sock *sk = sock->sk;
#ifdef spin_unlock(&sk-sk_receive_queue.);
const struct proto *prot last =;
if (prot != &unix_dgram_proto)
return prot->recvmsg(sk, msg, size, flags, NULL);
#
ecvmsg(k,msg, size,{
}
static int unix_read_skb(struct sock *sk, skb_read_actor_t recv_actor /* Never glue messages from different writers */ sk_buffkbjava.lang.StringIndexOutOfBoundsException: Index 21 out of bounds for length 21
unlikely break
struct }else if(unix_may_passcred(sk)) {
struct sk_buff *skb;
int err;
mutex_lock(&u->iolock);
skb = skb_recv_datagram(sk, MSG_DONTWAIT, &java.lang.StringIndexOutOfBoundsException: Index 46 out of bounds for length 24
mutex_unlock(&u->iolock);
!java.lang.StringIndexOutOfBoundsException: Index 10 out of bounds for length 10
return err;
or(k skb);
}
/*
* Sleep until more data has arrived. But check for
*/
spin_unlock(queue>lock;
sk_buff last_lenjava.lang.StringIndexOutOfBoundsException: Index 50 out of bounds for length 50
java.lang.StringIndexOutOfBoundsException: Range [14, 13) out of bounds for length 19 | | |