<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic As soon as I have some in Software Archive</title>
    <link>https://community.intel.com/t5/Software-Archive/x86-Information-request-about-the-Global-Descriptor-Table-GDT/m-p/958058#M21234</link>
    <description>&lt;P&gt;As soon as I have some feedback on this case, I will post a response for you. &amp;nbsp;For now, you might to check with open-source to see how they would handle the issue that you are having.&amp;nbsp;&lt;/P&gt;

&lt;P&gt;Here are some examples of Virtualization code:&lt;/P&gt;

&lt;UL&gt;
	&lt;LI&gt;Citrix XenServer*: &lt;A href="http://www.citrix.com/products/xenserver/overview.html"&gt;http://www.citrix.com/products/xenserver/overview.html&lt;/A&gt;&lt;/LI&gt;
	&lt;LI&gt;Xen* project: &lt;A href="http://www.xenproject.org/"&gt;http://www.xenproject.org/&lt;/A&gt;&lt;/LI&gt;
&lt;/UL&gt;

&lt;P&gt;-Thai&lt;/P&gt;</description>
    <pubDate>Wed, 05 Mar 2014 17:23:37 GMT</pubDate>
    <dc:creator>Quoc-Thai_L_Intel</dc:creator>
    <dc:date>2014-03-05T17:23:37Z</dc:date>
    <item>
      <title>[x86] Information request about the Global Descriptor Table (GDT) | Intel® Developer Zone</title>
      <link>https://community.intel.com/t5/Software-Archive/x86-Information-request-about-the-Global-Descriptor-Table-GDT/m-p/958057#M21233</link>
      <description>&lt;P style="font-family: Arial, Helvetica, sans-serif; font-size: 12px;"&gt;Hello,&lt;/P&gt;

&lt;P style="font-family: Arial, Helvetica, sans-serif; font-size: 12px;"&gt;I am currently working on a forensics project (32 bits OS), and to reach one of my goals, I need to play a bit with the GDT.&amp;nbsp;From what I understood, an instruction like&amp;nbsp;&lt;SPAN style="font-weight: 700;"&gt;call dword ptr [gs:0x10]&lt;/SPAN&gt;&amp;nbsp;does the following things :&lt;/P&gt;

&lt;UL style="color: rgb(96, 96, 96);"&gt;
	&lt;LI&gt;&lt;B&gt;GS&lt;/B&gt;&amp;nbsp;is used as a segment selector (16 bits) : The lower three bits indicate the privilege level of access and the&amp;nbsp;&lt;EM&gt;descriptor table&lt;/EM&gt;&amp;nbsp;to be used. In my case, we'll consider we use the&amp;nbsp;&lt;EM&gt;GDT&lt;/EM&gt;. The higher 13 bits represent the entry index in the GDT. Let's call&amp;nbsp;&lt;SPAN style="font-weight: 700;"&gt;A&lt;/SPAN&gt;&amp;nbsp;the base address corresponding to&amp;nbsp;&lt;SPAN style="font-weight: 700;"&gt;GTD[GS&amp;gt;&amp;gt;3]&lt;/SPAN&gt;.&lt;/LI&gt;
	&lt;LI&gt;&lt;SPAN style="font-weight: 700;"&gt;A&amp;nbsp;&lt;/SPAN&gt;is returned, and the processor computes&amp;nbsp;&lt;SPAN style="font-weight: 700;"&gt;A+0x10&lt;/SPAN&gt;&amp;nbsp;and gathers the value at this address, called&amp;nbsp;&lt;SPAN style="font-weight: 700;"&gt;B.&lt;/SPAN&gt;&lt;/LI&gt;
	&lt;LI&gt;A simple&amp;nbsp;&lt;SPAN style="font-weight: 700;"&gt;call B&lt;/SPAN&gt;&amp;nbsp;instruction is the executed.&lt;/LI&gt;
&lt;/UL&gt;

&lt;P style="font-family: Arial, Helvetica, sans-serif; font-size: 12px;"&gt;This kind of instruction happends when the code wants to perform a syscall : this instruction allows calling the&amp;nbsp;&lt;EM&gt;__kernel_vsyscall&lt;/EM&gt;&amp;nbsp;function without knowing its address. Correct me if I'm wrong, but I understood that :&lt;/P&gt;

&lt;UL style="color: rgb(96, 96, 96);"&gt;
	&lt;LI&gt;The base address&amp;nbsp;&lt;SPAN style="font-weight: 700;"&gt;A&lt;/SPAN&gt;&amp;nbsp;corresponds to a section of the userland memory called the&amp;nbsp;&lt;EM&gt;Thread Control Block (TCB)&lt;/EM&gt;&lt;/LI&gt;
	&lt;LI&gt;The&amp;nbsp;&lt;EM&gt;Global Descriptor Table (GDT)&lt;/EM&gt;&amp;nbsp;is stored in kernel memory and may be accessed through kernel modules or system calls thanks to the&amp;nbsp;&lt;SPAN style="font-weight: 700;"&gt;store_gdt&lt;/SPAN&gt;&amp;nbsp;function&lt;/LI&gt;
