Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

zfs_dbgmsg doesn't print valid pointers #8467

Closed
shartse opened this issue Feb 28, 2019 · 3 comments
Closed

zfs_dbgmsg doesn't print valid pointers #8467

shartse opened this issue Feb 28, 2019 · 3 comments

Comments

@shartse
Copy link
Contributor

shartse commented Feb 28, 2019

System information

Type Version/Name
Distribution Name Ubuntu
Distribution Version 18.04
Linux Kernel
Architecture x86_64
ZFS Version 0.8.0-rc3
SPL Version

Problem

There are several places where we use zfs_dbgmsg and %p to print pointers (see metaslab.c:2371:metaslab_condense() or zio.c:1887:zio_deadman_impl()). In the Linux kernel, these values "are hashed to give a unique identifier without leaking kernel addresses to user
space. On 64 bit machines the first 32 bits are zeroed." (https://www.kernel.org/doc/Documentation/printk-formats.txt)

This means the pointers aren't very useful for debugging crash dumps since you can't find the location of the struct they refer to.

It is possible to print the actual pointers using %pK ("For printing kernel pointers which should be hidden from unprivileged users") or %px ("For printing pointers when you really want to print the address").

Note that on Linux, /proc/spl/kstat/zfs/dbgmsg is world-readable (on Illumos it's root only).

Would restricting the permissions for /proc/spl/kstat/zfs/dbgmsg and then printing the actual pointers be an appealing option for people?

And if we don't want to print the actual pointers is there any benefit to continue printing the scrambled version of them?

Describe how to reproduce the problem

You can see this in the metaslab.c:2371:metaslab_condense() entries in zfsdbg_msg.

@ahrens
Copy link
Member

ahrens commented Mar 1, 2019

@behlendorf would be good to get your opinion on this.

@behlendorf
Copy link
Contributor

Would restricting the permissions for /proc/spl/kstat/zfs/dbgmsg and then printing the actual pointers be an appealing option for people?

Yes that makes sense, I definitely think we should start by updating /proc/spl/kstat/zfs/dbgmsg to only be accessible by root. At which point I think it would be reasonable to start printing the real pointers.

@shartse
Copy link
Contributor Author

shartse commented Mar 1, 2019

Sounds good. I'll keep investigating this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants