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

Commit deac93df authored by James Bottomley's avatar James Bottomley Committed by Linus Torvalds
Browse files

lib: Correct printk %pF to work on all architectures



It was introduced by "vsprintf: add support for '%pS' and '%pF' pointer
formats" in commit 0fe1ef24.  However,
the current way its coded doesn't work on parisc64.  For two reasons: 1)
parisc isn't in the #ifdef and 2) parisc has a different format for
function descriptors

Make dereference_function_descriptor() more accommodating by allowing
architecture overrides.  I put the three overrides (for parisc64, ppc64
and ia64) in arch/kernel/module.c because that's where the kernel
internal linker which knows how to deal with function descriptors sits.

Signed-off-by: default avatarJames Bottomley <James.Bottomley@HansenPartnership.com>
Acked-by: default avatarBenjamin Herrenschmidt <benh@kernel.crashing.org>
Acked-by: default avatarTony Luck <tony.luck@intel.com>
Acked-by: default avatarKyle McMartin <kyle@mcmartin.ca>
Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
parent 7ae115b4
Loading
Loading
Loading
Loading
+3 −0
Original line number Diff line number Diff line
@@ -21,5 +21,8 @@ extern char __start_gate_brl_fsys_bubble_down_patchlist[], __end_gate_brl_fsys_b
extern char __start_unwind[], __end_unwind[];
extern char __start_ivt_text[], __end_ivt_text[];

#undef dereference_function_descriptor
void *dereference_function_descriptor(void *);

#endif /* _ASM_IA64_SECTIONS_H */
+12 −0
Original line number Diff line number Diff line
@@ -31,9 +31,11 @@
#include <linux/elf.h>
#include <linux/moduleloader.h>
#include <linux/string.h>
#include <linux/uaccess.h>
#include <linux/vmalloc.h>

#include <asm/patch.h>
#include <asm/sections.h>
#include <asm/unaligned.h>

#define ARCH_MODULE_DEBUG 0
@@ -941,3 +943,13 @@ module_arch_cleanup (struct module *mod)
	if (mod->arch.core_unw_table)
		unw_remove_unwind_table(mod->arch.core_unw_table);
}

void *dereference_function_descriptor(void *ptr)
{
	struct fdesc *desc = ptr;
	void *p;

	if (!probe_kernel_address(&desc->ip, p))
		ptr = p;
	return ptr;
}
+14 −0
Original line number Diff line number Diff line
@@ -47,7 +47,9 @@
#include <linux/string.h>
#include <linux/kernel.h>
#include <linux/bug.h>
#include <linux/uaccess.h>

#include <asm/sections.h>
#include <asm/unwind.h>

#if 0
@@ -860,3 +862,15 @@ void module_arch_cleanup(struct module *mod)
	deregister_unwind_table(mod);
	module_bug_cleanup(mod);
}

#ifdef CONFIG_64BIT
void *dereference_function_descriptor(void *ptr)
{
	Elf64_Fdesc *desc = ptr;
	void *p;

	if (!probe_kernel_address(&desc->addr, p))
		ptr = p;
	return ptr;
}
#endif
+3 −0
Original line number Diff line number Diff line
@@ -16,6 +16,9 @@ static inline int in_kernel_text(unsigned long addr)
	return 0;
}

#undef dereference_function_descriptor
void *dereference_function_descriptor(void *);

#endif

#endif /* __KERNEL__ */
+12 −1
Original line number Diff line number Diff line
@@ -21,8 +21,9 @@
#include <linux/err.h>
#include <linux/vmalloc.h>
#include <linux/bug.h>
#include <linux/uaccess.h>
#include <asm/module.h>
#include <asm/uaccess.h>
#include <asm/sections.h>
#include <asm/firmware.h>
#include <asm/code-patching.h>
#include <linux/sort.h>
@@ -451,3 +452,13 @@ int apply_relocate_add(Elf64_Shdr *sechdrs,

	return 0;
}

void *dereference_function_descriptor(void *ptr)
{
	struct ppc64_opd_entry *desc = ptr;
	void *p;

	if (!probe_kernel_address(&desc->funcaddr, p))
		ptr = p;
	return ptr;
}
Loading