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 for Android: free password hash cracker in your pocket
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <1341906848.3462.92.camel@twins>
Date:	Tue, 10 Jul 2012 09:54:08 +0200
From:	Peter Zijlstra <a.p.zijlstra@...llo.nl>
To:	Ingo Molnar <mingo@...nel.org>
Cc:	Linus Torvalds <torvalds@...ux-foundation.org>, hpa@...or.com,
	eranian@...gle.com, linux-kernel@...r.kernel.org,
	fweisbec@...il.com, akpm@...ux-foundation.org, tglx@...utronix.de,
	linux-tip-commits@...r.kernel.org,
	Robert Richter <robert.richter@....com>
Subject: Re: [tip:perf/core] perf/x86: Fix USER/KERNEL tagging of samples

On Mon, 2012-07-09 at 20:41 +0200, Ingo Molnar wrote:
> > +static unsigned long get_segment_base(unsigned int segment)
> > +{
> > +     struct desc_struct *desc;
> > +     int idx = segment >> 3;
> > +
> > +     if ((segment & SEGMENT_TI_MASK) == SEGMENT_LDT) {
> > +             if (idx > LDT_ENTRIES)
> > +                     return 0;
> > +
> > +             desc = current->active_mm->context.ldt;
> > +     } else {
> > +             if (idx > GDT_ENTRIES)
> > +                     return 0;
> > +
> > +             desc = __this_cpu_ptr(&gdt_page.gdt[0]);
> > +     }
> > +
> > +     return get_desc_base(desc + idx);
> 
> Shouldn't idx be checked against active_mm->context.ldt.size, 
> not LDT_ENTRIES (which is really just an upper limit)?

Ah indeed, fixed that.

> > +static unsigned long code_segment_base(struct pt_regs *regs)
> > +{
> > +#ifdef CONFIG_32BIT
> > +     if (user_mode(regs) && regs->cs != __USER_CS)
> > +             return get_segment_base(regs->cs);
> > +#else
> > +     if (test_thread_flag(TIF_IA32)) {
> > +             if (user_mode(regs) && regs->cs != __USER32_CS)
> > +                     return get_segment_base(regs->cs);
> > +     }
> > +#endif
> > +     return 0;
> > +}
> 
> Will this do the right thing for x32 mode? 

hpa? It looks like x32 has TIF_X32, but from the kernel's POV its really
just another 64bit process, so as long as we don't trigger the TIF_IA32
case we'll just return 0. 

set_personality_ia32() looks like TIF_IA32 and TIF_X32 are mutually
exclusive, so I think we do the right thing.
--
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