mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Oleg Nesterov <oleg@tv-sign.ru>
To: Andrew Morton <akpm@osdl.org>
Cc: linux-kernel@vger.kernel.org, dev@sw.ru, torvalds@osdl.org
Subject: Re: [PATCH] alternate stack dump fix.
Date: Mon, 04 Oct 2004 13:28:01 +0400	[thread overview]
Message-ID: <416117A1.25DE5FCE@tv-sign.ru> (raw)
In-Reply-To: <20041004012731.2634bff8.akpm@osdl.org>

Andrew Morton wrote:
> 
> In that case I'm not understanding you.  Are you saying that your patch
> fixes the same problem as that which Kirill's patch fixed?

It seems to me, yes.

Here the pseudo code for CONFIG_FRAME_POINTER:

int valid_stack_ptr(struct thread_info *tinfo, void *p)
{
	return	p > (void *)tinfo &&
		p < (void *)tinfo + THREAD_SIZE - 3;
}

long print_context_stack(thread_info *tinfo, long *stack, long ebp)
{
	while (valid_stack_ptr(tinfo, ebp))
	{
		print_symbol("%s", *(ebp+4));
		ebp = *(unsigned long *)ebp;
	}

	return ebp;
}

void show_trace(struct task_struct *task, unsigned long * stack)
{
	while (1) {
		struct thread_info *context = (struct thread_info *)
			((unsigned long)stack & (~(THREAD_SIZE - 1)));

		ebp = print_context_stack(context, stack, ebp);

		stack = (unsigned long*)context->previous_esp;
		if (!stack)
			break;
		printk(" =======================\n");
	}
}

show_trace() now does not use task argument in the main
loop. Instead, it converts stack to thread_info* context,
and passes it to print_context_stack() and (implicitly)
to valid_stack_ptr().

valid_stack_ptr() does not care now whether or not it is
irq stack, it just does bounds checking.

Please note, i simply deleted this printk("Stack pointer is garbage"),
it can be restored, if neccessary.

Did i miss something?

> That wasn't at all clear from your earlier comments.

Yes, sorry.

Oleg.

  reply	other threads:[~2004-10-04  9:21 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-10-03 16:00 Oleg Nesterov
2004-10-03 17:06 ` Andrew Morton
2004-10-04  8:22   ` Oleg Nesterov
2004-10-04  8:27     ` Andrew Morton
2004-10-04  9:28       ` Oleg Nesterov [this message]
2004-10-04  8:22   ` Oleg Nesterov

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=416117A1.25DE5FCE@tv-sign.ru \
    --to=oleg@tv-sign.ru \
    --cc=akpm@osdl.org \
    --cc=dev@sw.ru \
    --cc=linux-kernel@vger.kernel.org \
    --cc=torvalds@osdl.org \
    /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

all inboxes | Powered by JetHome®