Page MenuHomeFreeBSD

Implement PTRACE_O_TRACESYSGOOD
ClosedPublic

Authored by trasz on May 8 2019, 1:25 PM.

Details

Summary

Implement PTRACE_O_TRACESYSGOOD. This makes Linux strace(1) work.

Diff Detail

Repository
rS FreeBSD src repository
Lint
Automatic diff as part of commit; lint not applicable.
Unit
Automatic diff as part of commit; unit tests not applicable.

Event Timeline

trasz created this revision.May 8 2019, 1:25 PM
dchagin added inline comments.May 12 2019, 5:24 PM
sys/amd64/linux/linux_ptrace.c
115 ↗(On Diff #57180)

used from MI code, and in my understandig can be MI too,
after you finish we can reuse it and implement the rest

323 ↗(On Diff #57180)

btw, in the Linuxulator we have linux_msg() :)
again, up to you

sys/compat/linux/linux_emul.h
35 ↗(On Diff #57180)

I prefer to include imgact.h in the linux_ptrace.c, again, up to you

sys/compat/linux/linux_misc.c
1019 ↗(On Diff #57180)

it will break i386, arm64 Linuxulators

sys/compat/linux/linux_misc.h
152 ↗(On Diff #57180)

only for amd64?

trasz added inline comments.May 14 2019, 2:05 PM
sys/amd64/linux/linux_ptrace.c
115 ↗(On Diff #57180)

Could be, but it depends on kern_ptrace(), and a Linux-specific ptrace flag.

How about leaving it here, and just wrapping the call (below) with #ifdef amd64?

323 ↗(On Diff #57180)

Good point; I'll change all the printfs here to linux_msg() in a future commit.

sys/compat/linux/linux_emul.h
35 ↗(On Diff #57180)

Thing is, we don't need the entire imgact.h there - it's just a compilation fix.

sys/compat/linux/linux_misc.h
152 ↗(On Diff #57180)

Yeah. I don't see much point in working on 32 bit ptrace; I'm not even sure if CentOS folks still distribute 32 bit strace(1) binary.

trasz updated this revision to Diff 57398.May 14 2019, 8:44 PM

Ifdef out the thing.

dchagin accepted this revision.May 15 2019, 5:07 AM
dchagin added inline comments.
sys/compat/linux/linux_misc.h
152 ↗(On Diff #57180)

I mean one more #ifdef amd64 )

This revision is now accepted and ready to land.May 15 2019, 5:07 AM
trasz updated this revision to Diff 57416.May 15 2019, 6:00 PM

One more ifdef, per dchagin's suggestion.

This revision now requires review to proceed.May 15 2019, 6:00 PM
dchagin accepted this revision.May 16 2019, 7:32 AM
This revision is now accepted and ready to land.May 16 2019, 7:32 AM

Okay, there's still something wrong. While "kldload linux64" works, the "kldload linux" doesn't due to "link_elf_obj: symbol linux_ptrace_status undefined" error.

trasz updated this revision to Diff 57443.May 16 2019, 11:53 AM

Even more better ifdefs.

This revision now requires review to proceed.May 16 2019, 11:53 AM
dchagin accepted this revision.May 16 2019, 1:31 PM

:)
as I already say, moving linux_ptrace_status() to MI (linux_util.c or linux.c) solves you problem with ifdefs )

This revision is now accepted and ready to land.May 16 2019, 1:31 PM

more betterer is good

This revision was automatically updated to reflect the committed changes.