Skip to contentSkip to conversation

ARCH=um SUBARCH=i386 breakage?

uml-devel Antoine Martin 3 participants 11 messages Jul 13, 2007 – Jul 19, 2007

Subsystems (2)
lore
Share & tools
lore
#0 lore raw
 # make ARCH=um SUBARCH=i386          
scripts/kconfig/conf -s arch/um/Kconfig
net/bluetooth/hidp/Kconfig:4:warning: 'select' used by config symbol 
'BT_HIDP' refers to undefined symbol 'HID'
  SYMLINK arch/um/include/kern_constants.h
  SYMLINK include/asm-um/arch
  SYMLINK arch/um/include/sysdep
  SYMLINK arch/um/os
  SYMLINK include/asm-um/archparam.h
  SYMLINK include/asm-um/system.h
  SYMLINK include/asm-um/sigcontext.h
  SYMLINK include/asm-um/processor.h
  SYMLINK include/asm-um/ptrace.h
  SYMLINK include/asm-um/module.h
  SYMLINK include/asm-um/vm-flags.h
  SYMLINK include/asm-um/elf.h
  SYMLINK include/asm-um/host_ldt.h
  CHK     arch/um/include/uml-config.h
  UPD     arch/um/include/uml-config.h
  CC      arch/um/sys-i386/user-offsets.s
arch/um/sys-i386/user-offsets.c:7:22: error: asm/user.h: No such file or 
directory
arch/um/sys-i386/user-offsets.c: In function 'foo':
arch/um/sys-i386/user-offsets.c:51: error: invalid application of 
'sizeof' to incomplete type 'struct user_i387_struct'
arch/um/sys-i386/user-offsets.c:52: error: invalid application of 
'sizeof' to incomplete type 'struct user_fxsr_struct'
arch/um/sys-i386/user-offsets.c:70: error: invalid application of 
'sizeof' to incomplete type 'struct user_regs_struct'
make[1]: *** [arch/um/sys-i386/user-offsets.s] Error 1
make: *** [arch/um/sys-i386/user-offsets.s] Error 2

This used to work fine - I am sure the fix is quite simple, but I do not have any spare time ATM.

Antoine

-------------------------------------------------------------------------
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
_______________________________________________
User-mode-linux-devel mailing list [email protected]
https://lists.sourceforge.net/lists/listinfo/user-mode-linux-devel

#1 lore raw

I had updated the kernel headers and these include files have been removed. Until UML uses some other trick, this works for me for the 64-bit build:

cp /usr/src/linux-2.6.22.1/include/asm/user.h /usr/include/asm/user.h cp /usr/src/linux-2.6.22.1/include/asm/page.h /usr/include/asm/page.h cp /usr/src/linux-2.6.22.1/include/linux/const.h /usr/include/linux/const.h

But for the 32-bit cross build (make ARCH=um SUBARCH=i386) I still get this error:

# make ARCH=um SUBARCH=i386
  SYMLINK arch/um/include/kern_constants.h
  CC      arch/um/sys-i386/user-offsets.s
arch/um/sys-i386/user-offsets.c: In function 'foo':
arch/um/sys-i386/user-offsets.c:52: error: invalid application of 
'sizeof' to incomplete type 'struct user_fxsr_struct'
make[1]: *** [arch/um/sys-i386/user-offsets.s] Error 1
make: *** [arch/um/sys-i386/user-offsets.s] Error 2
Quoted 33 lines · Antoine Martin
# make ARCH=um SUBARCH=i386          scripts/kconfig/conf -s 
arch/um/Kconfig
net/bluetooth/hidp/Kconfig:4:warning: 'select' used by config symbol 
'BT_HIDP' refers to undefined symbol 'HID'
 SYMLINK arch/um/include/kern_constants.h
 SYMLINK include/asm-um/arch
 SYMLINK arch/um/include/sysdep
 SYMLINK arch/um/os
 SYMLINK include/asm-um/archparam.h
 SYMLINK include/asm-um/system.h
 SYMLINK include/asm-um/sigcontext.h
 SYMLINK include/asm-um/processor.h
 SYMLINK include/asm-um/ptrace.h
 SYMLINK include/asm-um/module.h
 SYMLINK include/asm-um/vm-flags.h
 SYMLINK include/asm-um/elf.h
 SYMLINK include/asm-um/host_ldt.h
 CHK     arch/um/include/uml-config.h
 UPD     arch/um/include/uml-config.h
 CC      arch/um/sys-i386/user-offsets.s
