[lkml]   [2017]   [Sep]   [14]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
Messages in this thread
SubjectRe: [PATCH 00/14] Fix wrong %pF and %pS printk format specifier usages
On (09/08/17 10:25), Luck, Tony wrote:
> On Fri, Sep 08, 2017 at 03:18:30PM +0900, Sergey Senozhatsky wrote:
> > if the addr is not in kernel .text, then try dereferencing it and check
> > if the dereferenced addr is in kernel .text.
> If it really is a function pointer, then we know that it is safe
> to dereference. But if it isn't, then maybe not?

yes. I thought about it - we can do %pS on a pointer to a global
structure. so that simple heuristic would not work reliably. we
parse ELF sections, and we know the address range of .opd section,
so we can check if the supplied pointer is within the .opd section
or not.

.opd does exist on ia64. not sure what's the name of ELF descriptor
section on ppc64/parisc64.

if we will be able to simply do

.opd->address <= ptr <= .opd->address + .opd->size

then it mostly should work for us. I guess.

> If it is a function pointer then dereferening will indeed give
> us a .text address. But if it isn't, it might still give us a
> .text address (we could reduce the probability of a false hit
> by checking that the .text address was exactly on a symbol with
> no offset ... but data values that happen to be the addresses of
> function entry points are possible).

hm. yes, need to think more.


 \ /
  Last update: 2017-09-14 08:54    [W:0.064 / U:1.248 seconds]
©2003-2018 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site