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