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

Bug#637528: certain %fs values are not accepted in i386_set_fsbase()



Package: kfreebsd-image-8.1-1-amd64
Version: 8.1+dfsg-9
Severity: normal

This test case shows how i386_set_fsbase() works fine when its argument is a
pointer to the BSS, but doesn't when its argument is a pointer to the heap:

$ gcc i386_set_fsbase_test.c -o test -m32 && ./test
0x80496cc, 0x80496cc
0x8049720, 0x0

(first line is for BSS, output matches with input; second line is for heap,
output is 0x0 and doesn't match)

I initially suspected this is a re-incarnation of upstram bug 130526:

  http://www.freebsd.org/cgi/query-pr.cgi?pr=130526

but response from upstream indicates they can't reproduce it anymore.  I've
been able to reproduce this with different combinations of kFreeBSD 8.1, 8.2
and 9.0~svn224698 with i386 and amd64, with GNU userland and with FreeBSD
userland.

Any help would be appreciated.

-- System Information:
Debian Release: 6.0.2
  APT prefers stable-updates
  APT policy: (500, 'stable-updates'), (500, 'stable')
Architecture: kfreebsd-amd64 (x86_64)

Kernel: kFreeBSD 8.2-1-amd64
Locale: LANG=ca_AD.utf8, LC_CTYPE=ca_AD.utf8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/dash

Versions of packages kfreebsd-image-8.1-1-amd64 depends on:
ii  freebsd-utils                 8.1-5      FreeBSD utilities needed for GNU/k
ii  kldutils                      8.1-4+b1   tools for managing kFreeBSD module

kfreebsd-image-8.1-1-amd64 recommends no packages.

kfreebsd-image-8.1-1-amd64 suggests no packages.

-- no debconf information
#include <stdio.h>
#include <machine/sysarch.h>
#include <stdlib.h>
#include <unistd.h>

#ifndef __i386__
#error "this test is for ia32 mode only"
#endif

void *p;
void *check = NULL;

main()
{
  p = &p;
  sysarch(I386_SET_FSBASE, p);
  sysarch(I386_GET_FSBASE, &check);
  printf ("0x%x, 0x%x\n", p, check);

  p = malloc (1);
  sysarch(I386_SET_FSBASE, p);
  sysarch(I386_GET_FSBASE, &check);
  printf ("0x%x, 0x%x\n", p, check);
}


Reply to: