Thread (4 messages) 4 messages, 4 authors, 2022-03-22

Re: [PATCH 1/1 module-next] kallsyms: enhance %pS/s/b printing when KALLSYSMS is disabled

From: Sergey Senozhatsky <senozhatsky@chromium.org>
Date: 2022-03-22 05:03:01
Also in: lkml

Possibly related (same subject, not in this thread)

On (22/03/16 10:05), Maninder Singh wrote:
[..]
+static int sprint_module_info(char *buf, unsigned long value,
+			     int modbuildid, int backtrace, int symbol)
+{
+	struct module *mod;
+	unsigned long offset;
+	void *base;
+	char *modname;
+	int len;
+	const unsigned char *buildid = NULL;
+	bool add_offset;
+
+	if (is_ksym_addr(value))
+		return 0;
+
+	if (backtrace || symbol)
+		add_offset = true;
+	else
+		add_offset = false;
+
+	preempt_disable();
+	mod = __module_address(value);
+	if (mod) {
+		modname = mod->name;
+#if IS_ENABLED(CONFIG_STACKTRACE_BUILD_ID)
+		if (modbuildid)
+			buildid = mod->build_id;
+#endif
+		if (add_offset) {
+			base = mod->core_layout.base;
+			offset = value - (unsigned long)base;
+		}
What if address is in module init? Shouldn't this be something like

	if (within_module_init(value, mod))
		offset = value - (unsigned long)mod->init_layout.base;
	else
		offset = value - (unsigned long)mod->core_layout.base;
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help