&lt;/UL&gt;

&lt;P style="font-family: Arial, Helvetica, sans-serif; font-size: 12px;"&gt;So, what is my problem ? Well, I need to be able to change to location of the TCB in my userland memory, that is to say not only relocate the contents but also the GDT entry that tells the processor&amp;nbsp;&lt;EM&gt;"GS points toward this base address that is the TCB"&lt;/EM&gt;.&lt;/P&gt;

&lt;P style="font-family: Arial, Helvetica, sans-serif; font-size: 12px;"&gt;Now, all the documents I saw indicated that there was only&amp;nbsp;&lt;SPAN style="font-weight: 700;"&gt;one GDT&lt;/SPAN&gt;&amp;nbsp;in the kernel (or one per CPU if you have more than one). Therefore, a GDT switch must be performed when the processor switches context (and running program), since two executions of the same process (with ASLR on) return different TCB location. My questions are :&lt;/P&gt;

&lt;UL style="color: rgb(96, 96, 96);"&gt;
	&lt;LI&gt;&lt;SPAN style="font-weight: 700;"&gt;If I access the GDT with the help of a kernel module (see attached file) or a system call from my user process, what GDT do I access ?&lt;/SPAN&gt;&lt;/LI&gt;
	&lt;LI&gt;&lt;SPAN style="font-weight: 700;"&gt;How can I read the GDT associated with segment descriptors of a process from his PID ?&lt;/SPAN&gt;&lt;/LI&gt;
&lt;/UL&gt;

&lt;P style="font-family: Arial, Helvetica, sans-serif; font-size: 12px;"&gt;Thanks in advance for any answer. This is my last resort since all the questions I asked around gave no answer and GDT documentation is rather short.&lt;/P&gt;</description>
      <pubDate>Tue, 14 Jan 2014 09:05:32 GMT</pubDate>
      <guid>https://community.intel.com/t5/Software-Archive/x86-Information-request-about-the-Global-Descriptor-Table-GDT/m-p/958057#M21233</guid>
      <dc:creator>Jean_M_</dc:creator>
      <dc:date>2014-01-14T09:05:32Z</dc:date>
    </item>
    <item>
      <title>As soon as I have some</title>
      <link>https://community.intel.com/t5/Software-Archive/x86-Information-request-about-the-Global-Descriptor-Table-GDT/m-p/958058#M21234</link>
      <description>&lt;P&gt;As soon as I have some feedback on this case, I will post a response for you. &amp;nbsp;For now, you might to check with open-source to see how they would handle the issue that you are having.&amp;nbsp;&lt;/P&gt;

&lt;P&gt;Here are some examples of Virtualization code:&lt;/P&gt;

&lt;UL&gt;
	&lt;LI&gt;Citrix XenServer*: &lt;A href="http://www.citrix.com/products/xenserver/overview.html"&gt;http://www.citrix.com/products/xenserver/overview.html&lt;/A&gt;&lt;/LI&gt;
	&lt;LI&gt;Xen* project: &lt;A href="http://www.xenproject.org/"&gt;http://www.xenproject.org/&lt;/A&gt;&lt;/LI&gt;
&lt;/UL&gt;

&lt;P&gt;-Thai&lt;/P&gt;</description>
      <pubDate>Wed, 05 Mar 2014 17:23:37 GMT</pubDate>
      <guid>https://community.intel.com/t5/Software-Archive/x86-Information-request-about-the-Global-Descriptor-Table-GDT/m-p/958058#M21234</guid>
      <dc:creator>Quoc-Thai_L_Intel</dc:creator>
      <dc:date>2014-03-05T17:23:37Z</dc:date>
    </item>
    <item>
      <title>Sorry I didn't flag it as</title>
      <link>https://community.intel.com/t5/Software-Archive/x86-Information-request-about-the-Global-Descriptor-Table-GDT/m-p/958059#M21235</link>
      <description>&lt;P&gt;Sorry I didn't flag it as solved.&lt;/P&gt;

&lt;P&gt;I don't know if this was the intended way, but using the &lt;STRONG&gt;get_thread_area&lt;/STRONG&gt;&amp;nbsp;syscall, I am able to access an array of values, including one (the 6th one) pointing to the TCB's first address.&lt;/P&gt;

&lt;P&gt;Not knowing though the size of the TCB, I make the assumption it is no bigger than one page (4K), and therefore, I allocate a page with mmap at a random place (*addr = NULL), copy the page where my TCB is and then change the value using &lt;B&gt;set_thread_area&lt;/B&gt;.&lt;/P&gt;

&lt;P&gt;For compatibility reasons, I also keep *GDT[%GS] = GDT[%GS]&lt;/P&gt;</description>
      <pubDate>Thu, 06 Mar 2014 08:58:42 GMT</pubDate>
      <guid>https://community.intel.com/t5/Software-Archive/x86-Information-request-about-the-Global-Descriptor-Table-GDT/m-p/958059#M21235</guid>
      <dc:creator>Jean_M_</dc:creator>
      <dc:date>2014-03-06T08:58:42Z</dc:date>
    </item>
  </channel>
</rss>

