cgroup: Use %p for pointer formatting
PATCH 1/1 cgroup: Use %p for pointer formatting
Since commit ad67b74d2469d ("printk: hash addresses printed with %p") pointers are hashed by default and the behaviour can be controller by `hash_pointers' boot argument.
Removing %pK makes it possible to remove its handling from the library. The policy on %p is to not introduce new ones.
Since this looks vital to the debugging of cgroups, keep the pointer output.
Use %p instead %pK.
--- kernel/cgroup/debug.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)
kernel/cgroup/debug.c +4 -4
@@ -51,7 +51,7 @@ static int current_css_set_read(struct seq_file *seq, void *v)spin_lock_irq (&css_set_lock); cset =task_css_set (current); refcnt =refcount_read (&cset->refcount); -seq_printf (seq,"css_set %pK %d" , cset, refcnt); +seq_printf (seq,"css_set %p %d" , cset, refcnt);if (refcnt > cset->nr_tasks)seq_printf (seq," +%d" , refcnt - cset->nr_tasks);seq_puts (seq,"\n" );
@@ -125,10 +125,10 @@ static int cgroup_css_links_read(struct seq_file *seq, void *v)* Print out the proc_cset and threaded_cset relationship * and highlight difference between refcount and task_count. */ -seq_printf (seq,"css_set %pK" , cset); +seq_printf (seq,"css_set %p" , cset);if (rcu_dereference_protected (cset->dom_cset,1 ) != cset) { threaded_csets++; -seq_printf (seq,"=>%pK" , cset->dom_cset); +seq_printf (seq,"=>%p" , cset->dom_cset); }if (!list_empty (&cset->threaded_csets)) {struct css_set *tcset;
@@ -137,7 +137,7 @@ static int cgroup_css_links_read(struct seq_file *seq, void *v)list_for_each_entry (tcset, &cset->threaded_csets, threaded_csets_node) {seq_puts (seq, idx ?"," :"<=" ); -seq_printf (seq,"%pK" , tcset); +seq_printf (seq,"%p" , tcset); idx++; } }else {
Signature · 1 line
2.55.0
Quoted 4 lines · Sebastian Andrzej Siewior
Since commit
ad67b74d2469d("printk: hash addresses printed with %p") pointers are hashed by default and the behaviour can be controller by `hash_pointers' boot argument.
The policy on %p is to not introduce new ones.
%pK should be here?
I assume it based on:
| This is because %pK checks are done at read() time rather than open() | ... | The correct long-term solution is to do the permission checks at | open() time.
of Documentation/admin-guide/sysctl/kernel.rst-time
<snip>
Quoted 1 line
Removing %pK makes it possible to remove its handling from the library.
This is also a good sell.
But I see there are a few of them still here and there.
Quoted 6 lines
Signed-off-by Sebastian Andrzej Siewior <[email protected]>--- kernel/cgroup/debug.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)
Nevertheless,
Quoted 6 lines · Michal Koutný
Quoted 4 lines · Sebastian Andrzej Siewior
Since commit
ad67b74d2469d("printk: hash addresses printed with %p") pointers are hashed by default and the behaviour can be controller by `hash_pointers' boot argument.
The policy on %p is to not introduce new ones.%pK should be here?
No, %p was intended. By making it %p it is "introducing" it. The "not introducing new ones" is based on
https://docs.kernel.org/process/deprecated.html#p-format-specifier
Quoted 8 lines
I assume it based on:
| This is because %pK checks are done at read() time rather than open() | ... | The correct long-term solution is to do the permission checks at | open() time.of
Documentation/admin-guide/sysctl/kernel.rst-time
These checks never came. I need to update that file as well…
Quoted 5 lines
<snip>
Quoted 1 line
Removing %pK makes it possible to remove its handling from the library.
This is also a good sell.
But I see there are a few of them still here and there.
I am working on it ;) I just sent all code patches and networking has it applied in -next. So it is moving.
Quoted 9 lines
Quoted 6 lines
Signed-off-by Sebastian Andrzej Siewior <[email protected]>--- kernel/cgroup/debug.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)Nevertheless,
Acked-by Michal Koutný <[email protected]>
Thank you.
Sebastian
Hello,
Applied to cgroup/for-7.4 with the description reworked to spell out the policy exception and what changes under kptr_restrict.
Thanks.
--
tejun