tech-toolchain archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: Fixing $ORGIN RPATHs - at least some of them



On 06.11.2017 23:21, Christos Zoulas wrote:
> In article <20171106141651.GA24822%britannica.bec.de@localhost>,
> Joerg Sonnenberger  <joerg%bec.de@localhost> wrote:
>> On Mon, Nov 06, 2017 at 08:21:24AM -0500, Christos Zoulas wrote:
>>> There is no try harder, which is what I am trying to explain. All 3 methods
>>> are doing exactly the same thing. This is the problem we have; the only way
>>> to get back from a vnode to a path is by using the reverse namei cache.
>>
>> The point is that no reversing of the namei cache *should* be done here.
>> The full path should be computed as side effect of the original exec
>> look up.
> 
> We already do a getcwd to find the path in the non absolute case in exec.
> The resulting path is not normalized, but it is absolute (good enough for
> now). I propose to add p->p_path in struct proc, and cleanup the rest of
> the places to use it:
> 
> http://www.netbsd.org/~christos/p_path.diff
> 
> I have not even compiled this, but I will do so and test if there are
> no objections. This means that we always set AT_SUN_PATHNAME in the auxv
> (for binaries that have Auxv) and we can always use sysctl to get the
> pathname for the process).
> 
> christos
> 

Looks good! One question regarding fill_pathname().

RCS file: /cvsroot/src/sys/kern/kern_proc.c,v
retrieving revision 1.207
diff -u -p -r1.207 kern_proc.c
--- kern/kern_proc.c	28 Aug 2017 00:46:07 -0000	1.207
+++ kern/kern_proc.c	6 Nov 2017 22:09:31 -0000
@@ -2433,41 +2433,29 @@ proc_find_locked(struct lwp *l, struct p
 static int
 fill_pathname(struct lwp *l, pid_t pid, void *oldp, size_t *oldlenp)
 {
-#ifndef _RUMPKERNEL
 	int error;
 	struct proc *p;
-	char *path;
 	size_t len;

 	if ((error = proc_find_locked(l, &p, pid)) != 0)
 		return error;

-	if (p->p_textvp == NULL) {
+	if (p->p_path == NULL) { /// <- Can we change it to KASSERT()?
 		if (pid != -1)
 			mutex_exit(p->p_lock);
 		return ENOENT;
 	}



Attachment: signature.asc
Description: OpenPGP digital signature



Home | Main Index | Thread Index | Old Index