Lines Matching refs:scm

53 void scm_detach_fds(struct msghdr *msg, struct scm_cookie *scm);
54 void scm_detach_fds_compat(struct msghdr *msg, struct scm_cookie *scm);
55 int __scm_send(struct socket *sock, struct msghdr *msg, struct scm_cookie *scm);
56 void __scm_destroy(struct scm_cookie *scm);
60 static __inline__ void unix_get_peersec_dgram(struct socket *sock, struct scm_cookie *scm) in unix_get_peersec_dgram() argument
62 security_socket_getpeersec_dgram(sock, NULL, &scm->secid); in unix_get_peersec_dgram()
65 static __inline__ void unix_get_peersec_dgram(struct socket *sock, struct scm_cookie *scm) in unix_get_peersec_dgram() argument
69 static __inline__ void scm_set_cred(struct scm_cookie *scm, in scm_set_cred() argument
72 scm->pid = get_pid(pid); in scm_set_cred()
73 scm->creds.pid = pid_vnr(pid); in scm_set_cred()
74 scm->creds.uid = uid; in scm_set_cred()
75 scm->creds.gid = gid; in scm_set_cred()
78 static __inline__ void scm_destroy_cred(struct scm_cookie *scm) in scm_destroy_cred() argument
80 put_pid(scm->pid); in scm_destroy_cred()
81 scm->pid = NULL; in scm_destroy_cred()
84 static __inline__ void scm_destroy(struct scm_cookie *scm) in scm_destroy() argument
86 scm_destroy_cred(scm); in scm_destroy()
87 if (scm->fp) in scm_destroy()
88 __scm_destroy(scm); in scm_destroy()
92 struct scm_cookie *scm, bool forcecreds) in scm_send() argument
94 memset(scm, 0, sizeof(*scm)); in scm_send()
95 scm->creds.uid = INVALID_UID; in scm_send()
96 scm->creds.gid = INVALID_GID; in scm_send()
98 scm_set_cred(scm, task_tgid(current), current_uid(), current_gid()); in scm_send()
99 unix_get_peersec_dgram(sock, scm); in scm_send()
102 return __scm_send(sock, msg, scm); in scm_send()
106 static inline void scm_passec(struct socket *sock, struct msghdr *msg, struct scm_cookie *scm) in scm_passec() argument
113 err = security_secid_to_secctx(scm->secid, &secdata, &seclen); in scm_passec()
127 static inline void scm_passec(struct socket *sock, struct msghdr *msg, struct scm_cookie *scm) in scm_passec() argument
136 static __inline__ void scm_pidfd_recv(struct msghdr *msg, struct scm_cookie *scm) in scm_pidfd_recv() argument
154 if (!scm->pid) in scm_pidfd_recv()
157 pidfd = pidfd_prepare(scm->pid, 0, &pidfd_file); in scm_pidfd_recv()
173 struct scm_cookie *scm, int flags) in __scm_recv_common() argument
178 scm->fp || scm_has_secdata(sock)) in __scm_recv_common()
180 scm_destroy(scm); in __scm_recv_common()
187 .pid = scm->creds.pid, in __scm_recv_common()
188 .uid = from_kuid_munged(current_ns, scm->creds.uid), in __scm_recv_common()
189 .gid = from_kgid_munged(current_ns, scm->creds.gid), in __scm_recv_common()
194 scm_passec(sock, msg, scm); in __scm_recv_common()
196 if (scm->fp) in __scm_recv_common()
197 scm_detach_fds(msg, scm); in __scm_recv_common()
203 struct scm_cookie *scm, int flags) in scm_recv() argument
205 if (!__scm_recv_common(sock, msg, scm, flags)) in scm_recv()
208 scm_destroy_cred(scm); in scm_recv()
212 struct scm_cookie *scm, int flags) in scm_recv_unix() argument
214 if (!__scm_recv_common(sock, msg, scm, flags)) in scm_recv_unix()
218 scm_pidfd_recv(msg, scm); in scm_recv_unix()
220 scm_destroy_cred(scm); in scm_recv_unix()