arch/um/sys-i386/user-offsets.c:7:22: error: asm/user.h: No such file 
or directory
arch/um/sys-i386/user-offsets.c: In function 'foo':
arch/um/sys-i386/user-offsets.c:51: error: invalid application of 
'sizeof' to incomplete type 'struct user_i387_struct'
arch/um/sys-i386/user-offsets.c:52: error: invalid application of 
'sizeof' to incomplete type 'struct user_fxsr_struct'
arch/um/sys-i386/user-offsets.c:70: error: invalid application of 
'sizeof' to incomplete type 'struct user_regs_struct'
make[1]: *** [arch/um/sys-i386/user-offsets.s] Error 1
make: *** [arch/um/sys-i386/user-offsets.s] Error 2
Quoted 5 lines

This used to work fine - I am sure the fix is quite simple, but I do not have any spare time ATM.

Antoine

-------------------------------------------------------------------------
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
_______________________________________________
User-mode-linux-devel mailing list [email protected]
https://lists.sourceforge.net/lists/listinfo/user-mode-linux-devel

#2 lore raw
Quoted 6 lines · Antoine Martin

I had updated the kernel headers and these include files have been removed. Until UML uses some other trick, this works for me for the 64-bit build:

cp /usr/src/linux-2.6.22.1/include/asm/user.h /usr/include/asm/user.h cp /usr/src/linux-2.6.22.1/include/asm/page.h /usr/include/asm/page.h cp /usr/src/linux-2.6.22.1/include/linux/const.h /usr/include/linux/const.h

asm/user,h looks like a problem. The only other way I see to get the size of the FP registers is elf_fpregset_t and elf_fpxregset_t in asm/elf.h, which is exported. However, those are defined in terms of user_i387_struct and user_fxsr_struct in user.h, and it gets them with

	#include <asm/user.h>

So, we seem to have a situation where an exported header includes a non-exported one, or the include is filtered out and we have a type with an unknown size.

Could you check this there by seeing if something like this builds (with user.h removed):

#include <asm/elf.h>

int main(void){
	printf("%d %d\n", sizeof(elf_fpregset_t), sizeof(elf_fpxregset_t));
}
Quoted 1 line

cp /usr/src/linux-2.6.22.1/include/asm/page.h /usr/include/asm/page.h

This one is easily fixed.

Quoted 1 line

cp /usr/src/linux-2.6.22.1/include/linux/const.h /usr/include/linux/const.h

What's with this? I don't include that anywhere in UML.

