--- Begin Message ---
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);
}
--- End Message ---
--- Begin Message ---
- To: 637528-done@bugs.debian.org
- Subject: Re: certain %fs values are not accepted in i386_set_fsbase()
- From: Petr Salinger <Petr.Salinger@seznam.cz>
- Date: Tue, 16 Aug 2011 00:26:14 +0200 (CEST)
- Message-id: <alpine.LRH.2.02.1108160016150.9147@sci.felk.cvut.cz>
Hi,
the problem is not in the kernel, but in test program.
It's main() should be as bellow.
Petr
main()
{
void *val[1];
p = &p;
val[0] = p;
sysarch(I386_SET_FSBASE, val);
sysarch(I386_GET_FSBASE, &check);
printf ("0x%x, 0x%x\n", *val, check);
p = malloc (1);
val[0] = p;
sysarch(I386_SET_FSBASE, val);
sysarch(I386_GET_FSBASE, &check);
printf ("0x%x, 0x%x\n", *val, check);
val[0] = 0x12345678;
sysarch(I386_SET_FSBASE, val);
sysarch(I386_GET_FSBASE, &check);
printf ("0x%x, 0x%x\n", *val, check);
val[0] = 0xFEDCBA90;
sysarch(I386_SET_FSBASE, val);
sysarch(I386_GET_FSBASE, &check);
printf ("0x%x, 0x%x\n", *val, check);
}
--- End Message ---