Bug 274274 - nmount logs to_path twice via ktrace()
Summary: nmount logs to_path twice via ktrace()
Status: New
Alias: None
Product: Base System
Classification: Unclassified
Component: kern (show other bugs)
Version: 13.2-STABLE
Hardware: Any Any
: --- Affects Some People
Assignee: freebsd-bugs (Nobody)
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2023-10-05 05:08 UTC by Ivan Rozhuk
Modified: 2023-10-14 00:04 UTC (History)
2 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Ivan Rozhuk 2023-10-05 05:08:39 UTC
Also order is wrong.
...
  6130 mount_nullfs CALL  nmount(0x80181f000,0x12,0<><invalid>0)
  6130 mount_nullfs NAMI  "/tmp/fbsd-12ce57e-b34e658-51d1890/rootfs/var/cache/ccache"
  6130 mount_nullfs NAMI  "/tmp/fbsd-12ce57e-b34e658-51d1890/rootfs/var/cache/ccache"
  6130 mount_nullfs NAMI  "/var/cache/ccache"
  6130 mount_nullfs RET   nmount 0
...

It should be:
...
  6130 mount_nullfs CALL  nmount(0x80181f000,0x12,0<><invalid>0)
  6130 mount_nullfs NAMI  "/var/cache/ccache"
  6130 mount_nullfs NAMI  "/tmp/fbsd-12ce57e-b34e658-51d1890/rootfs/var/cache/ccache"
  6130 mount_nullfs RET   nmount 0
...
Comment 1 Ivan Rozhuk 2023-10-05 05:15:00 UTC
unmount does not log NAMEI:
...
 55953 umount   CALL  unmount(0x7fffffffc770,0x8080000<MNT_ACLS|MNT_FORCE>)
 55953 umount   RET   unmount 0
 55953 umount   CALL  exit(0)
Comment 2 Ed Maste freebsd_committer freebsd_triage 2023-10-05 13:08:34 UTC
Note that ktrace is documented to list namei translations performed by the process(es), not syscall arguments. In the mount_nullfs case those are the namei operations that the kernel performed due to the nmount syscall, in the order that it performed them.

unmount may not log a name translation because it may not perform one:

> If the MNT_BYFSID flag is specified, dir should instead be a file system
> ID encoded as “FSID:val0:val1”, where val0 and val1 are the contents of
> the fsid_t val[] array in decimal.  The file system that has the
> specified file system ID will be unmounted.

It may be that the ktrace(1) man page needs a note to make it clear that namei operations do not necessarily correspond directly to syscall path arguments.
Comment 3 Ivan Rozhuk 2023-10-05 20:21:00 UTC
(In reply to Ed Maste from comment #2)
> It may be that the ktrace(1) man page needs a note to make it clear that namei operations do not necessarily correspond directly to syscall path arguments.

Ok, thanks.
Closing with Work as intended?

Probably better to drop whole ktrace in future, there is to many limitations.
May be some dtrace / utrace staff can replace it.
Comment 4 Ed Maste freebsd_committer freebsd_triage 2023-10-09 21:06:22 UTC
> Closing with Work as intended?

I would like to have a man page update for ktrace under this PR.
Comment 5 Ivan Rozhuk 2023-10-11 01:14:09 UTC
(In reply to Ed Maste from comment #4)

Man contains "kern.ktrace.geniosize" but sysctl know only "kern.ktrace.genio_size".
Comment 6 commit-hook freebsd_committer freebsd_triage 2023-10-11 01:24:45 UTC
A commit in branch main references this bug:

URL: https://cgit.FreeBSD.org/src/commit/?id=a572dfa1bfe00cec93b27d8848ca49562cab5e3c

commit a572dfa1bfe00cec93b27d8848ca49562cab5e3c
Author:     Ed Maste <emaste@FreeBSD.org>
AuthorDate: 2023-10-11 01:18:36 +0000
Commit:     Ed Maste <emaste@FreeBSD.org>
CommitDate: 2023-10-11 01:23:02 +0000

    ktrace.2: correct kern.ktrace.genio_size sysctl name

    The man page had `kern.ktrace.geniosize` but the sysctl node contains an
    underscore.

    PR:             274274
    Reported by:    Ivan Rozhuk
    Sponsored by:   The FreeBSD Foundation

 lib/libc/sys/ktrace.2 | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
Comment 7 commit-hook freebsd_committer freebsd_triage 2023-10-13 15:44:43 UTC
A commit in branch stable/14 references this bug:

URL: https://cgit.FreeBSD.org/src/commit/?id=2fe06dda0a8abced5851188ed2cb76d1759efa19

commit 2fe06dda0a8abced5851188ed2cb76d1759efa19
Author:     Ed Maste <emaste@FreeBSD.org>
AuthorDate: 2023-10-11 01:18:36 +0000
Commit:     Ed Maste <emaste@FreeBSD.org>
CommitDate: 2023-10-13 14:12:34 +0000

    ktrace.2: correct kern.ktrace.genio_size sysctl name

    The man page had `kern.ktrace.geniosize` but the sysctl node contains an
    underscore.

    PR:             274274
    Reported by:    Ivan Rozhuk
    Sponsored by:   The FreeBSD Foundation

    (cherry picked from commit a572dfa1bfe00cec93b27d8848ca49562cab5e3c)

 lib/libc/sys/ktrace.2 | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
Comment 8 commit-hook freebsd_committer freebsd_triage 2023-10-13 17:29:05 UTC
A commit in branch stable/13 references this bug:

URL: https://cgit.FreeBSD.org/src/commit/?id=311657cbc15065af206ffdad18562f9f9e4b5298

commit 311657cbc15065af206ffdad18562f9f9e4b5298
Author:     Ed Maste <emaste@FreeBSD.org>
AuthorDate: 2023-10-11 01:18:36 +0000
Commit:     Ed Maste <emaste@FreeBSD.org>
CommitDate: 2023-10-13 17:27:03 +0000

    ktrace.2: correct kern.ktrace.genio_size sysctl name

    The man page had `kern.ktrace.geniosize` but the sysctl node contains an
    underscore.

    PR:             274274
    Reported by:    Ivan Rozhuk
    Sponsored by:   The FreeBSD Foundation

    (cherry picked from commit a572dfa1bfe00cec93b27d8848ca49562cab5e3c)
    (cherry picked from commit 2fe06dda0a8abced5851188ed2cb76d1759efa19)

 lib/libc/sys/ktrace.2 | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
Comment 9 commit-hook freebsd_committer freebsd_triage 2023-10-14 00:04:25 UTC
A commit in branch releng/14.0 references this bug:

URL: https://cgit.FreeBSD.org/src/commit/?id=6519ec6fbab50d2b24372b3b3692db18d28a5fa3

commit 6519ec6fbab50d2b24372b3b3692db18d28a5fa3
Author:     Ed Maste <emaste@FreeBSD.org>
AuthorDate: 2023-10-11 01:18:36 +0000
Commit:     Ed Maste <emaste@FreeBSD.org>
CommitDate: 2023-10-13 23:18:04 +0000

    ktrace.2: correct kern.ktrace.genio_size sysctl name

    The man page had `kern.ktrace.geniosize` but the sysctl node contains an
    underscore.

    PR:             274274
    Reported by:    Ivan Rozhuk
    Sponsored by:   The FreeBSD Foundation

    (cherry picked from commit a572dfa1bfe00cec93b27d8848ca49562cab5e3c)
    (cherry picked from commit 2fe06dda0a8abced5851188ed2cb76d1759efa19)

    Approved by:    re (gjb)

 lib/libc/sys/ktrace.2 | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)