Dtrace shows "invalid addres" errors on 12.0-RELEASE on Thinkpad T480

Bojan Petrović

New Member

Reaction score: 8
Messages: 13

Hi,

I'm having issues using dtrace(1) on a Lenovo Thinkpad T480, even when using an official USB image of FreeBSD 12.0 RELEASE.

Here's a log demonstrating this issue on a FreeBSD-12.0-RELEASE-amd64-memstick.img. I'm tracing the openat(2) syscall. I run dtrace in one console, and then try to log in in another:

Code:
root@:/tmp # uname -a
FreeBSD  12.0-RELEASE FreeBSD 12.0-RELEASE r341666 GENERIC  amd64
root@:/tmp # dtrace -n 'syscall::openat:entry {print(copyinstr(arg1));}'
dtrace: description 'syscall::openat:entry ' matched 2 probes
dtrace: error on enabled probe ID 1 (ID 64761: syscall:freebsd:openat:entry): invalid address (0x8002076a3) in action #1 at DIF offset 12
dtrace: error on enabled probe ID 1 (ID 64761: syscall:freebsd:openat:entry): invalid address (0x80020798d) in action #1 at DIF offset 12
dtrace: error on enabled probe ID 1 (ID 64761: syscall:freebsd:openat:entry): invalid address (0x800230000) in action #1 at DIF offset 12
dtrace: error on enabled probe ID 1 (ID 64761: syscall:freebsd:openat:entry): invalid address (0x800230000) in action #1 at DIF offset 12
dtrace: error on enabled probe ID 1 (ID 64761: syscall:freebsd:openat:entry): invalid address (0x800230000) in action #1 at DIF offset 12
dtrace: error on enabled probe ID 1 (ID 64761: syscall:freebsd:openat:entry): invalid address (0x800230000) in action #1 at DIF offset 12
dtrace: error on enabled probe ID 1 (ID 64761: syscall:freebsd:openat:entry): invalid address (0x800230000) in action #1 at DIF offset 12
dtrace: error on enabled probe ID 1 (ID 64761: syscall:freebsd:openat:entry): invalid address (0x800230000) in action #1 at DIF offset 12
dtrace: error on enabled probe ID 1 (ID 64761: syscall:freebsd:openat:entry): invalid address (0x7fffffffe0a0) in action #1 at DIF offset 12
dtrace: error on enabled probe ID 1 (ID 64761: syscall:freebsd:openat:entry): invalid address (0x7fffffffdbd0) in action #1 at DIF offset 12
dtrace: error on enabled probe ID 1 (ID 64761: syscall:freebsd:openat:entry): invalid address (0x800230000) in action #1 at DIF offset 12
dtrace: error on enabled probe ID 1 (ID 64761: syscall:freebsd:openat:entry): invalid address (0x800230000) in action #1 at DIF offset 12
dtrace: error on enabled probe ID 1 (ID 64761: syscall:freebsd:openat:entry): invalid address (0x800230000) in action #1 at DIF offset 12
dtrace: error on enabled probe ID 1 (ID 64761: syscall:freebsd:openat:entry): invalid address (0x7fffffffdbd0) in action #1 at DIF offset 12
dtrace: error on enabled probe ID 1 (ID 64761: syscall:freebsd:openat:entry): invalid address (0x7fffffffdbd0) in action #1 at DIF offset 12
dtrace: error on enabled probe ID 1 (ID 64761: syscall:freebsd:openat:entry): invalid address (0x800230000) in action #1 at DIF offset 12
dtrace: error on enabled probe ID 1 (ID 64761: syscall:freebsd:openat:entry): invalid address (0x800230000) in action #1 at DIF offset 12
dtrace: error on enabled probe ID 1 (ID 64761: syscall:freebsd:openat:entry): invalid address (0x800230000) in action #1 at DIF offset 12
dtrace: error on enabled probe ID 1 (ID 64761: syscall:freebsd:openat:entry): invalid address (0x7fffffffe0a0) in action #1 at DIF offset 12
dtrace: error on enabled probe ID 1 (ID 64761: syscall:freebsd:openat:entry): invalid address (0x7fffffffe0a0) in action #1 at DIF offset 12
dtrace: error on enabled probe ID 1 (ID 64761: syscall:freebsd:openat:entry): invalid address (0x7fffffffdbd0) in action #1 at DIF offset 12
dtrace: error on enabled probe ID 1 (ID 64761: syscall:freebsd:openat:entry): invalid address (0x7fffffffdbd0) in action #1 at DIF offset 12
dtrace: error on enabled probe ID 1 (ID 64761: syscall:freebsd:openat:entry): invalid address (0x7fffffffdbd0) in action #1 at DIF offset 12
dtrace: error on enabled probe ID 1 (ID 64761: syscall:freebsd:openat:entry): invalid address (0x7fffffffdbd0) in action #1 at DIF offset 12