Can you get rid of page.h and const.h (you'll have to leave user.h unfortunately) again and try the patch below? It builds for me on both i386 and x86_64.

Jeff

arch/um/include/sysdep-i386/stub.h +1 -2
Index: linux-2.6.21-mm/arch/um/include/sysdep-i386/stub.h
===================================================================
@@ -9,7 +9,6 @@
 #include <sys/mman.h>
 #include <asm/ptrace.h>
 #include <asm/unistd.h>
-#include <asm/page.h>
 #include "stub-data.h"
 #include "kern_constants.h"
 #include "uml-config.h"
@@ -19,7 +18,7 @@ extern void stub_clone_handler(void);
 
 #define STUB_SYSCALL_RET EAX
 #define STUB_MMAP_NR __NR_mmap2
-#define MMAP_OFFSET(o) ((o) >> PAGE_SHIFT)
+#define MMAP_OFFSET(o) ((o) >> UM_KERN_PAGE_SHIFT)
 
 static inline long stub_syscall0(long syscall)
 {
arch/um/os-Linux/main.c +0 -1
Index: linux-2.6.21-mm/arch/um/os-Linux/main.c
===================================================================
@@ -12,7 +12,6 @@
 #include <sys/resource.h>
 #include <sys/mman.h>
 #include <sys/user.h>
-#include <asm/page.h>
 #include "kern_util.h"
 #include "as-layout.h"
 #include "mem_user.h"
arch/um/os-Linux/skas/mem.c +0 -1
Index: linux-2.6.21-mm/arch/um/os-Linux/skas/mem.c
===================================================================
@@ -9,7 +9,6 @@
 #include <unistd.h>
 #include <sys/mman.h>
 #include <sys/wait.h>
-#include <asm/page.h>
 #include <asm/unistd.h>
 #include "mem_user.h"
 #include "mem.h"
arch/um/os-Linux/start_up.c +0 -1
Index: linux-2.6.21-mm/arch/um/os-Linux/start_up.c
===================================================================
@@ -19,7 +19,6 @@
 #include <sys/mman.h>
 #include <sys/resource.h>
 #include <asm/unistd.h>
-#include <asm/page.h>
 #include <sys/types.h>
 #include "kern_util.h"
 #include "user.h"
arch/um/os-Linux/tt.c +0 -1
Index: linux-2.6.21-mm/arch/um/os-Linux/tt.c
===================================================================
@@ -17,7 +17,6 @@
 #include <sys/mman.h>
 #include <asm/ptrace.h>
 #include <asm/unistd.h>
-#include <asm/page.h>
 #include "kern_util.h"
 #include "user.h"
 #include "signal_kern.h"
arch/um/sys-i386/ptrace_user.c +0 -2
Index: linux-2.6.21-mm/arch/um/sys-i386/ptrace_user.c
===================================================================
@@ -8,8 +8,6 @@
 #include <errno.h>
 #include <unistd.h>
 #include "ptrace_user.h"
-/* Grr, asm/user.h includes asm/ptrace.h, so has to follow ptrace_user.h */
-#include <asm/user.h>
 #include "kern_util.h"
 #include "sysdep/thread.h"
 #include "user.h"
arch/um/include/common-offsets.h +1 -0
Index: linux-2.6.21-mm/arch/um/include/common-offsets.h
===================================================================
@@ -10,6 +10,7 @@ OFFSET(HOST_TASK_PID, task_struct, pid);
 
 DEFINE(UM_KERN_PAGE_SIZE, PAGE_SIZE);
 DEFINE(UM_KERN_PAGE_MASK, PAGE_MASK);
+DEFINE(UM_KERN_PAGE_SHIFT, PAGE_SHIFT);
 DEFINE(UM_NSEC_PER_SEC, NSEC_PER_SEC);
 
 DEFINE_STR(UM_KERN_EMERG, KERN_EMERG);

-------------------------------------------------------------------------
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
_______________________________________________
User-mode-linux-devel mailing list [email protected]
https://lists.sourceforge.net/lists/listinfo/user-mode-linux-devel

#3 lore raw
Quoted 21 lines · Jeff Dike
Quoted 7 lines · Antoine Martin

I had updated the kernel headers and these include files have been removed. Until UML uses some other trick, this works for me for the 64-bit build:

cp /usr/src/linux-2.6.22.1/include/asm/user.h /usr/include/asm/user.h cp /usr/src/linux-2.6.22.1/include/asm/page.h /usr/include/asm/page.h cp /usr/src/linux-2.6.22.1/include/linux/const.h /usr/include/linux/const.h

asm/user,h looks like a problem. The only other way I see to get the size of the FP registers is elf_fpregset_t and elf_fpxregset_t in asm/elf.h, which is exported. However, those are defined in terms of user_i387_struct and user_fxsr_struct in user.h, and it gets them with

	#include <asm/user.h>

So, we seem to have a situation where an exported header includes a non-exported one, or the include is filtered out and we have a type with an unknown size.

Quoted 8 lines

Could you check this there by seeing if something like this builds (with user.h removed):

#include <asm/elf.h>

int main(void){
	printf("%d %d\n", sizeof(elf_fpregset_t), sizeof(elf_fpxregset_t));

My kernel headers are also missing elf.h, so this doesn't work either...

It is included in page.h:

CC arch/um/sys-i386/user-offsets.s
In file included from /usr/include/asm/user.h:5,

                 from arch/um/sys-i386/user-offsets.c:7:

/usr/include/asm/page.h:4:25: error: linux/const.h: No such file or directory
arch/um/sys-i386/user-offsets.c: In function 'foo':
arch/um/sys-i386/user-offsets.c:52: error: invalid application of 'sizeof' to incomplete type 'struct user_fxsr_struct' make[1]: *** [arch/um/sys-i386/user-offsets.s] Error 1
make: *** [arch/um/sys-i386/user-offsets.s] Error 2

Quoted 4 lines

Can you get rid of page.h and const.h (you'll have to leave user.h unfortunately) again and try the patch below? It builds for me on both i386 and x86_64.

I get the same error as above because user.h includes asm/page.h I tried removing the include from user.h, but then I get:
CC arch/um/sys-i386/user-offsets.s
arch/um/sys-i386/user-offsets.c: In function 'foo':
arch/um/sys-i386/user-offsets.c:52: error: invalid application of 'sizeof' to incomplete type 'struct user_fxsr_struct' make[1]: *** [arch/um/sys-i386/user-offsets.s] Error 1
make: *** [arch/um/sys-i386/user-offsets.s] Error 2

Antoine

-------------------------------------------------------------------------
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
_______________________________________________
User-mode-linux-devel mailing list [email protected]
https://lists.sourceforge.net/lists/listinfo/user-mode-linux-devel

#4 lore raw
Quoted 9 lines · Antoine Martin
Quoted 8 lines

Could you check this there by seeing if something like this builds (with user.h removed):

#include <asm/elf.h>

int main(void){
	printf("%d %d\n", sizeof(elf_fpregset_t), sizeof(elf_fpxregset_t));

My kernel headers are also missing elf.h, so this doesn't work either...

elf.h is supposedly exported in 2.6.22, although I guess someone took the comment seriously:

	# These probably shouldn't be exported
	unifdef-y += shmparam.h
	unifdef-y += elf.h
	unifdef-y += page.h

So, I have no idea how userspace is supposed to figure out how big a buffer to pass to PTRACE_GETFPREGS and PTRACE_GETFPXREGS. I think the headers are broken here.

Quoted 7 lines

It is included in page.h:

CC arch/um/sys-i386/user-offsets.s
In file included from /usr/include/asm/user.h:5,

                from arch/um/sys-i386/user-offsets.c:7:

/usr/include/asm/page.h:4:25: error: linux/const.h: No such file or directory

This is just broken, then. The headers should at least have no dangling includes.

Quoted 1 line

I get the same error as above because user.h includes asm/page.h

Hummm, I guess the header tidying people need to fix a bunch of things. I'll make whatever changes needed in UML to not use illicit headers, but I do need complete interface definitions, as with the FP stuff.

Jeff

Signature · 11 lines
Work email - jdike at linux dot intel dot com

-------------------------------------------------------------------------
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
_______________________________________________
User-mode-linux-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/user-mode-linux-devel
#5 lore raw
Quoted 26 lines
Quoted 3 lines

My kernel headers are also missing elf.h, so this doesn't work either...

elf.h is supposedly exported in 2.6.22, although I guess someone took the comment seriously:

	# These probably shouldn't be exported
	unifdef-y += shmparam.h
	unifdef-y += elf.h
	unifdef-y += page.h

So, I have no idea how userspace is supposed to figure out how big a buffer to pass to PTRACE_GETFPREGS and PTRACE_GETFPXREGS. I think the headers are broken here.

Quoted 8 lines

It is included in page.h:

CC arch/um/sys-i386/user-offsets.s
In file included from /usr/include/asm/user.h:5,

                from arch/um/sys-i386/user-offsets.c:7:

/usr/include/asm/page.h:4:25: error: linux/const.h: No such file or directory

Quoted 3 lines

This is just broken, then. The headers should at least have no dangling includes.

page.h wasn't there to start with, I added it by hand - so it isn't as bad, but building without page.h looks hard...

Quoted 9 lines
Quoted 3 lines

I get the same error as above because user.h includes asm/page.h

Hummm, I guess the header tidying people need to fix a bunch of things. I'll make whatever changes needed in UML to not use illicit headers, but I do need complete interface definitions, as with the FP stuff.

I don't mind bugging people to get to the bottom of this, do you know where to knock?
I can't find anything in MAINTAINERS.

Antoine

-------------------------------------------------------------------------
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
_______________________________________________
User-mode-linux-devel mailing list [email protected]
https://lists.sourceforge.net/lists/listinfo/user-mode-linux-devel

#6 lore raw
Quoted 3 lines · Antoine Martin

I don't mind bugging people to get to the bottom of this, do you know where to knock?
I can't find anything in MAINTAINERS.

Did you install the headers directly from a kernel tree, or is this the result of a distro upgrade?

Jeff

Signature · 11 lines
Work email - jdike at linux dot intel dot com

-------------------------------------------------------------------------
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
_______________________________________________
User-mode-linux-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/user-mode-linux-devel
#7 lore raw
Quoted 10 lines · Jeff Dike
Quoted 4 lines · Antoine Martin

I don't mind bugging people to get to the bottom of this, do you know where to knock?
I can't find anything in MAINTAINERS.

Did you install the headers directly from a kernel tree, or is this the result of a distro upgrade?

These are the Gentoo packages which are very close to mainline and I can't find the upstream location for the headers so I guess I will be filing a bug with Gentoo... We'll see where that leads.

Antoine

-------------------------------------------------------------------------
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
_______________________________________________
User-mode-linux-devel mailing list [email protected]
https://lists.sourceforge.net/lists/listinfo/user-mode-linux-devel

#8 lore raw
Quoted 8 lines · Antoine Martin
Quoted 7 lines · Jeff Dike
Quoted 4 lines · Antoine Martin

I don't mind bugging people to get to the bottom of this, do you know where to knock?
I can't find anything in MAINTAINERS.

Quoted 7 lines
Quoted 3 lines

Did you install the headers directly from a kernel tree, or is this the result of a distro upgrade?

These are the Gentoo packages which are very close to mainline and I can't find the upstream location for the headers so I guess I will be filing a bug with Gentoo... We'll see where that leads.

Actually, the Gentoo headers are not particularly close to the kernel headers. They are heavily "sanitized", meaning that all kinds of things that userspace is "not supposed to use" are removed. This makes it very hard for things like UML, that are heavily tied to the kernel, to build.

Daniel

-------------------------------------------------------------------------
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
_______________________________________________
User-mode-linux-devel mailing list [email protected]
https://lists.sourceforge.net/lists/listinfo/user-mode-linux-devel

#9 lore raw
Quoted 4 lines · Daniel Gryniewicz

Actually, the Gentoo headers are not particularly close to the kernel headers. They are heavily "sanitized", meaning that all kinds of things that userspace is "not supposed to use" are removed. This makes it very hard for things like UML, that are heavily tied to the kernel, to build.

UML isn't heavily tied to the kernel in the way that you mean, I think.

However, it does explore some obscure parts of the API. For example, the elimination of user.h makes it impossible to use PTRACE_SETFP[X]REGS, as there is no way to tell what size buffer should be passed in.

I'm all for minimizing the headers exported to userspace (and have made a small contribution in that direction - ptrace-abi.h). I'm happy to make UML stop using things it shouldn't. At the same time, it should be possible to use the full userspace API.

Jeff

Signature · 11 lines
Work email - jdike at linux dot intel dot com

-------------------------------------------------------------------------
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
_______________________________________________
User-mode-linux-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/user-mode-linux-devel
#10 lore raw
In reply to Daniel Gryniewicz
Quoted 16 lines · Daniel Gryniewicz
Quoted 14 lines · Antoine Martin
Quoted 12 lines · Jeff Dike
Quoted 5 lines · Antoine Martin

I don't mind bugging people to get to the bottom of this, do you know where to knock?
I can't find anything in MAINTAINERS.

Did you install the headers directly from a kernel tree, or is this the result of a distro upgrade?

Quoted 8 lines
Quoted 5 lines

These are the Gentoo packages which are very close to mainline and I can't find the upstream location for the headers so I guess I will be filing a bug with Gentoo... We'll see where that leads.

Actually, the Gentoo headers are not particularly close to the kernel headers.

My mistake.

Quoted 2 lines

They are heavily "sanitized", meaning that all kinds of things
that userspace is "not supposed to use" are removed.

So in a sense, Gentoo kernel headers are ahead of the game. Which means that these changes are likely to become an issue not just for Gentoo users in the future.

Quoted 3 lines

This makes it very
hard for things like UML, that are heavily tied to the kernel, to build.

As Jeff pointed out, this is part of the userspace api:
"the elimination of user.h makes it impossible to use PTRACE_SETFP[X]REGS, as there is no way to tell what size buffer should be passed in."

Can you suggest a way to code around this issue or is this going to require an update to the Gentoo kernel headers? Let me know if I can help.

Thanks
Antoine

-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft Defy all challenges. Microsoft(R) Visual Studio 2005.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
_______________________________________________
User-mode-linux-devel mailing list [email protected]
https://lists.sourceforge.net/lists/listinfo/user-mode-linux-devel