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]
Date:	Thu, 04 Sep 2008 09:49:42 -0700
From:	Jeremy Fitzhardinge <jeremy@...p.org>
To:	Eric Lacombe <tuxiko@...e.fr>
CC:	linux-kernel@...r.kernel.org, goretux@...il.com
Subject: Re: [x86] fs, gs purpose & multicore prog

Eric Lacombe wrote:
> Hello,
>
> I've some questions about IA-32e in Linux.
>
> - What is the FS and GS segments role inside the kernel ?
> (I was thinking about thread local storage)
>   

In a 32-bit kernel %fs is the base of the per-cpu data area.  In a
64-bit kernel %gs points to the pda (processor data area).  The pda is a
single structure, whereas per-cpu data is a section that per-cpu
variables get put into.

> - When I do a "mov %fs ..." instruction (in a module), it seems that %fs is 
> equal to 0 (idem for %gs). Are these registers not always filled ?
>   

On 32-bit they will always have a value, or you'll get a GPF.  On 64-bit
the value of the selector doesn't matter because the MSRs are the real
content.

> - What is the purpose of MSR_FS_BASE and MSR_GS_BASE ? 
> (I thought they were filled with "gdt[fs_entry].base")
>   
On 64-bit, the GDT isn't large enough to hold a 64-bit offset, so it
only stores the low 32-bits.  When you load a segment register with a
selector, it picks up from the gdt.  If you want a full 64-bit offset,
you need to write it to the msr.

> - My last question is about the kernel programation of multi-core (or 
> multiprocessor)
> architecture. I don't see a lot of documentation about that on Internet.
> Do you have some docs/urls about this topic.
> Maybe someone can briefly explain how the execution flow are given to the 
> different cores.
>   

To the kernel they're all just cpus, and it runs tasks on them as
usual.  There are a few tweaks in the scheduler to pay attention to the
shared caches and so on.

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