Below is the expected output which I can get when running
  • FreeBSD-11.2-RELEASE-amd64-memstick.img on the same laptop
  • FreeBSD-12.0-RELEASE-amd64-disc1.iso inside VirtualBox

Code:
root@:/tmp # uname -a
FreeBSD  11.2-RELEASE FreeBSD 11.2-RELEASE #0 r335510: Fri Jun 22 04:32:14 UTC 2018     root@releng2.nyi.freebsd.org:/usr/obj/usr/src/sys/GENERIC  amd64
root@:/tmp # dtrace -n 'syscall::openat:entry {print(copyinstr(arg1));}'
dtrace: description 'syscall::openat:entry ' matched 2 probes
CPU     ID                    FUNCTION:NAME
  2  63026                     openat:entry string "/etc/libmap.conf"

  2  63026                     openat:entry string "/var/run/ld-elf.so.hints"

  2  63026                     openat:entry string "/lib/libutil.so.9"

  2  63026                     openat:entry string "/usr/lib/libpam.so.6"

  2  63026                     openat:entry string "/usr/lib/libbsm.so.3"

  2  63026                     openat:entry string "/lib/libc.so.7"

  2  63026                     openat:entry string "/usr/lib/pam_self.so.6"

  2  63026                     openat:entry string "/usr/lib/pam_opie.so.6"

  2  63026                     openat:entry string "/usr/lib/libopie.so.8"

  2  63026                     openat:entry string "/lib/libmd.so.6"

  2  63026                     openat:entry string "/usr/lib/pam_opieaccess.so.6"

  2  63026                     openat:entry string "/usr/lib/pam_unix.so.6"

  2  63026                     openat:entry string "/lib/libcrypt.so.5"

  2  63026                     openat:entry string "/usr/lib/libypclnt.so.4"

  2  63026                     openat:entry string "/usr/lib/pam_securetty.so.6"

  2  63026                     openat:entry string "/usr/lib/pam_nologin.so.6"

  2  63026                     openat:entry string "/usr/lib/pam_login_access.so.6"

  2  63026                     openat:entry string "/usr/lib/pam_unix.so.6"

  2  63026                     openat:entry string "/usr/lib/pam_lastlog.so.6"

  2  63026                     openat:entry string "/usr/lib/pam_unix.so.6"

Should I direct this question to freebsd-dtrace mailing list, or maybe file a bug report?

Regards,
Bojan
 
OP
B

Bojan Petrović

New Member

Reaction score: 8
Messages: 13

The suggestion from DTrace user guide to defer copyinstr to the return of the function does not solve the issue.

The following command also produces "invalid address" errors:

Code:
dtrace -n 'syscall::openat:entry {self->file=arg1;}' \
       -n 'syscall::openat:return { print(copyinstr(self->file)); self->file=0;}'
 
OP
B

Bojan Petrović

New Member

Reaction score: 8
Messages: 13

After bisecting the kernel, I think the issue is related to commit r336876 ("Use SMAP on amd64") , mentioned in PR 230993 and PR 230460.

It seems to be resolved in the CURRENT and 12-STABLE, possibly in r342053 ("fix userspace access on boxes with SMAP") (didn't test).

If anyone is running a 12.0-RELEASE, the issue can be circumvented by disabling SMAP: add hw.cpu_stdext_disable=0x00100000 to /boot/loader.conf
 

Nicola Mingotti

Well-Known Member

Reaction score: 201
Messages: 494

Hi,
Should I direct this question to freebsd-dtrace mailing list, or maybe file a bug report?

Regards,
Bojan

Hi Bojan Petrović , since your question is very specific, and nobody still was able to tell you something, I guess it is better to go to the proper mailing list.

I don't know still dtrace so I can't say if that is a bug, If you are confident it could be a bug post on FreeBSD Bugzilla.

According to my past experiences you will get prompt answer either on mailing list or the bug platform.

bye
n.
 
OP
B

Bojan Petrović

New Member

Reaction score: 8
Messages: 13

Hi Nicola,

Thanks for your advice. I somehow went into investigation assuming that the issue is still present on CURRENT, but I was mistaken.

Regards,
Bojan
 
Top