* [uml-devel] missing asm/user.h @ 2007-03-24 19:33 Daniel Gryniewicz 2007-03-25 1:27 ` Jeff Dike 0 siblings, 1 reply; 6+ messages in thread From: Daniel Gryniewicz @ 2007-03-24 19:33 UTC (permalink / raw) To: user-mode-linux-devel Hi, all. In their infinite wisdom, the Gentoo kernel team has decided to not ship asm/user.h with the kernel headers package anymore. Since UML (even, as far as I can tell, in the most recent versions) uses this in several places, is there a way around this? Are there plans to remove this need, or to use the ones from the UML kernel tree, or something? Daniel ------------------------------------------------------------------------- Take Surveys. Earn Cash. Influence the Future of IT Join SourceForge.net's Techsay panel and you'll get the chance to share your opinions on IT & business topics through brief surveys-and earn cash http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV _______________________________________________ User-mode-linux-devel mailing list User-mode-linux-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/user-mode-linux-devel ^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [uml-devel] missing asm/user.h 2007-03-24 19:33 [uml-devel] missing asm/user.h Daniel Gryniewicz @ 2007-03-25 1:27 ` Jeff Dike 2007-03-25 3:06 ` Daniel Gryniewicz 2007-03-25 3:36 ` Daniel Gryniewicz 0 siblings, 2 replies; 6+ messages in thread From: Jeff Dike @ 2007-03-25 1:27 UTC (permalink / raw) To: Daniel Gryniewicz; +Cc: user-mode-linux-devel On Sat, Mar 24, 2007 at 03:33:56PM -0400, Daniel Gryniewicz wrote: > In their infinite wisdom, the Gentoo kernel team has decided to not ship > asm/user.h with the kernel headers package anymore. Since UML (even, as > far as I can tell, in the most recent versions) uses this in several > places, is there a way around this? Are there plans to remove this > need, or to use the ones from the UML kernel tree, or something? This came up on IRC a week or so ago, but the conclusion then was that this was a botch on their part since other distro headers still included it, and became unusable as a result. BTW, several of the occurrences are in kernelspace files, which aren't affected by distro libc burps. I have a patch ready in case this is for real, attached below. It takes care of the i386 side of things - there's an x86_64 include which I ignored for now. Do you believe that this is going to be permanent, or just a gyration in the Gentoo kernel package? Jeff -- Work email - jdike at linux dot intel dot com Index: linux-2.6.21-mm/arch/um/sys-i386/user-offsets.c =================================================================== --- linux-2.6.21-mm.orig/arch/um/sys-i386/user-offsets.c 2007-03-23 15:05:29.000000000 -0400 +++ linux-2.6.21-mm/arch/um/sys-i386/user-offsets.c 2007-03-24 21:18:44.000000000 -0400 @@ -1,7 +1,7 @@ #include <stdio.h> #include <signal.h> #include <asm/ptrace.h> -#include <asm/user.h> +#include <asm/elf.h> #include <stddef.h> #include <sys/poll.h> Index: linux-2.6.21-mm/arch/um/sys-i386/ptrace_user.c =================================================================== --- linux-2.6.21-mm.orig/arch/um/sys-i386/ptrace_user.c 2007-03-24 21:18:44.000000000 -0400 +++ linux-2.6.21-mm/arch/um/sys-i386/ptrace_user.c 2007-03-24 21:20:44.000000000 -0400 @@ -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" ------------------------------------------------------------------------- Take Surveys. Earn Cash. Influence the Future of IT Join SourceForge.net's Techsay panel and you'll get the chance to share your opinions on IT & business topics through brief surveys-and earn cash http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV _______________________________________________ User-mode-linux-devel mailing list User-mode-linux-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/user-mode-linux-devel ^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [uml-devel] missing asm/user.h 2007-03-25 1:27 ` Jeff Dike @ 2007-03-25 3:06 ` Daniel Gryniewicz 2007-03-25 3:36 ` Daniel Gryniewicz 1 sibling, 0 replies; 6+ messages in thread From: Daniel Gryniewicz @ 2007-03-25 3:06 UTC (permalink / raw) To: Jeff Dike; +Cc: user-mode-linux-devel On Sat, 2007-03-24 at 21:27 -0400, Jeff Dike wrote: > On Sat, Mar 24, 2007 at 03:33:56PM -0400, Daniel Gryniewicz wrote: > > In their infinite wisdom, the Gentoo kernel team has decided to not ship > > asm/user.h with the kernel headers package anymore. Since UML (even, as > > far as I can tell, in the most recent versions) uses this in several > > places, is there a way around this? Are there plans to remove this > > need, or to use the ones from the UML kernel tree, or something? > > This came up on IRC a week or so ago, but the conclusion then was that > this was a botch on their part since other distro headers still > included it, and became unusable as a result. > > BTW, several of the occurrences are in kernelspace files, which aren't > affected by distro libc burps. These, of course, should be fine. > I have a patch ready in case this is for real, attached below. It > takes care of the i386 side of things - there's an x86_64 include > which I ignored for now. Thanks for the patch. I'll try it out. > Do you believe that this is going to be permanent, or just a gyration > in the Gentoo kernel package? They are adamant that this is the correct thing to do and the headers won't be going back in. This means I'll have to work around the problem in the UML package. Hopefully, your patch will be enough. Daniel ------------------------------------------------------------------------- Take Surveys. Earn Cash. Influence the Future of IT Join SourceForge.net's Techsay panel and you'll get the chance to share your opinions on IT & business topics through brief surveys-and earn cash http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV _______________________________________________ User-mode-linux-devel mailing list User-mode-linux-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/user-mode-linux-devel ^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [uml-devel] missing asm/user.h 2007-03-25 1:27 ` Jeff Dike 2007-03-25 3:06 ` Daniel Gryniewicz @ 2007-03-25 3:36 ` Daniel Gryniewicz 2007-03-25 14:52 ` Jeff Dike 1 sibling, 1 reply; 6+ messages in thread From: Daniel Gryniewicz @ 2007-03-25 3:36 UTC (permalink / raw) To: Jeff Dike; +Cc: user-mode-linux-devel On Sat, 2007-03-24 at 21:27 -0400, Jeff Dike wrote: > On Sat, Mar 24, 2007 at 03:33:56PM -0400, Daniel Gryniewicz wrote: > > In their infinite wisdom, the Gentoo kernel team has decided to not ship > > asm/user.h with the kernel headers package anymore. Since UML (even, as > > far as I can tell, in the most recent versions) uses this in several > > places, is there a way around this? Are there plans to remove this > > need, or to use the ones from the UML kernel tree, or something? > > This came up on IRC a week or so ago, but the conclusion then was that > this was a botch on their part since other distro headers still > included it, and became unusable as a result. > Update: <asm/elf.h> isn't there either, but <sys/user.h> includes user_regs_struct, so that's sufficient for this problem. The next problem is lack of <asm/page.h>. Most files failing to build with it can simply have it removed. I've temporarily replaced PAGE_SIZE with sysconf(_SC_PAGESIZE) for now, and we'll see how that works. Daniel ------------------------------------------------------------------------- Take Surveys. Earn Cash. Influence the Future of IT Join SourceForge.net's Techsay panel and you'll get the chance to share your opinions on IT & business topics through brief surveys-and earn cash http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV _______________________________________________ User-mode-linux-devel mailing list User-mode-linux-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/user-mode-linux-devel ^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [uml-devel] missing asm/user.h 2007-03-25 3:36 ` Daniel Gryniewicz @ 2007-03-25 14:52 ` Jeff Dike 2007-03-27 2:36 ` Daniel Gryniewicz 0 siblings, 1 reply; 6+ messages in thread From: Jeff Dike @ 2007-03-25 14:52 UTC (permalink / raw) To: Daniel Gryniewicz; +Cc: user-mode-linux-devel On Sat, Mar 24, 2007 at 11:36:28PM -0400, Daniel Gryniewicz wrote: > Update: <asm/elf.h> isn't there either, but <sys/user.h> includes > user_regs_struct, so that's sufficient for this problem. Hummph, I hope that's true of every other distro that people use UML on. > The next problem is lack of <asm/page.h>. Most files failing to build > with it can simply have it removed. I've temporarily replaced PAGE_SIZE > with sysconf(_SC_PAGESIZE) for now, and we'll see how that works. Send patches. BTW, the important thing about PAGE_SIZE in the userspace side of UML is not that it be the same as sysconf(_SC_PAGESIZE) but that it match the value of PAGE_SIZE in the kernelspace side. Obviously, these values will all be the same everywhere that we care about now, but I can think of one or two situations where it would matter. On an architecture with a variable page size, the UML kernel can have a PAGE_SIZE of 64K but the host's sysconf can report a page size of 4K. In this case, it's important that PAGE_SIZE in UML userspace code be 64K. So, there's UM_KERN_PAGE_SIZE in kern_constants.h which is derived from the kernel's PAGE_SIZE and is usable in userspace files. Use that instead of sysconf(). Jeff -- Work email - jdike at linux dot intel dot com ------------------------------------------------------------------------- Take Surveys. Earn Cash. Influence the Future of IT Join SourceForge.net's Techsay panel and you'll get the chance to share your opinions on IT & business topics through brief surveys-and earn cash http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV _______________________________________________ User-mode-linux-devel mailing list User-mode-linux-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/user-mode-linux-devel ^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [uml-devel] missing asm/user.h 2007-03-25 14:52 ` Jeff Dike @ 2007-03-27 2:36 ` Daniel Gryniewicz 0 siblings, 0 replies; 6+ messages in thread From: Daniel Gryniewicz @ 2007-03-27 2:36 UTC (permalink / raw) To: Jeff Dike; +Cc: user-mode-linux-devel [-- Attachment #1: Type: text/plain, Size: 2106 bytes --] On Sun, 2007-03-25 at 10:52 -0400, Jeff Dike wrote: > On Sat, Mar 24, 2007 at 11:36:28PM -0400, Daniel Gryniewicz wrote: > > Update: <asm/elf.h> isn't there either, but <sys/user.h> includes > > user_regs_struct, so that's sufficient for this problem. > > Hummph, I hope that's true of every other distro that people use UML on. Bad news: It has user_regs_struct, but not user_i387_struct or user_fxsr_struct (at least not on x86_64). > > The next problem is lack of <asm/page.h>. Most files failing to build > > with it can simply have it removed. I've temporarily replaced PAGE_SIZE > > with sysconf(_SC_PAGESIZE) for now, and we'll see how that works. > > Send patches. > > BTW, the important thing about PAGE_SIZE in the userspace side of UML > is not that it be the same as sysconf(_SC_PAGESIZE) but that it match > the value of PAGE_SIZE in the kernelspace side. Obviously, these > values will all be the same everywhere that we care about now, but I > can think of one or two situations where it would matter. On an > architecture with a variable page size, the UML kernel can have a > PAGE_SIZE of 64K but the host's sysconf can report a page size of 4K. > In this case, it's important that PAGE_SIZE in UML userspace code be > 64K. > > So, there's UM_KERN_PAGE_SIZE in kern_constants.h which is derived > from the kernel's PAGE_SIZE and is usable in userspace files. Use > that instead of sysconf(). Thanks for the pointer. Here's a patch I've used to test. There are two problems with it. First, as mentioned above, I couldn't find two user structs anywhere in the gentoo headers. It's possibly we could convince the maintainers to add those back, since they're for gdb. I'm not sure, tho, so I just defined them inline for now. Second, PAGE_MASK and PAGE_SHIFT. These should be generated like UM_KERN_PAGE_SIZE above, but I wasn't able to find where they're generated (sorry, not up on my Kconfig magic...). That said, the patch *does* work here on my x86_64 box, both in native and on SUBARCH=i386 modes. I don't have any more exotic arches than that to test on. Daniel [-- Attachment #2: linux-2.6.20-gentoo-headers.patch --] [-- Type: text/x-patch, Size: 6742 bytes --] diff --exclude-from=/home/dang/bin/scripts/diffrc -up -ruN linux-2.6.20.orig/arch/um/include/sysdep-i386/stub.h linux-2.6.20/arch/um/include/sysdep-i386/stub.h --- linux-2.6.20.orig/arch/um/include/sysdep-i386/stub.h 2007-02-04 13:44:54.000000000 -0500 +++ linux-2.6.20/arch/um/include/sysdep-i386/stub.h 2007-03-26 16:11:39.000000000 -0400 @@ -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" diff --exclude-from=/home/dang/bin/scripts/diffrc -up -ruN linux-2.6.20.orig/arch/um/kernel/skas/clone.c linux-2.6.20/arch/um/kernel/skas/clone.c --- linux-2.6.20.orig/arch/um/kernel/skas/clone.c 2007-02-04 13:44:54.000000000 -0500 +++ linux-2.6.20/arch/um/kernel/skas/clone.c 2007-03-26 14:56:27.000000000 -0400 @@ -3,7 +3,6 @@ #include <sys/mman.h> #include <sys/time.h> #include <asm/unistd.h> -#include <asm/page.h> #include "ptrace_user.h" #include "skas.h" #include "stub-data.h" diff --exclude-from=/home/dang/bin/scripts/diffrc -up -ruN linux-2.6.20.orig/arch/um/os-Linux/main.c linux-2.6.20/arch/um/os-Linux/main.c --- linux-2.6.20.orig/arch/um/os-Linux/main.c 2007-02-04 13:44:54.000000000 -0500 +++ linux-2.6.20/arch/um/os-Linux/main.c 2007-03-26 14:56:59.000000000 -0400 @@ -12,7 +12,6 @@ #include <sys/resource.h> #include <sys/mman.h> #include <sys/user.h> -#include <asm/page.h> #include "user_util.h" #include "kern_util.h" #include "mem_user.h" diff --exclude-from=/home/dang/bin/scripts/diffrc -up -ruN linux-2.6.20.orig/arch/um/os-Linux/skas/mem.c linux-2.6.20/arch/um/os-Linux/skas/mem.c --- linux-2.6.20.orig/arch/um/os-Linux/skas/mem.c 2007-02-04 13:44:54.000000000 -0500 +++ linux-2.6.20/arch/um/os-Linux/skas/mem.c 2007-03-26 16:13:41.000000000 -0400 @@ -8,7 +8,6 @@ #include <string.h> #include <sys/mman.h> #include <sys/wait.h> -#include <asm/page.h> #include <asm/unistd.h> #include "mem_user.h" #include "mem.h" @@ -109,6 +108,8 @@ static inline long do_syscall_stub(struc return ret; } +#define PAGE_MASK (~(UM_KERN_PAGE_SIZE-1)) +#define PAGE_SHIFT 12 long run_syscall_stub(struct mm_id * mm_idp, int syscall, unsigned long *args, long expected, void **addr, int done) @@ -133,7 +134,7 @@ long run_syscall_stub(struct mm_id * mm_ multi_op_count++; if(!done && ((((unsigned long) stack) & ~PAGE_MASK) < - PAGE_SIZE - 10 * sizeof(long))){ + UM_KERN_PAGE_SIZE - 10 * sizeof(long))){ *addr = stack; return 0; } @@ -152,7 +153,7 @@ long syscall_stub_data(struct mm_id * mm * Thus in this case do_syscall_stub correctly won't be called. */ if((((unsigned long) *addr) & ~PAGE_MASK) >= - PAGE_SIZE - (10 + data_count) * sizeof(long)) { + UM_KERN_PAGE_SIZE - (10 + data_count) * sizeof(long)) { ret = do_syscall_stub(mm_idp, addr); /* in case of error, don't overwrite data on stack */ if(ret) diff --exclude-from=/home/dang/bin/scripts/diffrc -up -ruN linux-2.6.20.orig/arch/um/os-Linux/start_up.c linux-2.6.20/arch/um/os-Linux/start_up.c --- linux-2.6.20.orig/arch/um/os-Linux/start_up.c 2007-02-04 13:44:54.000000000 -0500 +++ linux-2.6.20/arch/um/os-Linux/start_up.c 2007-03-26 14:57:45.000000000 -0400 @@ -18,7 +18,6 @@ #include <sys/wait.h> #include <sys/mman.h> #include <asm/unistd.h> -#include <asm/page.h> #include <sys/types.h> #include "user_util.h" #include "kern_util.h" @@ -79,11 +78,11 @@ static int start_ptraced_child(void **st unsigned long sp; int pid, n, status; - stack = mmap(NULL, PAGE_SIZE, PROT_READ | PROT_WRITE | PROT_EXEC, + stack = mmap(NULL, UM_KERN_PAGE_SIZE, PROT_READ | PROT_WRITE | PROT_EXEC, MAP_PRIVATE | MAP_ANONYMOUS, -1, 0); if(stack == MAP_FAILED) panic("check_ptrace : mmap failed, errno = %d", errno); - sp = (unsigned long) stack + PAGE_SIZE - sizeof(void *); + sp = (unsigned long) stack + UM_KERN_PAGE_SIZE - sizeof(void *); pid = clone(ptrace_child, (void *) sp, SIGCHLD, NULL); if(pid < 0) panic("start_ptraced_child : clone failed, errno = %d", errno); @@ -128,7 +127,7 @@ static int stop_ptraced_child(int pid, v ret = -1; } - if(munmap(stack, PAGE_SIZE) < 0) + if(munmap(stack, UM_KERN_PAGE_SIZE) < 0) panic("check_ptrace : munmap failed, errno = %d", errno); return ret; } diff --exclude-from=/home/dang/bin/scripts/diffrc -up -ruN linux-2.6.20.orig/arch/um/sys-i386/ptrace_user.c linux-2.6.20/arch/um/sys-i386/ptrace_user.c --- linux-2.6.20.orig/arch/um/sys-i386/ptrace_user.c 2007-02-04 13:44:54.000000000 -0500 +++ linux-2.6.20/arch/um/sys-i386/ptrace_user.c 2007-03-26 16:14:34.000000000 -0400 @@ -7,9 +7,8 @@ #include <stddef.h> #include <errno.h> #include <unistd.h> +#include <sys/user.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" diff --exclude-from=/home/dang/bin/scripts/diffrc -up -ruN linux-2.6.20.orig/arch/um/sys-i386/user-offsets.c linux-2.6.20/arch/um/sys-i386/user-offsets.c --- linux-2.6.20.orig/arch/um/sys-i386/user-offsets.c 2007-02-04 13:44:54.000000000 -0500 +++ linux-2.6.20/arch/um/sys-i386/user-offsets.c 2007-03-26 16:10:51.000000000 -0400 @@ -1,7 +1,7 @@ #include <stdio.h> #include <signal.h> #include <asm/ptrace.h> -#include <asm/user.h> +#include <sys/user.h> #include <stddef.h> #include <sys/poll.h> @@ -14,6 +14,34 @@ #define OFFSET(sym, str, mem) \ DEFINE(sym, offsetof(struct str, mem)); +/* These are gone from userspace; not sure where to pull them from */ +struct user_i387_struct { + long cwd; + long swd; + long twd; + long fip; + long fcs; + long foo; + long fos; + long st_space[20]; /* 8*10 bytes for each FP-reg = 80 bytes */ +}; + +struct user_fxsr_struct { + unsigned short cwd; + unsigned short swd; + unsigned short twd; + unsigned short fop; + long fip; + long fcs; + long foo; + long fos; + long mxcsr; + long reserved; + long st_space[32]; /* 8*16 bytes for each FP-reg = 128 bytes */ + long xmm_space[32]; /* 8*16 bytes for each XMM-reg = 128 bytes */ + long padding[56]; +}; + void foo(void) { OFFSET(HOST_SC_IP, sigcontext, eip); diff --exclude-from=/home/dang/bin/scripts/diffrc -up -ruN linux-2.6.20.orig/arch/um/sys-x86_64/user-offsets.c linux-2.6.20/arch/um/sys-x86_64/user-offsets.c --- linux-2.6.20.orig/arch/um/sys-x86_64/user-offsets.c 2007-02-04 13:44:54.000000000 -0500 +++ linux-2.6.20/arch/um/sys-x86_64/user-offsets.c 2007-03-26 14:55:27.000000000 -0400 @@ -12,7 +12,7 @@ */ typedef __u64 u64; typedef __u32 u32; -#include <asm/user.h> +#include <sys/user.h> #define DEFINE(sym, val) \ asm volatile("\n->" #sym " %0 " #val : : "i" (val)) [-- Attachment #3: Type: text/plain, Size: 345 bytes --] ------------------------------------------------------------------------- Take Surveys. Earn Cash. Influence the Future of IT Join SourceForge.net's Techsay panel and you'll get the chance to share your opinions on IT & business topics through brief surveys-and earn cash http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV [-- Attachment #4: Type: text/plain, Size: 194 bytes --] _______________________________________________ User-mode-linux-devel mailing list User-mode-linux-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/user-mode-linux-devel ^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2007-03-27 2:37 UTC | newest] Thread overview: 6+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2007-03-24 19:33 [uml-devel] missing asm/user.h Daniel Gryniewicz 2007-03-25 1:27 ` Jeff Dike 2007-03-25 3:06 ` Daniel Gryniewicz 2007-03-25 3:36 ` Daniel Gryniewicz 2007-03-25 14:52 ` Jeff Dike 2007-03-27 2:36 ` Daniel Gryniewicz
This is an external index of several public inboxes, see mirroring instructions on how to clone and mirror all data and code used by this external index.