Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1734334
| From | "Luck, Tony" <tony.luck@intel.com> |
|---|---|
| Newsgroups | linux.kernel |
| Subject | Re: [PATCH 0/5] [RFC] printk/ia64/ppc64/parisc64: let's deprecate %pF/%pf printk specifiers |
| Date | 2017-09-18 19:50 +0200 |
| Message-ID | <ur8lc-TR-7@gated-at.bofh.it> (permalink) |
| References | <uqcqR-4iC-1@gated-at.bofh.it> |
| Organization | linux.* mail to news gateway |
On Sat, Sep 16, 2017 at 12:53:42PM +0900, Sergey Senozhatsky wrote:
> Hello
>
> RFC
>
> On some arches C function pointers are indirect and point to
> a function descriptor, which contains the actual pointer to the code.
> This mostly doesn't matter, except for cases when people want to print
> out function pointers in symbolic format, because the usual '%pS/%ps'
> does not work on those arches as expected. That's the reason why we
> have '%pF/%pf', but since it's here because of a subtle ABI detail
> specific to some arches (ppc64/ia64/parisc64) it's easy to misuse
> '%pF/%pf' and '%pS/%ps' (see [1], for example).
A few new warnings when building on ia64:
arch/ia64/kernel/module.c:931: warning: passing argument 1 of 'dereference_function_descriptor' makes pointer from integer without a cast
arch/ia64/kernel/module.c:931: warning: return makes integer from pointer without a cast
kernel/kallsyms.c:325: warning: assignment makes integer from pointer without a cast
kernel/kallsyms.c:325: warning: passing argument 1 of 'dereference_kernel_function_descriptor' makes pointer from integer without a cast
Tried out the module case with a simple Hello-world test case.
This code:
char buf[1];
int init_module(void)
{
printk(KERN_INFO "Hello world 1.\n");
printk("using %%p my init_module is at %p\n", init_module);
printk("using %%pF my init_module is at %pF\n", init_module);
printk("using %%pS my init_module is at %pS\n", init_module);
printk("using %%p my buf is at %p\n", buf);
printk("using %%pF my buf is at %pF\n", buf);
printk("using %%pS my buf is at %pS\n", buf);
return 0;
}
Gave this console output:
Hello world 1.
using %p my init_module is at a000000203bf0328
using %pF my init_module is at init_module+0x0/0x140 [hello_1]
using %pS my init_module is at init_module+0x0/0x140 [hello_1]
using %p my buf is at a000000203bf0648
using %pF my buf is at buf+0x0/0xfffffffffffffb58 [hello_1]
using %pS my buf is at buf+0x0/0xfffffffffffffb58 [hello_1]
Which looks like what you wanted. People unaware of the vagaries
of ppc64/ia64/parisc64 can use the wrong %p[SF] variant, but still
get the right output.
-Tony
Back to linux.kernel | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
[PATCH 0/5] [RFC] printk/ia64/ppc64/parisc64: let's deprecate %pF/%pf printk specifiers Sergey Senozhatsky <sergey.senozhatsky@gmail.com> - 2017-09-16 06:00 +0200
[PATCH 5/5] symbol lookup: use new kernel and module dereference functions Sergey Senozhatsky <sergey.senozhatsky@gmail.com> - 2017-09-16 06:00 +0200
[PATCH 1/5] sections: split dereference_function_descriptor() Sergey Senozhatsky <sergey.senozhatsky@gmail.com> - 2017-09-16 06:00 +0200
[PATCH 3/5] powerpc64: Add .opd based function descriptor dereference Sergey Senozhatsky <sergey.senozhatsky@gmail.com> - 2017-09-16 06:00 +0200
Re: [PATCH 3/5] powerpc64: Add .opd based function descriptor dereference "Naveen N. Rao" <naveen.n.rao@linux.vnet.ibm.com> - 2017-09-16 11:50 +0200
Re: [PATCH 3/5] powerpc64: Add .opd based function descriptor dereference Sergey Senozhatsky <sergey.senozhatsky@gmail.com> - 2017-09-16 13:40 +0200
Re: [PATCH 3/5] powerpc64: Add .opd based function descriptor dereference Michael Ellerman <mpe@ellerman.id.au> - 2017-09-19 12:30 +0200
Re: [PATCH 3/5] powerpc64: Add .opd based function descriptor dereference Sergey Senozhatsky <sergey.senozhatsky.work@gmail.com> - 2017-09-19 12:40 +0200
Re: [PATCH 3/5] powerpc64: Add .opd based function descriptor dereference Michael Ellerman <mpe@ellerman.id.au> - 2017-09-20 04:00 +0200
Re: [PATCH 3/5] powerpc64: Add .opd based function descriptor dereference Sergey Senozhatsky <sergey.senozhatsky.work@gmail.com> - 2017-09-20 08:20 +0200
[PATCH 4/5] parisc64: Add .opd based function descriptor dereference Sergey Senozhatsky <sergey.senozhatsky@gmail.com> - 2017-09-16 06:00 +0200
[PATCH 2/5] ia64: Add .opd based function descriptor dereference Sergey Senozhatsky <sergey.senozhatsky@gmail.com> - 2017-09-16 06:00 +0200
Re: [PATCH 0/5] [RFC] printk/ia64/ppc64/parisc64: let's deprecate %pF/%pf printk specifiers "Luck, Tony" <tony.luck@intel.com> - 2017-09-18 19:50 +0200
Re: [PATCH 0/5] [RFC] printk/ia64/ppc64/parisc64: let's deprecate %pF/%pf printk specifiers Helge Deller <deller@gmx.de> - 2017-09-18 20:40 +0200
Re: [PATCH 0/5] [RFC] printk/ia64/ppc64/parisc64: let's deprecate %pF/%pf printk specifiers Sergey Senozhatsky <sergey.senozhatsky.work@gmail.com> - 2017-09-19 04:10 +0200
RE: [PATCH 0/5] [RFC] printk/ia64/ppc64/parisc64: let's deprecate %pF/%pf printk specifiers David Laight <David.Laight@ACULAB.COM> - 2017-09-19 15:40 +0200
Re: [PATCH 0/5] [RFC] printk/ia64/ppc64/parisc64: let's deprecate %pF/%pf printk specifiers Helge Deller <deller@gmx.de> - 2017-09-19 22:10 +0200
RE: [PATCH 0/5] [RFC] printk/ia64/ppc64/parisc64: let's deprecate %pF/%pf printk specifiers David Laight <David.Laight@ACULAB.COM> - 2017-09-20 10:50 +0200
Re: [PATCH 0/5] [RFC] printk/ia64/ppc64/parisc64: let's deprecate %pF/%pf printk specifiers Helge Deller <deller@gmx.de> - 2017-09-20 12:30 +0200
Re: [PATCH 0/5] [RFC] printk/ia64/ppc64/parisc64: let's deprecate %pF/%pf printk specifiers Sergey Senozhatsky <sergey.senozhatsky@gmail.com> - 2017-09-20 18:40 +0200
Re: [PATCH 0/5] [RFC] printk/ia64/ppc64/parisc64: let's deprecate %pF/%pf printk specifiers Helge Deller <deller@gmx.de> - 2017-09-19 16:10 +0200
Re: [PATCH 0/5] [RFC] printk/ia64/ppc64/parisc64: let's deprecate %pF/%pf printk specifiers Helge Deller <deller@gmx.de> - 2017-09-19 22:10 +0200
Re: [PATCH 0/5] [RFC] printk/ia64/ppc64/parisc64: let's deprecate %pF/%pf printk specifiers Sergey Senozhatsky <sergey.senozhatsky.work@gmail.com> - 2017-09-20 02:50 +0200
Re: [PATCH 0/5] [RFC] printk/ia64/ppc64/parisc64: let's deprecate %pF/%pf printk specifiers Sergey Senozhatsky <sergey.senozhatsky.work@gmail.com> - 2017-09-19 04:10 +0200
csiph-web