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: <20120309062853.GD13284@linux.vnet.ibm.com>
Date:	Fri, 9 Mar 2012 11:58:53 +0530
From:	Srikar Dronamraju <srikar@...ux.vnet.ibm.com>
To:	Ingo Molnar <mingo@...e.hu>
Cc:	"H. Peter Anvin" <hpa@...or.com>,
	Peter Zijlstra <peterz@...radead.org>,
	Linus Torvalds <torvalds@...ux-foundation.org>,
	Oleg Nesterov <oleg@...hat.com>,
	LKML <linux-kernel@...r.kernel.org>,
	Christoph Hellwig <hch@...radead.org>,
	Steven Rostedt <rostedt@...dmis.org>,
	Thomas Gleixner <tglx@...utronix.de>,
	Masami Hiramatsu <masami.hiramatsu.pt@...achi.com>,
	Anton Arapov <anton@...hat.com>,
	Ananth N Mavinakayanahalli <ananth@...ibm.com>,
	Jim Keniston <jkenisto@...ux.vnet.ibm.com>,
	Jiri Olsa <jolsa@...hat.com>, Josh Stone <jistone@...hat.com>
Subject: Re: [PATCH] uprobes/core: handle breakpoint and signal step
 exception.

* Ingo Molnar <mingo@...e.hu> [2012-03-08 14:48:09]:

> 
> * Srikar Dronamraju <srikar@...ux.vnet.ibm.com> wrote:
> 
> > @@ -233,9 +233,11 @@ static inline void __user *arch_compat_alloc_user_space(long len)
> >  
> >  	if (test_thread_flag(TIF_IA32)) {
> >  		sp = task_pt_regs(current)->sp;
> > +#ifdef CONFIG_X86_64
> >  	} else {
> >  		/* -128 for the x32 ABI redzone */
> >  		sp = __this_cpu_read(old_rsp) - 128;
> > +#endif
> >  	}
> >  
> >  	return (void __user *)round_down(sp - len, 16);
> 
> So 'sp' is undefined if that TIF check fails?
> 
> Also, on a 32-bit kernel the TIF check probably fails all the 
> time, because we don't set TIF_IA32 (and don't know that flag).

> 
> It would probably be better to make the whole helper inline 
> #ifdef 64-bit, it does not look very useful on 32-bit.
> 

arch_compat_alloc_user_space gets called from compat_alloc_user_space
which is arch agnostic and exported too.

So I will change this to

void __user *arch_compat_alloc_user_space(long len)
{
  	if (is_ia32_compat_task(current))
  		sp = task_pt_regs(current)->sp;
#ifdef CONFIG_X86_64
  	else
  		/* -128 for the x32 ABI redzone */
  		sp = __this_cpu_read(old_rsp) - 128;
#endif
  
  	return (void __user *)round_down(sp - len, 16);
}

where is_ia32_compat_task() is the new macro that you suggested we put
in compat.h which would return true if the task is 32 bit emulated on
x86_64 or running on i386 machine.

Hence we can avoid the case where sp is not set.

-- 
Thanks and Regards
Srikar

--
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