FreeBSD Bugzilla – Attachment 188271 Details for
Bug 215202
Linuxulator: LOCAL_PEERCRED / xucred does not have process ID
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
Remember
[x]
|
Forgot Password
Login:
[x]
[patch]
peercred.patch
peercred.patch (text/plain), 2.17 KB, created by
Val Packett
on 2017-11-25 11:51:38 UTC
(
hide
)
Description:
peercred.patch
Filename:
MIME Type:
Creator:
Val Packett
Created:
2017-11-25 11:51:38 UTC
Size:
2.17 KB
patch
obsolete
>diff --git i/sys/compat/linux/linux_socket.c w/sys/compat/linux/linux_socket.c >index d10e966f575..b93ca3d6759 100644 >--- i/sys/compat/linux/linux_socket.c >+++ w/sys/compat/linux/linux_socket.c >@@ -1626,10 +1626,7 @@ linux_getsockopt(struct thread *td, struct linux_getsockopt_args *args) > name, &xu, UIO_SYSSPACE, &xulen); > if (error != 0) > return (error); >- /* >- * XXX Use 0 for pid as the FreeBSD does not cache peer pid. >- */ >- lxu.pid = 0; >+ lxu.pid = xu.cr_pid; > lxu.uid = xu.cr_uid; > lxu.gid = xu.cr_gid; > return (copyout(&lxu, PTRIN(args->optval), sizeof(lxu))); >diff --git i/sys/kern/kern_fork.c w/sys/kern/kern_fork.c >index 0367cdd7f18..c1a2e08acfc 100644 >--- i/sys/kern/kern_fork.c >+++ w/sys/kern/kern_fork.c >@@ -405,7 +405,7 @@ do_fork(struct thread *td, struct fork_req *fr, struct proc *p2, struct thread * > sx_sunlock(&proctree_lock); > > p2->p_state = PRS_NEW; /* protect against others */ >- p2->p_pid = trypid; >+ p2->p_pid = p2->p_ucred->cr_pid = trypid; > AUDIT_ARG_PID(p2->p_pid); > LIST_INSERT_HEAD(&allproc, p2, p_list); > allproc_gen++; >diff --git i/sys/kern/kern_prot.c w/sys/kern/kern_prot.c >index 754880bfcef..ad00e86724d 100644 >--- i/sys/kern/kern_prot.c >+++ w/sys/kern/kern_prot.c >@@ -1924,6 +1924,7 @@ cru2x(struct ucred *cr, struct xucred *xcr) > bzero(xcr, sizeof(*xcr)); > xcr->cr_version = XUCRED_VERSION; > xcr->cr_uid = cr->cr_uid; >+ xcr->cr_pid = cr->cr_pid; > > ngroups = MIN(cr->cr_ngroups, XU_NGROUPS); > xcr->cr_ngroups = ngroups; >diff --git i/sys/sys/ucred.h w/sys/sys/ucred.h >index e2e0c998bff..61456f0ccec 100644 >--- i/sys/sys/ucred.h >+++ w/sys/sys/ucred.h >@@ -69,6 +69,7 @@ struct ucred { > gid_t *cr_groups; /* groups */ > int cr_agroups; /* Available groups */ > gid_t cr_smallgroups[XU_NGROUPS]; /* storage for small groups */ >+ pid_t cr_pid; /* process id */ > }; > #define NOCRED ((struct ucred *)0) /* no credential available */ > #define FSCRED ((struct ucred *)-1) /* filesystem credential */ >@@ -88,6 +89,7 @@ struct xucred { > short cr_ngroups; /* number of groups */ > gid_t cr_groups[XU_NGROUPS]; /* groups */ > void *_cr_unused1; /* compatibility with old ucred */ >+ pid_t cr_pid; /* process id */ > }; > #define XUCRED_VERSION 0 >
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 215202
: 188271