Lines Matching full:scm
41 void scm_detach_fds(struct msghdr *msg, struct scm_cookie *scm);
42 void scm_detach_fds_compat(struct msghdr *msg, struct scm_cookie *scm);
43 int __scm_send(struct socket *sock, struct msghdr *msg, struct scm_cookie *scm);
44 void __scm_destroy(struct scm_cookie *scm);
48 static __inline__ void unix_get_peersec_dgram(struct socket *sock, struct scm_cookie *scm) in unix_get_peersec_dgram() argument
50 security_socket_getpeersec_dgram(sock, NULL, &scm->secid); in unix_get_peersec_dgram()
53 static __inline__ void unix_get_peersec_dgram(struct socket *sock, struct scm_cookie *scm) in unix_get_peersec_dgram() argument
57 static __inline__ void scm_set_cred(struct scm_cookie *scm, in scm_set_cred() argument
60 scm->pid = get_pid(pid); in scm_set_cred()
61 scm->creds.pid = pid_vnr(pid); in scm_set_cred()
62 scm->creds.uid = uid; in scm_set_cred()
63 scm->creds.gid = gid; in scm_set_cred()
66 static __inline__ void scm_destroy_cred(struct scm_cookie *scm) in scm_destroy_cred() argument
68 put_pid(scm->pid); in scm_destroy_cred()
69 scm->pid = NULL; in scm_destroy_cred()
72 static __inline__ void scm_destroy(struct scm_cookie *scm) in scm_destroy() argument
74 scm_destroy_cred(scm); in scm_destroy()
75 if (scm->fp) in scm_destroy()
76 __scm_destroy(scm); in scm_destroy()
80 struct scm_cookie *scm, bool forcecreds) in scm_send() argument
82 memset(scm, 0, sizeof(*scm)); in scm_send()
83 scm->creds.uid = INVALID_UID; in scm_send()
84 scm->creds.gid = INVALID_GID; in scm_send()
86 scm_set_cred(scm, task_tgid(current), current_uid(), current_gid()); in scm_send()
87 unix_get_peersec_dgram(sock, scm); in scm_send()
90 return __scm_send(sock, msg, scm); in scm_send()
94 static inline void scm_passec(struct socket *sock, struct msghdr *msg, struct scm_cookie *scm) in scm_passec() argument
101 err = security_secid_to_secctx(scm->secid, &secdata, &seclen); in scm_passec()
115 static inline void scm_passec(struct socket *sock, struct msghdr *msg, struct scm_cookie *scm) in scm_passec() argument
124 static __inline__ void scm_pidfd_recv(struct msghdr *msg, struct scm_cookie *scm) in scm_pidfd_recv() argument
142 if (!scm->pid) in scm_pidfd_recv()
145 pidfd = pidfd_prepare(scm->pid, 0, &pidfd_file); in scm_pidfd_recv()
161 struct scm_cookie *scm, int flags) in __scm_recv_common() argument
166 scm->fp || scm_has_secdata(sock)) in __scm_recv_common()
168 scm_destroy(scm); in __scm_recv_common()
175 .pid = scm->creds.pid, in __scm_recv_common()
176 .uid = from_kuid_munged(current_ns, scm->creds.uid), in __scm_recv_common()
177 .gid = from_kgid_munged(current_ns, scm->creds.gid), in __scm_recv_common()
182 scm_passec(sock, msg, scm); in __scm_recv_common()
184 if (scm->fp) in __scm_recv_common()
185 scm_detach_fds(msg, scm); in __scm_recv_common()
191 struct scm_cookie *scm, int flags) in scm_recv() argument
193 if (!__scm_recv_common(sock, msg, scm, flags)) in scm_recv()
196 scm_destroy_cred(scm); in scm_recv()
200 struct scm_cookie *scm, int flags) in scm_recv_unix() argument
202 if (!__scm_recv_common(sock, msg, scm, flags)) in scm_recv_unix()
206 scm_pidfd_recv(msg, scm); in scm_recv_unix()
208 scm_destroy_cred(scm); in scm_recv_unix()