Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 94a77572 authored by qctecmdr's avatar qctecmdr Committed by Gerrit - the friendly Code Review server
Browse files

Merge "lib/vsprintf: Less restrictive hashed pointer printing"

parents 00870c0d 0585b78e
Loading
Loading
Loading
Loading
+9 −0
Original line number Diff line number Diff line
@@ -146,6 +146,15 @@ config DYNAMIC_DEBUG
	  See Documentation/admin-guide/dynamic-debug-howto.rst for additional
	  information.

config DEBUG_CONSOLE_UNHASHED_POINTERS
	bool "Display unhashed kernel pointers"
	depends on DEBUG_KERNEL
	help
	  Pointers %p and %pK are normally hashed prior to being displayed to
	  prevent leaking kernel addresses. On debug builds, always print
	  actual pointer values, ignoring the kptr_restrict setting.
	  Not to be enabled on production builds.

endmenu # "printk and dmesg options"

menu "Compile-time checks and compiler options"
+5 −1
Original line number Diff line number Diff line
@@ -1940,7 +1940,8 @@ char *pointer(const char *fmt, char *buf, char *end, void *ptr,
			return buf;
		}
	case 'K':
		if (!kptr_restrict)
		if (!kptr_restrict ||
		    IS_ENABLED(CONFIG_DEBUG_CONSOLE_UNHASHED_POINTERS))
			break;
		return restricted_pointer(buf, end, ptr, spec);
	case 'N':
@@ -1972,6 +1973,9 @@ char *pointer(const char *fmt, char *buf, char *end, void *ptr,
		return pointer_string(buf, end, ptr, spec);
	}

	if (IS_ENABLED(CONFIG_DEBUG_CONSOLE_UNHASHED_POINTERS))
		return pointer_string(buf, end, ptr, spec);

	/* default is to _not_ leak addresses, hash before printing */
	return ptr_to_id(buf, end, ptr, spec);
}