lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <1257335404.2123.29.camel@wall-e>
Date:	Wed, 04 Nov 2009 12:50:04 +0100
From:	Stefani Seibold <stefani@...bold.net>
To:	Andi Kleen <andi@...stfloor.org>
Cc:	linux-kernel <linux-kernel@...r.kernel.org>,
	Andrew Morton <akpm@...ux-foundation.org>,
	Americo Wang <xiyou.wangcong@...il.com>
Subject: Re: [PATCH] update fix X86_64 procfs provide stack information for
 threads

Am Mittwoch, den 04.11.2009, 12:17 +0100 schrieb Andi Kleen:
> Stefani Seibold <stefani@...bold.net> writes:
> >  
> > +#ifdef CONFIG_IA32_EMULATION
> > +unsigned long KSTK_ESP(struct task_struct *task)
> > +{
> > +	return (test_tsk_thread_flag(task, TIF_IA32)) ? \
> > +			(task_pt_regs(task)->sp) : \
> > +			((task)->thread.usersp);
> 
> Usersp is only set for system calls, but not when the process is blocked
> in a interrupt.
> 
> In general if you really want a reliable implementation of this
> you would really need to stop the task and grab the stack pointer;
> otherwise it can be arbitarily outdated anyways.
> 

This is true, but i think it is better to get an outdated value than a
complete wrong value like -1.

The truth is that KSTK_ESP always return an outdated value on a multi
core system if the process never do a system call.

But we can work on the next step and try to implement it better ;-)

Question: is task_pt_regs(task)->sp set in 64 bit mode when the process
is blocked in an interrupt? If true, we can add two additional assembly
instruction to the system call handler and store the stack pointer into
this. Than KSTK_ESP wil be again a simple macro like

#define KST_ESP(task)	task_pt_regs(task)->sp

The drawback is that this will cost a litte bit performance for a litte
bit more accuracy.
 
Stefani


--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