Bug 157234 - [patch] nullfs(5): //proc/curproc/file returns "unknown" with a binary called via a nullfs mountpoint
Summary: [patch] nullfs(5): //proc/curproc/file returns "unknown" with a binary called...
Status: Open
Alias: None
Product: Documentation
Classification: Unclassified
Component: Manual Pages (show other bugs)
Version: Latest
Hardware: Any Any
: Normal Affects Only Me
Assignee: freebsd-bugs (Nobody)
URL:
Keywords: patch
Depends on:
Blocks:
 
Reported: 2011-05-21 12:20 UTC by patfbsd
Modified: 2020-09-01 00:36 UTC (History)
1 user (show)

See Also:


Attachments
nullfs.5.patch (554 bytes, patch)
2011-05-21 14:34 UTC, patfbsd
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description patfbsd 2011-05-21 12:20:08 UTC
Hello,

I use a nullfs mount /journal/usrlocal in /usr/local :

mount:
/dev/ada0s2e.journal on /journal (ufs, asynchronous, local, gjournal)
procfs on /proc (procfs, local)
/journal/usrlocal on /usr/local (nullfs, local)

/proc/curproc/file returns "unknown" with a binary called via a nullfs mountpoint, but not if called directly.

test program (test.c)
#include <stdio.h>
#include <unistd.h>
#include <errno.h>

main() {

  ssize_t n = 0;
  char link[1024];

  n = readlink("/proc/curproc/file", link, 1024);
  if (n == -1) {
    printf("error : %d\n", errno);
  } else {
    printf("file = %s\n", link);
  }
}

build and copy "test" binary into /usr/local/bin

$ /journal/usrlocal/bin/test
file = /journal/usrlocal/bin/test

$ /usr/local/bin/test
file = unknown

This prevents me to run java (it uses curproc file to find where are its libraries)

Thanks, regards.

How-To-Repeat: See above
Comment 1 patfbsd 2011-05-21 14:34:18 UTC
Le Sat, 21 May 2011 11:18:00 GMT,
Patrick Lamaiziere <patfbsd@davenulle.org> a écrit :

> /proc/curproc/file returns "unknown" with a binary called via a
> nullfs mountpoint, but not if called directly.

Well, i've looked a bit the procfs code and this behavior seems
more or less intented by the function vn_fullpath(9).

procstat(1) is affected too : procstat: sysctl: kern.proc.pathname:
2265: No such file or directory

So it looks to be a limitation instead of a bug.

I would like to suggest to reclassify this PR into the doc section and
the attached patch to document the nulls manual page (as usual feel
free to change the text as english is not my natural language).

Thanks, regards
Comment 2 Mark Linimon freebsd_committer freebsd_triage 2011-05-21 23:50:16 UTC
Responsible Changed
From-To: freebsd-bugs->freebsd-doc

Reclassify at submitter request.
Comment 3 Eitan Adler freebsd_committer freebsd_triage 2012-05-06 21:18:33 UTC
Responsible Changed
From-To: freebsd-doc->eadler

I'll take it.
Comment 4 Eitan Adler freebsd_committer freebsd_triage 2012-09-02 18:06:02 UTC
Responsible Changed
From-To: eadler->freebsd-bugs

I won't be looking at this PR for a while and I need to clear some out 
of my queue
Comment 5 Mark Linimon freebsd_committer freebsd_triage 2020-09-01 00:36:58 UTC
^Triage: reset inaccurate In Progress state.