Lines Matching full:scm
108 #include <net/scm.h>
119 #include "scm.h"
187 static void unix_get_secdata(struct scm_cookie *scm, struct sk_buff *skb) in unix_get_secdata() argument
189 UNIXCB(skb).secid = scm->secid; in unix_get_secdata()
192 static inline void unix_set_secdata(struct scm_cookie *scm, struct sk_buff *skb) in unix_set_secdata() argument
194 scm->secid = UNIXCB(skb).secid; in unix_set_secdata()
197 static inline bool unix_secdata_eq(struct scm_cookie *scm, struct sk_buff *skb) in unix_secdata_eq() argument
199 return (scm->secid == UNIXCB(skb).secid); in unix_secdata_eq()
202 static inline void unix_get_secdata(struct scm_cookie *scm, struct sk_buff *skb) in unix_get_secdata() argument
205 static inline void unix_set_secdata(struct scm_cookie *scm, struct sk_buff *skb) in unix_set_secdata() argument
208 static inline bool unix_secdata_eq(struct scm_cookie *scm, struct sk_buff *skb) in unix_secdata_eq() argument
1754 static void unix_peek_fds(struct scm_cookie *scm, struct sk_buff *skb) in unix_peek_fds() argument
1756 scm->fp = scm_fp_dup(UNIXCB(skb).fp); in unix_peek_fds()
1801 static int unix_scm_to_skb(struct scm_cookie *scm, struct sk_buff *skb, bool send_fds) in unix_scm_to_skb() argument
1805 UNIXCB(skb).pid = get_pid(scm->pid); in unix_scm_to_skb()
1806 UNIXCB(skb).uid = scm->creds.uid; in unix_scm_to_skb()
1807 UNIXCB(skb).gid = scm->creds.gid; in unix_scm_to_skb()
1809 unix_get_secdata(scm, skb); in unix_scm_to_skb()
1810 if (scm->fp && send_fds) in unix_scm_to_skb()
1811 err = unix_attach_fds(scm, skb); in unix_scm_to_skb()
1841 static int maybe_init_creds(struct scm_cookie *scm, in maybe_init_creds() argument
1848 err = scm_send(socket, &msg, scm, false); in maybe_init_creds()
1853 scm->pid = get_pid(task_tgid(current)); in maybe_init_creds()
1854 current_uid_gid(&scm->creds.uid, &scm->creds.gid); in maybe_init_creds()
1860 struct scm_cookie *scm) in unix_skb_scm_eq() argument
1862 return UNIXCB(skb).pid == scm->pid && in unix_skb_scm_eq()
1863 uid_eq(UNIXCB(skb).uid, scm->creds.uid) && in unix_skb_scm_eq()
1864 gid_eq(UNIXCB(skb).gid, scm->creds.gid) && in unix_skb_scm_eq()
1865 unix_secdata_eq(scm, skb); in unix_skb_scm_eq()
1896 struct scm_cookie scm; in unix_dgram_sendmsg() local
1904 err = scm_send(sock, msg, &scm, false); in unix_dgram_sendmsg()
1949 err = unix_scm_to_skb(&scm, skb, true); in unix_dgram_sendmsg()
2078 scm_destroy(&scm); in unix_dgram_sendmsg()
2090 scm_destroy(&scm); in unix_dgram_sendmsg()
2154 struct scm_cookie scm; in unix_stream_sendmsg() local
2159 err = scm_send(sock, msg, &scm, false); in unix_stream_sendmsg()
2206 err = unix_scm_to_skb(&scm, skb, !fds_sent); in unix_stream_sendmsg()
2245 scm_destroy(&scm); in unix_stream_sendmsg()
2257 scm_destroy(&scm); in unix_stream_sendmsg()
2267 struct scm_cookie scm; in unix_stream_sendpage() local
2313 err = maybe_init_creds(&scm, socket, other); in unix_stream_sendpage()
2322 } else if (!skb || !unix_skb_scm_eq(skb, &scm)) { in unix_stream_sendpage()
2349 err = unix_scm_to_skb(&scm, skb, false); in unix_stream_sendpage()
2361 scm_destroy(&scm); in unix_stream_sendpage()
2373 scm_destroy(&scm); in unix_stream_sendpage()
2420 struct scm_cookie scm; in __unix_dgram_recvmsg() local
2484 memset(&scm, 0, sizeof(scm)); in __unix_dgram_recvmsg()
2486 scm_set_cred(&scm, UNIXCB(skb).pid, UNIXCB(skb).uid, UNIXCB(skb).gid); in __unix_dgram_recvmsg()
2487 unix_set_secdata(&scm, skb); in __unix_dgram_recvmsg()
2491 unix_detach_fds(&scm, skb); in __unix_dgram_recvmsg()
2511 unix_peek_fds(&scm, skb); in __unix_dgram_recvmsg()
2515 scm_recv(sock, msg, &scm, flags); in __unix_dgram_recvmsg()
2694 struct scm_cookie scm; in unix_stream_read_generic() local
2725 memset(&scm, 0, sizeof(scm)); in unix_stream_read_generic()
2787 scm_destroy(&scm); in unix_stream_read_generic()
2811 if (!unix_skb_scm_eq(skb, &scm)) in unix_stream_read_generic()
2815 scm_set_cred(&scm, UNIXCB(skb).pid, UNIXCB(skb).uid, UNIXCB(skb).gid); in unix_stream_read_generic()
2816 unix_set_secdata(&scm, skb); in unix_stream_read_generic()
2862 unix_detach_fds(&scm, skb); in unix_stream_read_generic()
2871 if (scm.fp) in unix_stream_read_generic()
2877 unix_peek_fds(&scm, skb); in unix_stream_read_generic()
2898 scm_recv(sock, state->msg, &scm, flags); in unix_stream_read_generic()
2900 scm_destroy(&scm); in unix_stream_read_generic()