public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Cyrill Gorcunov <gorcunov@gmail.com>
To: Paulo Marques <pmarques@grupopie.com>
Cc: LKML <linux-kernel@vger.kernel.org>, Ingo Molnar <mingo@elte.hu>,
	David Miller <davem@davemloft.net>,
	Andrew Morton <akpm@linux-foundation.org>,
	Paul Mackerras <paulus@samba.org>,
	Peter Zijlstra <peterz@infradead.org>,
	Thomas Gleixner <tglx@linutronix.de>
Subject: Re: [PATCH 1/6] POWERPC: use KSYM_NAME_LEN
Date: Wed, 23 Jan 2008 22:07:42 +0300	[thread overview]
Message-ID: <20080123190742.GH12877@cvg> (raw)
In-Reply-To: <47978E7D.9060606@grupopie.com>

[Paulo Marques - Wed, Jan 23, 2008 at 06:59:09PM +0000]
> Cyrill Gorcunov wrote:
>> [Paulo Marques - Wed, Jan 23, 2008 at 06:26:28PM +0000]
>>> Cyrill Gorcunov wrote:
>>>> [...]
>>>>  	case 's':
>>>> -		getstring(tmp, 64);
>>>> +		getstring(tmp, sizeof(tmp));
>>>>  		if (setjmp(bus_error_jmp) == 0) {
>>>>  			catch_memory_errors = 1;
>>>>  			sync();
>> just after that poin in the original code a call to kallsyms_lookup_name
>> is done - so i think it could be an overflow (of course it depends
>> on what *exactly* the name is being searched, and Paulo - I didn't
>> managed to get *the whole picture* of what is going on in this
>> code - so the thoughs were like: kallsyms_lookup_name could find
>> a quite long name restricted by KSYM_NAME_LEN (dunno how it could
>> happens - due to buggy code or due to memory corruption outside,
>> it does not matter - the only matter - it *could* find that long
>> name).
>
> Ah, now I understand your confusion: kallsyms_lookup_name doesn't fill the 
> name. It searches the name and returns the address. It is the _caller_ that 
> fills the name, not kallsyms_lookup_name.
>
> It is used for stuff like: "give me the address of function foo":
> addr = kallsyms_lookup_name("foo");
>

oh my, how could I oversight that... damn!!! my bad!!!

>> Anyway - it's just an attempt ;) we always could drop it far-far away ;)
>
> I think that using KSYM_NAME_LEN would be a nice cleanup for xmon, but it 
> is for the powerpc guys to decide if they want to do it. I just wanted to 
> point the change in behavior so that it wouldn't go unnoticed.

thanks, it's really important

>
> For all we know, the stack may at that point be close to full and an extra 
> 64 bytes may tip it over the edge.
>

oops, thanks for pointing out

>>> This also introduces a change in behavior. It is still a nice cleanup, 
>>> though. So, if the powerpc people feel they can spare an extra 64 bytes 
>>> of stack here, I guess it's ok.
>> Thanks a lot for review Paulo!
>
> No problem. I always keep an eye out for kallsyms related stuff.

;)

>
> -- 
> Paulo Marques - www.grupopie.com
>
> "There cannot be a crisis today; my schedule is already full."
>
		- Cyrill -

      reply	other threads:[~2008-01-23 19:08 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-01-23 17:38 [PATCH 1/6] POWERPC: use KSYM_NAME_LEN Cyrill Gorcunov
2008-01-23 18:26 ` Paulo Marques
2008-01-23 18:43   ` Cyrill Gorcunov
2008-01-23 18:59     ` Paulo Marques
2008-01-23 19:07       ` Cyrill Gorcunov [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20080123190742.GH12877@cvg \
    --to=gorcunov@gmail.com \
    --cc=akpm@linux-foundation.org \
    --cc=davem@davemloft.net \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@elte.hu \
    --cc=paulus@samba.org \
    --cc=peterz@infradead.org \
    --cc=pmarques@grupopie.com \
    --cc=tglx@linutronix.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox