History

vsprintf: don't use 'restricted_pointer()' when not restricting

Instead, just fall back on the new '%p' behavior which hashes the pointer. Otherwise, '%pK' - that was intended to mark a pointer as restricted - just ends up leaking pointers that a normal '%p' wouldn't leak. Which just make the whole thing pointless. I suspect we should actually get rid of '%pK' entirely, and make it just work as '%p' regardless, but this is the minimal obvious fix. People who actually use 'kptr_restrict' should weigh in on which behavior they want.

Linus Torvalds committed 8 years ago

Commit ef0010a1 parent 668533d1 file · +2 −0Browse files

Unified · Split

lib/vsprintf.c+2−0
@@ -1931,6 +1931,8 @@ char *pointer(const char *fmt, char *buf, char *end, void *ptr, · 1930 unmodified lines
19311931 return buf;
19321932 }
19331933 case 'K':
1934+ if (!kptr_restrict)
1935+ break;
19341936 return restricted_pointer(buf, end, ptr, spec);
19351937 case 'N':
19361938 return netdev_bits(buf, end, ptr, fmt);