high_memory address in /proc/dri/*/vma
[Re-sent to the right address, I hope.]
Kees, in commit 01e2f533a234dc62d16c0d3d4fb9d71cf1ce50c3 ("drm: do not leak kernel addresses via /proc/dri/*/vma") you changed the logging of high_memory:
- seq_printf(m, "vma use count: %d, high_memory = %p, 0x%08llx\n",
+ seq_printf(m, "vma use count: %d, high_memory = %pK, 0x%pK\n",
atomic_read(&dev->vma_count),
- high_memory, (u64)virt_to_phys(high_memory));
+ high_memory, (void *)virt_to_phys(high_memory));
This doesn't make sense because the physical address may be truncated (in theory at least).
I think it would make more sense to make this entire file readable by root only, but I don't know whether anything depends on being able to read it. Its existence is conditional on DRM_DEBUG_CODE != 0 but that is always true at the moment.
Ben.
Signature · 2 lines
Ben Hutchings Humans are not rational beings; they are rationalising beings.
Quoted 4 lines · Ben Hutchings
Kees, in commit
01e2f533a234dc62d16c0d3d4fb9d71cf1ce50c3("drm: do not leak kernel addresses via/proc/dri/*/vma") you changed the logging ofhigh_memory:
Quoted 8 lines
- seq_printf(m, "vma use count: %d,
high_memory= %p, 0x%08llx\n",
+ seq_printf(m, "vma use count: %d,high_memory= %pK, 0x%pK\n",atomic_read(&dev->vma_count),
- high_memory, (u64)virt_to_phys(high_memory));
+ high_memory, (void *)virt_to_phys(high_memory));This doesn't make sense because the physical address may be truncated (in theory at least).
Leaking even a truncated address is still a problem, IMO. Or do you mean there is some side-effect causing a problem?
Quoted 4 lines
I think it would make more sense to make this entire file readable by root only, but I don't know whether anything depends on being able to read it. Its existence is conditional on
DRM_DEBUG_CODE!= 0 but that is always true at the moment.
The kptr_restrict syscall (that controls %pK behavior) has 3 modes, including one that hides these values even from the root user, so I would prefer this stays as-is.
Sorry I'm being dense, but what problem is %pK causing here? I'd be happy to help get it fixed.
-Kees
Signature · 2 lines
Kees Cook ChromeOS Security
Quoted 11 lines · Kees Cook
Quoted 10 lines · Ben Hutchings
Kees, in commit
01e2f533a234dc62d16c0d3d4fb9d71cf1ce50c3("drm: do not leak kernel addresses via/proc/dri/*/vma") you changed the logging ofhigh_memory:(quoted diff) +2
-2- seq_printf(m, "vma use count: %d, high_memory = %p, 0x%08llx\n", + seq_printf(m, "vma use count: %d, high_memory = %pK, 0x%pK\n", atomic_read(&dev->vma_count), - high_memory, (u64)virt_to_phys(high_memory)); + high_memory, (void *)virt_to_phys(high_memory));
Quoted 5 lines
Quoted 2 lines
This doesn't make sense because the physical address may be truncated (in theory at least).
Leaking even a truncated address is still a problem, IMO. Or do you mean there is some side-effect causing a problem?
I mean that this the conversion to void * can be a narrowing conversion, so when printing of kernel pointers is enabled the full physical address may not be displayed.
Quoted 11 lines
Quoted 4 lines
I think it would make more sense to make this entire file readable by root only, but I don't know whether anything depends on being able to read it. Its existence is conditional on
DRM_DEBUG_CODE!= 0 but that is always true at the moment.The
kptr_restrictsyscall (that controls %pK behavior) has 3 modes, including one that hides these values even from the root user, so I would prefer this stays as-is.Sorry I'm being dense, but what problem is %pK causing here? I'd be happy to help get it fixed.
The problem is that it is not suitable for printing physical addresses, because they are not pointers.
Ben.
Signature · 2 lines
Ben Hutchings Humans are not rational beings; they are rationalising beings.
_______________________________________________
dri-devel mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/dri-devel
Quoted 15 lines · Ben Hutchings
Quoted 14 lines · Kees Cook
Quoted 12 lines · Ben Hutchings
Kees, in commit
01e2f533a234dc62d16c0d3d4fb9d71cf1ce50c3("drm: do not leak kernel addresses via/proc/dri/*/vma") you changed the logging ofhigh_memory:- seq_printf(m, "vma use count: %d,
high_memory= %p, 0x%08llx\n",
+ seq_printf(m, "vma use count: %d,high_memory= %pK, 0x%pK\n",atomic_read(&dev->vma_count),
- high_memory, (u64)virt_to_phys(high_memory));
+ high_memory, (void *)virt_to_phys(high_memory));This doesn't make sense because the physical address may be truncated (in theory at least).
Quoted 6 lines
Quoted 2 lines
Leaking even a truncated address is still a problem, IMO. Or do you mean there is some side-effect causing a problem?
I mean that this the conversion to void * can be a narrowing conversion, so when printing of kernel pointers is enabled the full physical address may not be displayed.
Ah-ha, okay, I see what you mean now. This is, as you say, only a problem "in theory". Is it worth fixing currently? If so, we probably need to add the "K" option to %x in some fashion.
-Kees
Signature · 2 lines
Kees Cook ChromeOS Security
Quoted 19 lines · Kees Cook
Quoted 18 lines · Ben Hutchings
Quoted 16 lines · Kees Cook
Quoted 10 lines · Ben Hutchings
Kees, in commit
01e2f533a234dc62d16c0d3d4fb9d71cf1ce50c3("drm: do not leak kernel addresses via/proc/dri/*/vma") you changed the logging ofhigh_memory:(quoted diff) +2
-2- seq_printf(m, "vma use count: %d, high_memory = %p, 0x%08llx\n", + seq_printf(m, "vma use count: %d, high_memory = %pK, 0x%pK\n", atomic_read(&dev->vma_count), - high_memory, (u64)virt_to_phys(high_memory)); + high_memory, (void *)virt_to_phys(high_memory));Quoted 2 lines
This doesn't make sense because the physical address may be truncated (in theory at least).
Leaking even a truncated address is still a problem, IMO. Or do you mean there is some side-effect causing a problem?
Quoted 6 lines
Quoted 3 lines
I mean that this the conversion to void * can be a narrowing conversion, so when printing of kernel pointers is enabled the full physical address may not be displayed.
Ah-ha, okay, I see what you mean now. This is, as you say, only a problem "in theory". Is it worth fixing currently?
I don't know.
Quoted 1 line
If so, we probably need to add the "K" option to %x in some fashion.
Something like that, yes.
Ben.
Signature · 2 lines
Ben Hutchings Humans are not rational beings; they are rationalising beings.
_______________________________________________
dri-devel mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/dri-devel
Quoted 12 lines · Ben Hutchings
[Re-sent to the right address, I hope.]
Kees, in commit
01e2f533a234dc62d16c0d3d4fb9d71cf1ce50c3("drm: do not leak kernel addresses via/proc/dri/*/vma") you changed the logging ofhigh_memory:(quoted diff) +2
-2- seq_printf(m, "vma use count: %d, high_memory = %p, 0x%08llx\n", + seq_printf(m, "vma use count: %d, high_memory = %pK, 0x%pK\n", atomic_read(&dev->vma_count), - high_memory, (u64)virt_to_phys(high_memory)); + high_memory, (void *)virt_to_phys(high_memory));
Quoted 7 lines
This doesn't make sense because the physical address may be truncated (in theory at least).
I think it would make more sense to make this entire file readable by root only, but I don't know whether anything depends on being able to read it. Its existence is conditional on
DRM_DEBUG_CODE!= 0 but that is always true at the moment.
Afaik (and I've done quite some code history checking) the proc files are not relied upon by userspace (up to about 10 years back). Patch to kill them all is pending and should hit either 3.3 or 3.4.
-Daniel
Signature · 3 lines
Daniel Vetter Mail: [email protected] Mobile: +41 (0)79 365 57 48
Quoted 16 lines · Daniel Vetter
Quoted 15 lines · Ben Hutchings
[Re-sent to the right address, I hope.]
Kees, in commit
01e2f533a234dc62d16c0d3d4fb9d71cf1ce50c3("drm: do not leak kernel addresses via/proc/dri/*/vma") you changed the logging ofhigh_memory:- seq_printf(m, "vma use count: %d,
high_memory= %p, 0x%08llx\n",
+ seq_printf(m, "vma use count: %d,high_memory= %pK, 0x%pK\n",atomic_read(&dev->vma_count),
- high_memory, (u64)virt_to_phys(high_memory));
+ high_memory, (void *)virt_to_phys(high_memory));This doesn't make sense because the physical address may be truncated (in theory at least).
Quoted 8 lines
Quoted 4 lines
I think it would make more sense to make this entire file readable by root only, but I don't know whether anything depends on being able to read it. Its existence is conditional on
DRM_DEBUG_CODE!= 0 but that is always true at the moment.Afaik (and I've done quite some code history checking) the proc files are not relied upon by userspace (up to about 10 years back). Patch to kill them all is pending and should hit either 3.3 or 3.4.
That works too. :)
Signature · 2 lines
Kees Cook ChromeOS Security
Quoted 16 lines · Daniel Vetter
Quoted 15 lines · Ben Hutchings
[Re-sent to the right address, I hope.]
Kees, in commit
01e2f533a234dc62d16c0d3d4fb9d71cf1ce50c3("drm: do not leak kernel addresses via/proc/dri/*/vma") you changed the logging ofhigh_memory:(quoted diff) +2
-2- seq_printf(m, "vma use count: %d, high_memory = %p, 0x%08llx\n", + seq_printf(m, "vma use count: %d, high_memory = %pK, 0x%pK\n", atomic_read(&dev->vma_count), - high_memory, (u64)virt_to_phys(high_memory)); + high_memory, (void *)virt_to_phys(high_memory));This doesn't make sense because the physical address may be truncated (in theory at least).
Quoted 8 lines
Quoted 4 lines
I think it would make more sense to make this entire file readable by root only, but I don't know whether anything depends on being able to read it. Its existence is conditional on
DRM_DEBUG_CODE!= 0 but that is always true at the moment.Afaik (and I've done quite some code history checking) the proc files are not relied upon by userspace (up to about 10 years back). Patch to kill them all is pending and should hit either 3.3 or 3.4.
Great, that'll be one more warning gone. :-)
Ben.
Signature · 3 lines
Ben Hutchings
We get into the habit of living before acquiring the habit of thinking.
- Albert Camus