Re: 2.6.12-rc2-mm3

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi Ingo.

I have some programs that crash
in 2.6.12-rc2-mm3. After seeing this:
http://www.uwsg.iu.edu/hypermail/linux/kernel/0504.1/1091.html
I tried to revert the
sched-unlocked-context-switches.patch
and indeed the problem goes away.
Attached is the (crappy) test-case.
If you can make it to say "All OK"
then the problem is solved.
Apparently the %fs gets trashed
somewhere, any ideas?

#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <signal.h>
#include <linux/unistd.h>
#include <asm/ldt.h>
#include <asm/ucontext.h>

_syscall3(int, modify_ldt, int, func, void *, ptr, unsigned long, bytecount)

static int set_ldt_entry(int entry, unsigned long base, unsigned int limit,
	      int seg_32bit_flag, int contents, int read_only_flag,
	      int limit_in_pages_flag, int seg_not_present, int useable)
{
  struct modify_ldt_ldt_s ldt_info;
  ldt_info.entry_number = entry;
  ldt_info.base_addr = base;
  ldt_info.limit = limit;
  ldt_info.seg_32bit = seg_32bit_flag;
  ldt_info.contents = contents;
  ldt_info.read_exec_only = read_only_flag;
  ldt_info.limit_in_pages = limit_in_pages_flag;
  ldt_info.seg_not_present = seg_not_present;
  ldt_info.useable = useable;

  return modify_ldt(1, &ldt_info, sizeof(ldt_info));
}

int main(int argc, char *argv[])
{
  unsigned short _ss, new_ss, fs;

  /* Get SS */
  asm volatile(
    "movw %%ss, %0\n"
    :"=m"(_ss)
  );

  /* Force to LDT */
  new_ss = (_ss & 0xffff) | 4;
  /* Create the LDT entry */
  set_ldt_entry(new_ss >> 3, 0, 0xfffff, 0, MODIFY_LDT_CONTENTS_DATA, 0, 1, 0, 0);

  asm ("movw %%fs, %0":"=m"(fs));
  printf("fs1=0x%hx\n", fs);
  asm ("movw %0, %%fs"::"a"(new_ss));
  asm ("movw %%fs, %0":"=m"(fs));
  printf("fs2=0x%hx\n", fs);
  usleep(0);
  asm ("movw %%fs, %0":"=m"(fs));
  printf("fs3=0x%hx\n", fs);
  if (fs != new_ss)
    printf("BUG!\n");
  else
    printf("All OK\n");
  return 0;
}

[Index of Archives]     [Kernel Newbies]     [Netfilter]     [Bugtraq]     [Photo]     [Stuff]     [Gimp]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Video 4 Linux]     [Linux for the blind]     [Linux Resources]
  Powered by Linux