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: <20150309164249.GA24910@gmail.com>
Date:	Mon, 9 Mar 2015 17:42:50 +0100
From:	Ingo Molnar <mingo@...nel.org>
To:	Denys Vlasenko <vda.linux@...glemail.com>
Cc:	Andy Lutomirski <luto@...capital.net>,
	Fengguang Wu <fengguang.wu@...el.com>, X86 ML <x86@...nel.org>,
	Linus Torvalds <torvalds@...ux-foundation.org>,
	LKP <lkp@...org>,
	"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>
Subject: Re: [x86/asm/entry] BUG: unable to handle kernel paging request


* Denys Vlasenko <vda.linux@...glemail.com> wrote:

> On Mon, Mar 9, 2015 at 12:46 PM, Ingo Molnar <mingo@...nel.org> wrote:
> >
> > * Andy Lutomirski <luto@...capital.net> wrote:
> >
> >> >>      */
> >> >>     unsigned long        stack[64];
> >> >>
> >> >> Last I checked, 0x100 != 64.  Also, wow, this is kind of disgusting. :)
> >> >
> >> >
> >> > Seems to be unused: I commented it out on "defconfig" build
> >> > and got no build errors.
> >>
> >> It's used.  On 32-bit, NMIs don't use task gates (I don't know why),
> >
> > So task gates were a sexy hardware acceleration feature, eons ago, and
> > we used to rely on them a lot,
> 
> IIRC task gates weren't used in Linux at first, [...]

AFAIK task gates were used to demo i386 context switching between 
tasks, a certain famous ABABABAB... pair of tasks printing to the 
console :-)

So task gates were used for context switching in Linux before it was 
called Linux! :-)

Check out the first released version:

  https://www.kernel.org/pub/linux/kernel/Historic/linux-0.01.tar.gz

It already does:

/*
 *      switch_to(n) should switch tasks to task nr n, first
 * checking that n isn't the current task, in which case it does nothing.
 * This also clears the TS-flag if the task we switched to has used
 * tha math co-processor latest.
 */
#define switch_to(n) {\
struct {long a,b;} __tmp; \
__asm__("cmpl %%ecx,_current\n\t" \
        "je 1f\n\t" \
        "xchgl %%ecx,_current\n\t" \
        "movw %%dx,%1\n\t" \
        "ljmp %0\n\t" \
        "cmpl %%ecx,%2\n\t" \
        "jne 1f\n\t" \
        "clts\n" \
        "1:" \
        ::"m" (*&__tmp.a),"m" (*&__tmp.b), \
        "m" (last_task_used_math),"d" _TSS(n),"c" ((long) task[n])); \
}

That LJMP is the TSS switch.

And in kernel/sched.c we did:

  void sched_init(void)
  {
        int i;
        struct desc_struct * p;

        set_tss_desc(gdt+FIRST_TSS_ENTRY,&(init_task.task.tss));

:-)

Thanks,

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