* [uml-devel] SKAS on AMD 64-Bit
@ 2004-08-06 18:41 Anthony Brock
2004-08-15 21:44 ` Anthony Brock
0 siblings, 1 reply; 5+ messages in thread
From: Anthony Brock @ 2004-08-06 18:41 UTC (permalink / raw)
To: user-mode-linux-devel
I would like to implement SKAS on my AMD 64-bit host. However, the current patch applies to files within the i386 arch directory:
# patch -p0 < ../host-skas3-2.6.7-v1.patch
patching file ./arch/i386/kernel/sys_i386.c
patching file ./arch/i386/kernel/ptrace.c
patching file ./arch/i386/kernel/ldt.c
patching file ./arch/i386/Kconfig
patching file ./include/linux/mm.h
patching file ./include/linux/proc_mm.h
patching file ./include/asm-i386/desc.h
patching file ./include/asm-i386/processor.h
patching file ./include/asm-i386/ptrace.h
patching file ./include/asm-i386/mmu_context.h
patching file ./mm/mmap.c
patching file ./mm/mprotect.c
patching file ./mm/proc_mm.c
patching file ./mm/Makefile
Has anyone converted this patch to apply against the x86_64 architecture? Should the changes be relatively transparent (merely a matter of figuring out how to impose them, or do I need to worry about functional changes...)? Any help is greatly appreciated!
Tony
-------------------------------------------------------
This SF.Net email is sponsored by OSTG. Have you noticed the changes on
Linux.com, ITManagersJournal and NewsForge in the past few weeks? Now,
one more big change to announce. We are now OSTG- Open Source Technology
Group. Come see the changes on the new OSTG site. www.ostg.com
_______________________________________________
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] 5+ messages in thread
* RE: [uml-devel] SKAS on AMD 64-Bit
2004-08-06 18:41 [uml-devel] SKAS on AMD 64-Bit Anthony Brock
@ 2004-08-15 21:44 ` Anthony Brock
2004-08-15 23:13 ` Anthony Brock
0 siblings, 1 reply; 5+ messages in thread
From: Anthony Brock @ 2004-08-15 21:44 UTC (permalink / raw)
To: user-mode-linux-devel
Given a lack of responses to my inquiry, I've attempted to migrate the
existing patches to the "arch/i386" and "include/asm-i386" directories to
the corresponding "arch/x86_64" and "include/asm-x86_64" directories.
However, I am experiencing the following issue during boot of a previously
functional guest UML when I use the new Host Kernel:
Checking for the skas3 patch in the host...found
Checking for /proc/mm...found
Linux version 2.6.7-1um (root@vs1) (gcc version 3.3.3 (SuSE Linux)) #2 Thu
Jul 29 08:57:53 PDT 2004
On node 0 totalpages: 122880
DMA zone: 122880 pages, LIFO batch:16
Normal zone: 0 pages, LIFO batch:1
HighMem zone: 0 pages, LIFO batch:1
Built 1 zonelists
*** OUTPUT TRIMMED ***
kjournald starting. Commit interval 5 seconds
EXT3-fs: mounted filesystem with ordered data mode.
VFS: Mounted root (ext3 filesystem) readonly.
Kernel panic: kernel BUG at mm/mmap.c:700!
Any ideas? How would I generate a backtrace for this issue?
I am attaching a copy of the non-functional patch. This patch applies
against a vanilla 2.6.7 kernel with host-skas3-2.6.7-v1.patch pre-applied
(in other words, it's a patch to the SKAS3 patch). Thanks in advance!
Tony
-------------------------------------------------------
SF.Net email is sponsored by Shop4tech.com-Lowest price on Blank Media
100pk Sonic DVD-R 4x for only $29 -100pk Sonic DVD+R for only $33
Save 50% off Retail on Ink & Toner - Free Shipping and Free Gift.
http://www.shop4tech.com/z/Inkjet_Cartridges/9_108_r285
_______________________________________________
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] 5+ messages in thread
* RE: [uml-devel] SKAS on AMD 64-Bit
2004-08-15 21:44 ` Anthony Brock
@ 2004-08-15 23:13 ` Anthony Brock
2004-08-23 15:58 ` BlaisorBlade
2004-08-31 23:08 ` [uml-devel] UML " Qinghua(Kevin) Ye
0 siblings, 2 replies; 5+ messages in thread
From: Anthony Brock @ 2004-08-15 23:13 UTC (permalink / raw)
To: user-mode-linux-devel
[-- Attachment #1: Type: text/plain, Size: 2148 bytes --]
It would probably help if I included the patch! :)
Tony
> -----Original Message-----
> From: user-mode-linux-devel-admin@lists.sourceforge.net
> [mailto:user-mode-linux-devel-admin@lists.sourceforge.net]On Behalf Of
> Anthony Brock
> Sent: Sunday, August 15, 2004 2:44 PM
> To: user-mode-linux-devel@lists.sourceforge.net
> Subject: RE: [uml-devel] SKAS on AMD 64-Bit
>
>
> Given a lack of responses to my inquiry, I've attempted to migrate the
> existing patches to the "arch/i386" and "include/asm-i386" directories to
> the corresponding "arch/x86_64" and "include/asm-x86_64" directories.
>
> However, I am experiencing the following issue during boot of a previously
> functional guest UML when I use the new Host Kernel:
>
> Checking for the skas3 patch in the host...found
> Checking for /proc/mm...found
> Linux version 2.6.7-1um (root@vs1) (gcc version 3.3.3 (SuSE Linux)) #2 Thu
> Jul 29 08:57:53 PDT 2004
> On node 0 totalpages: 122880
> DMA zone: 122880 pages, LIFO batch:16
> Normal zone: 0 pages, LIFO batch:1
> HighMem zone: 0 pages, LIFO batch:1
> Built 1 zonelists
>
> *** OUTPUT TRIMMED ***
>
> kjournald starting. Commit interval 5 seconds
> EXT3-fs: mounted filesystem with ordered data mode.
> VFS: Mounted root (ext3 filesystem) readonly.
> Kernel panic: kernel BUG at mm/mmap.c:700!
>
>
> Any ideas? How would I generate a backtrace for this issue?
>
> I am attaching a copy of the non-functional patch. This patch applies
> against a vanilla 2.6.7 kernel with host-skas3-2.6.7-v1.patch pre-applied
> (in other words, it's a patch to the SKAS3 patch). Thanks in advance!
>
> Tony
>
>
>
> -------------------------------------------------------
> SF.Net email is sponsored by Shop4tech.com-Lowest price on Blank Media
> 100pk Sonic DVD-R 4x for only $29 -100pk Sonic DVD+R for only $33
> Save 50% off Retail on Ink & Toner - Free Shipping and Free Gift.
> http://www.shop4tech.com/z/Inkjet_Cartridges/9_108_r285
> _______________________________________________
> User-mode-linux-devel mailing list
> User-mode-linux-devel@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/user-mode-linux-devel
>
[-- Attachment #2: x86_64-host-skas3-2.6.7-v1.patch --]
[-- Type: application/octet-stream, Size: 7878 bytes --]
diff -ur arch/x86_64/Kconfig.skas arch/x86_64/Kconfig
--- arch/x86_64/Kconfig.skas 2004-06-15 22:19:44.000000000 -0700
+++ arch/x86_64/Kconfig 2004-08-06 14:29:12.447093965 -0700
@@ -249,6 +249,10 @@
cost of slightly increased overhead in some places. If unsure say
N here.
+config PROC_MM
+ bool "/proc/mm support"
+ default y
+
config K8_NUMA
bool "K8 NUMA support"
depends on SMP
diff -ur arch/x86_64/kernel/ldt.c.skas arch/x86_64/kernel/ldt.c
--- arch/x86_64/kernel/ldt.c.skas 2004-06-15 22:20:03.000000000 -0700
+++ arch/x86_64/kernel/ldt.c 2004-08-06 14:25:55.828722076 -0700
@@ -58,7 +58,7 @@
wmb();
pc->size = mincount;
wmb();
- if (reload) {
+ if (reload && (¤t->active_mm->context == pc)) {
#ifdef CONFIG_SMP
cpumask_t mask;
@@ -94,14 +94,12 @@
* we do not have to muck with descriptors here, that is
* done in switch_mm() as needed.
*/
-int init_new_context(struct task_struct *tsk, struct mm_struct *mm)
+int __init_new_context(struct mm_struct *mm, struct mm_struct *old_mm)
{
- struct mm_struct * old_mm;
int retval = 0;
init_MUTEX(&mm->context.sem);
mm->context.size = 0;
- old_mm = current->mm;
if (old_mm && old_mm->context.size > 0) {
down(&old_mm->context.sem);
retval = copy_ldt(&mm->context, &old_mm->context);
@@ -110,6 +108,11 @@
return retval;
}
+int init_new_context(struct task_struct *tsk, struct mm_struct *mm)
+{
+ return __init_new_context(mm, current->mm);
+}
+
/*
*
* Don't touch the LDT register - we're already in the next thread.
@@ -125,11 +128,11 @@
}
}
-static int read_ldt(void __user * ptr, unsigned long bytecount)
+static int read_ldt(struct mm_struct * mm, void __user * ptr,
+ unsigned long bytecount)
{
int err;
unsigned long size;
- struct mm_struct * mm = current->mm;
if (!mm->context.size)
return 0;
@@ -164,10 +167,9 @@
return bytecount;
}
-static int write_ldt(void __user * ptr, unsigned long bytecount, int oldmode)
+static int write_ldt(struct mm_struct * mm, void __user * ptr,
+ unsigned long bytecount, int oldmode)
{
- struct task_struct *me = current;
- struct mm_struct * mm = me->mm;
__u32 entry_1, entry_2, *lp;
int error;
struct user_desc ldt_info;
@@ -192,7 +194,7 @@
down(&mm->context.sem);
if (ldt_info.entry_number >= (unsigned)mm->context.size) {
- error = alloc_ldt(¤t->mm->context, ldt_info.entry_number+1, 1);
+ error = alloc_ldt(&mm->context, ldt_info.entry_number+1, 1);
if (error < 0)
goto out_unlock;
}
@@ -225,23 +227,29 @@
return error;
}
-asmlinkage int sys_modify_ldt(int func, void __user *ptr, unsigned long bytecount)
+int modify_ldt(struct mm_struct * mm, int func, void __user *ptr,
+ unsigned long bytecount)
{
int ret = -ENOSYS;
switch (func) {
case 0:
- ret = read_ldt(ptr, bytecount);
+ ret = read_ldt(mm, ptr, bytecount);
break;
case 1:
- ret = write_ldt(ptr, bytecount, 1);
+ ret = write_ldt(mm, ptr, bytecount, 1);
break;
case 2:
ret = read_default_ldt(ptr, bytecount);
break;
case 0x11:
- ret = write_ldt(ptr, bytecount, 0);
+ ret = write_ldt(mm, ptr, bytecount, 0);
break;
}
return ret;
}
+
+asmlinkage int sys_modify_ldt(int func, void __user *ptr, unsigned long bytecount)
+{
+ return modify_ldt(current->mm, func, ptr, bytecount);
+}
diff -ur arch/x86_64/kernel/ptrace.c.skas arch/x86_64/kernel/ptrace.c
--- arch/x86_64/kernel/ptrace.c.skas 2004-06-15 22:19:09.000000000 -0700
+++ arch/x86_64/kernel/ptrace.c 2004-08-06 14:13:50.589224916 -0700
@@ -17,6 +17,7 @@
#include <linux/user.h>
#include <linux/security.h>
#include <linux/audit.h>
+#include <linux/proc_mm.h>
#include <asm/uaccess.h>
#include <asm/pgtable.h>
@@ -477,6 +478,56 @@
break;
}
+#ifdef CONFIG_PROC_MM
+ case PTRACE_FAULTINFO: {
+ struct ptrace_faultinfo fault;
+
+ fault = ((struct ptrace_faultinfo)
+ { .is_write = child->thread.error_code,
+ .addr = child->thread.cr2 });
+ ret = copy_to_user((unsigned long *) data, &fault,
+ sizeof(fault));
+ if(ret)
+ break;
+ break;
+ }
+
+ case PTRACE_SIGPENDING:
+ ret = copy_to_user((unsigned long *) data,
+ &child->pending.signal,
+ sizeof(child->pending.signal));
+ break;
+
+ case PTRACE_LDT: {
+ struct ptrace_ldt ldt;
+
+ if(copy_from_user(&ldt, (unsigned long *) data,
+ sizeof(ldt))){
+ ret = -EIO;
+ break;
+ }
+ ret = modify_ldt(child->mm, ldt.func, ldt.ptr, ldt.bytecount);
+ break;
+ }
+
+ case PTRACE_SWITCH_MM: {
+ struct mm_struct *old = child->mm;
+ struct mm_struct *new = proc_mm_get_mm(data);
+
+ if(IS_ERR(new)){
+ ret = PTR_ERR(new);
+ break;
+ }
+
+ atomic_inc(&new->mm_users);
+ child->mm = new;
+ child->active_mm = new;
+ mmput(old);
+ ret = 0;
+ break;
+ }
+#endif
+
default:
ret = ptrace_request(child, request, addr, data);
break;
diff -ur arch/x86_64/kernel/sys_x86_64.c.skas arch/x86_64/kernel/sys_x86_64.c
--- arch/x86_64/kernel/sys_x86_64.c.skas 2004-06-15 22:19:37.000000000 -0700
+++ arch/x86_64/kernel/sys_x86_64.c 2004-08-06 13:51:08.308766765 -0700
@@ -38,7 +38,9 @@
return error;
}
-long sys_mmap(unsigned long addr, unsigned long len, unsigned long prot, unsigned long flags,
+long do_mmap2(struct mm_struct *mm,
+ unsigned long addr, unsigned long len,
+ unsigned long prot, unsigned long flags,
unsigned long fd, unsigned long off)
{
long error;
@@ -56,9 +58,9 @@
if (!file)
goto out;
}
- down_write(¤t->mm->mmap_sem);
- error = do_mmap_pgoff(file, addr, len, prot, flags, off >> PAGE_SHIFT);
- up_write(¤t->mm->mmap_sem);
+ down_write(&mm->mmap_sem);
+ error = __do_mmap_pgoff(mm, file, addr, len, prot, flags, off >> PAGE_SHIFT);
+ up_write(&mm->mmap_sem);
if (file)
fput(file);
@@ -66,6 +68,12 @@
return error;
}
+long sys_mmap(unsigned long addr, unsigned long len, unsigned long prot, unsigned long flags,
+ unsigned long fd, unsigned long off)
+{
+ return do_mmap2(current->mm, addr, len, prot, flags, fd, off);
+}
+
static void find_start_end(unsigned long flags, unsigned long *begin,
unsigned long *end)
{
diff -ur include/asm-x86_64/desc.h.skas include/asm-x86_64/desc.h
--- include/asm-x86_64/desc.h.skas 2004-06-15 22:20:26.000000000 -0700
+++ include/asm-x86_64/desc.h 2004-08-06 14:32:39.968349277 -0700
@@ -210,6 +210,9 @@
put_cpu();
}
+extern int modify_ldt(struct mm_struct * mm, int func, void __user *ptr,
+ unsigned long bytecount);
+
#endif /* !__ASSEMBLY__ */
#endif
diff -ur include/asm-x86_64/processor.h.skas include/asm-x86_64/processor.h
--- include/asm-x86_64/processor.h.skas 2004-06-15 22:20:18.000000000 -0700
+++ include/asm-x86_64/processor.h 2004-08-06 14:34:56.998875865 -0700
@@ -454,6 +454,8 @@
ti->task; \
})
+extern int __init_new_context(struct mm_struct *mm, struct mm_struct *old_mm);
+
#define cache_line_size() (boot_cpu_data.x86_cache_alignment)
#ifdef CONFIG_SCHED_SMT
diff -ur include/asm-x86_64/ptrace.h.skas include/asm-x86_64/ptrace.h
--- include/asm-x86_64/ptrace.h.skas 2004-06-15 22:19:03.000000000 -0700
+++ include/asm-x86_64/ptrace.h 2004-08-06 14:38:35.353933414 -0700
@@ -110,4 +110,26 @@
#endif
+/*For SKAS3 support.*/
+#ifndef _LINUX_PTRACE_STRUCT_DEF
+#define _LINUX_PTRACE_STRUCT_DEF
+
+#define PTRACE_FAULTINFO 52
+#define PTRACE_SIGPENDING 53
+#define PTRACE_LDT 54
+#define PTRACE_SWITCH_MM 55
+
+struct ptrace_faultinfo {
+ int is_write;
+ unsigned long addr;
+};
+
+struct ptrace_ldt {
+ int func;
+ void *ptr;
+ unsigned long bytecount;
+};
+
+#endif /*ifndef _LINUX_PTRACE_STRUCT_DEF*/
+
#endif
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [uml-devel] SKAS on AMD 64-Bit
2004-08-15 23:13 ` Anthony Brock
@ 2004-08-23 15:58 ` BlaisorBlade
2004-08-31 23:08 ` [uml-devel] UML " Qinghua(Kevin) Ye
1 sibling, 0 replies; 5+ messages in thread
From: BlaisorBlade @ 2004-08-23 15:58 UTC (permalink / raw)
To: user-mode-linux-devel; +Cc: Anthony Brock
Alle 01:13, lunedì 16 agosto 2004, Anthony Brock ha scritto:
> It would probably help if I included the patch! :)
Hmmm... are you trying to run a normal UML binary, I guess, i.e. a 32-bit app
which would also run onto a x86 pc, right? 64bit UMLs don't support well the
SKAS mode (actually, I never tested this, but there are some significant
changes in the SKAS code in the x86_64-UML patch).
I wrote a patch for this, applying onto a vanilla 2.4 kernel tree, but I never
tested it (not even if it compiled). And I'm rechecking it, and there are
some bugs in it.
About your patch, there is just a big bug in your patch (if you want to run a
*32* bit UML): when a 32 bit app invokes a syscall, let's say mmap, actually
it calls the sys32_ version of it, if that one exists, in this case
sys32_mmap. You can check the name of the syscall functions in
arch/x86_64/ia32/ia32entry.S. There are some such bugs in my patch, too, in
fact. However, when I come back (I'm on holidays and far from Internet -
today is 23 August), if you want to help (i.e. actually test the patches),
just email me and I'll finish the porting and publish it.
--
Paolo Giarrusso, aka Blaisorblade
Linux registered user n. 292729
-------------------------------------------------------
This SF.Net email is sponsored by BEA Weblogic Workshop
FREE Java Enterprise J2EE developer tools!
Get your free copy of BEA WebLogic Workshop 8.1 today.
http://ads.osdn.com/?ad_idP47&alloc_id\x10808&opÌk
_______________________________________________
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] 5+ messages in thread
* [uml-devel] UML on AMD 64-Bit
2004-08-15 23:13 ` Anthony Brock
2004-08-23 15:58 ` BlaisorBlade
@ 2004-08-31 23:08 ` Qinghua(Kevin) Ye
1 sibling, 0 replies; 5+ messages in thread
From: Qinghua(Kevin) Ye @ 2004-08-31 23:08 UTC (permalink / raw)
To: Anthony Brock, user-mode-linux-devel
Hi,
Does there any released patch for AMD 64 system? Thanks.
Regards,
Qinghua(Kevin) Ye
-------------------------------------------------------
This SF.Net email is sponsored by BEA Weblogic Workshop
FREE Java Enterprise J2EE developer tools!
Get your free copy of BEA WebLogic Workshop 8.1 today.
http://ads.osdn.com/?ad_id=5047&alloc_id=10808&op=click
_______________________________________________
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] 5+ messages in thread
end of thread, other threads:[~2004-08-31 23:05 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2004-08-06 18:41 [uml-devel] SKAS on AMD 64-Bit Anthony Brock
2004-08-15 21:44 ` Anthony Brock
2004-08-15 23:13 ` Anthony Brock
2004-08-23 15:58 ` BlaisorBlade
2004-08-31 23:08 ` [uml-devel] UML " Qinghua(Kevin) Ye
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.