Skip to contentSkip to conversation

UML - SYSEMU fixes

PATCH In review Jeff Dike 4 participants 8 messages Dec 3, 2004 – Dec 7, 2004 User-mode Linux (UML)

lore
Share & tools
lore

Jeff Dike

author
#0 lore raw

PATCH 1/1 UML - SYSEMU fixes

From: Bodo Stroesser <[email protected]>

Usage of SYSEMU in TT mode is modified, so that always the same method is used in do_syscall as has been used before in ptrace(PTRACE_SYSCALL/SYSEMU, ...)

arch/um/kernel/tt/include/tt.h +1 -1
Index: 2.6.9/arch/um/kernel/tt/include/tt.h
===================================================================
@@ -26,7 +26,7 @@
 extern int is_tracing(void *task);
 extern void syscall_handler(int sig, union uml_pt_regs *regs);
 extern void exit_kernel(int pid, void *task);
-extern int do_syscall(void *task, int pid, int local_using_sysemu);
+extern void do_syscall(void *task, int pid, int local_using_sysemu);
 extern void do_sigtrap(void *task);
 extern int is_valid_pid(int pid);
 extern void remap_data(void *segment_start, void *segment_end, int w);
arch/um/kernel/tt/syscall_user.c +3 -6
Index: 2.6.9/arch/um/kernel/tt/syscall_user.c
===================================================================
@@ -48,7 +48,7 @@
 	UPT_SYSCALL_NR(TASK_REGS(task)) = -1;
 }
 
-int do_syscall(void *task, int pid, int local_using_sysemu)
+void do_syscall(void *task, int pid, int local_using_sysemu)
 {
 	unsigned long proc_regs[FRAME_SIZE];
 
@@ -62,14 +62,11 @@
 	   ((unsigned long *) PT_IP(proc_regs) <= &_etext))
 		tracer_panic("I'm tracing myself and I can't get out");
 
-	if(local_using_sysemu)
-		return(1);
-
+	/* syscall number -1 in sysemu skips syscall restarting in host */
 	if(ptrace(PTRACE_POKEUSER, pid, PT_SYSCALL_NR_OFFSET, 
-		  __NR_getpid) < 0)
+		  local_using_sysemu ? -1 : __NR_getpid) < 0)
 		tracer_panic("do_syscall : Nullifying syscall failed, "
 			     "errno = %d", errno);
-	return(1);
 }
 
 /*
arch/um/kernel/tt/tracer.c +4 -4
Index: 2.6.9/arch/um/kernel/tt/tracer.c
===================================================================
@@ -186,7 +186,7 @@
 	unsigned long eip = 0;
 	int status, pid = 0, sig = 0, cont_type, tracing = 0, op = 0;
 	int last_index, proc_id = 0, n, err, old_tracing = 0, strace = 0;
-	int pt_syscall_parm, local_using_sysemu;
+	int pt_syscall_parm, local_using_sysemu = 0;
 
 	signal(SIGPIPE, SIG_IGN);
 	setup_tracer_winch();
@@ -307,9 +307,6 @@
 			if ( tracing )
 				do_sigtrap(task);
 
-			local_using_sysemu = get_using_sysemu();
-			pt_syscall_parm = local_using_sysemu ? PTRACE_SYSEMU : PTRACE_SYSCALL;
-
 			switch(sig){
 			case SIGUSR1:
 				sig = 0;
@@ -393,6 +390,9 @@
 				continue;
 			}
 
+			local_using_sysemu = get_using_sysemu();
+			pt_syscall_parm = local_using_sysemu ? PTRACE_SYSEMU : PTRACE_SYSCALL;
+
 			if(tracing){
 				if(singlestepping(task))
 					cont_type = PTRACE_SINGLESTEP;
#1 lore raw
Quoted 3 lines · Jeff Dike

Usage of SYSEMU in TT mode is modified, so that always the same method is used in do_syscall as has been used before in ptrace(PTRACE_SYSCALL/SYSEMU, ...)

That's great, but do any of these patches address various undefines in arch/um/kernel/process.c:check_sysemu when built without skas?

Jon.

#2 lore raw
Quoted 8 lines · Jon Masters
Quoted 3 lines · Jeff Dike

Usage of SYSEMU in TT mode is modified, so that always the same method is used in do_syscall as has been used before in ptrace(PTRACE_SYSCALL/SYSEMU, ...)

That's great, but do any of these patches address various undefines in arch/um/kernel/process.c:check_sysemu when built without skas?

Also, on 2.6.9, I get dud CFLAGS defined when CONFIG_PROF is set *and* CONFIG_FRAME_POINTER is also set - gcc complains about use of "-gp" and "-fomit-frame-pointer" but surely it should be building with frame pointers anyway if I've asked it to do so?

Jon.

author
#3 lore raw
In reply to Jon Masters
Quoted 2 lines · [email protected] said:

That's great, but do any of these patches address various undefines in arch/um/kernel/process.c:check_sysemu when built without skas?

Apparently they did. I just checked with skas turned off and got a successful build.

Quoted 4 lines

Also, on 2.6.9, I get dud CFLAGS defined when CONFIG_PROF is set *and* CONFIG_FRAME_POINTER is also set - gcc complains about use of "-gp" and "-fomit-frame-pointer" but surely it should be building with frame pointers anyway if I've asked it to do so?

I just checked with that config, and it builds fine.

Jeff

#4 lore raw

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Jeff Dike wrote:

| [email protected] said:
|
|>That's great, but do any of these patches address various undefines in
|>arch/um/kernel/process.c:check_sysemu when built without skas?
|
|
| Apparently they did.  I just checked with skas turned off and got a

successful
| build.

Good. I've got a working build on an Intel box but it's being more stubburn building for ppc in 2.6.9 - I'll post an update when I've actually looked at it.

|>Also, on 2.6.9, I get dud CFLAGS defined when CONFIG_PROF is set *and*
|>CONFIG_FRAME_POINTER is also set - gcc complains about use of "-gp"
|>and "-fomit-frame-pointer" but surely it should be building with frame
|>pointers anyway if I've asked it to do so?
|
|
| I just checked with that config, and it builds fine.

Oh good. Then it works now.

Cheers,

Jon.
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.2 (GNU/Linux)
Comment: Using GnuPG with Thunderbird - http://enigmail.mozdev.org

iD8DBQFBsw1reTyyexZHHxERAs34AJ9yXOHe84a73sy81zC3hfSApH67NwCfZPlq xWiHY1jlmBPftJeIfgtbur4=
=NxJe
-----END PGP SIGNATURE-----

#5 lore raw
Quoted 10 lines · Jon Masters

Jeff Dike wrote:

| [email protected] said:
|>That's great, but do any of these patches address various undefines in
|>arch/um/kernel/process.c:check_sysemu when built without skas?

| Apparently they did. I just checked with skas turned off and got a

successful

| build.

They don't - check_sysemu is used also in TT mode.

Quoted 3 lines

Good. I've got a working build on an Intel box but it's being more stubburn building for ppc in 2.6.9 - I'll post an update when I've actually looked at it.

PPC port is not maintained at the moment - there are some rumors of somebody reviving it, but nothing is certain.

Quoted 4 lines
|>Also, on 2.6.9, I get dud CFLAGS defined when CONFIG_PROF is set *and*
|>CONFIG_FRAME_POINTER is also set - gcc complains about use of "-gp"
|>and "-fomit-frame-pointer" but surely it should be building with frame
|>pointers anyway if I've asked it to do so?

I saw that from someone else - I don't remember what was the problem, but it seemed to be some strange kind of .config. Make sure that CONFIG_DEBUG_INFO and CONFIG_FRAME_POINTER are both set (the second is the needed one, the first implies the second for UML).

"make oldconfig ARCH=um" should fix such problems.

Quoted 7 lines

| I just checked with that config, and it builds fine.

Oh good. Then it works now.

Cheers,

Jon.

Signature · 3 lines
Paolo Giarrusso, aka Blaisorblade
Linux registered user n. 292729
http://www.user-mode-linux.org/~blaisorblade
#6 lore raw

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Blaisorblade wrote:

| On Sunday 05 December 2004 14:30, Jon Masters wrote:

|>Jeff Dike wrote:
|>| [email protected] said:
|>|>That's great, but do any of these patches address various undefines in
|>|>arch/um/kernel/process.c:check_sysemu when built without skas?
|>| Apparently they did.  I just checked with skas turned off and got a
|>| successful build.

| They don't - check_sysemu is used also in TT mode.

I wasn't building for me, but I've not applied these patches yet.

|>Good. I've got a working build on an Intel box but it's being more
|>stubburn building for ppc in 2.6.9 - I'll post an update when I've
|>actually looked at it.

| PPC port is not maintained at the moment - there are some rumors of somebody
| reviving it, but nothing is certain.

I want it for unrelated reasons, but I don't want to say I'll do it because I probably won't find some time to do it :-)

(I will look though - it would be nice to have UML building on ppc since that's what I have with me most of the time)

|>|>Also, on 2.6.9, I get dud CFLAGS defined when CONFIG_PROF is set *and*
|>|>CONFIG_FRAME_POINTER is also set - gcc complains about use of "-gp"
|>|>and "-fomit-frame-pointer" but surely it should be building with frame
|>|>pointers anyway if I've asked it to do so?

| I saw that from someone else - I don't remember what was the problem, but it
| seemed to be some strange kind of .config. Make sure that CONFIG_DEBUG_INFO

| and CONFIG_FRAME_POINTER are both set (the second is the needed one, the
| first implies the second for UML).
|
| "make oldconfig ARCH=um" should fix such problems.

Nope. My config wasn't that strange either - but I'm perfectly able to figure out why it's breaking though. I just wanted to mention it.

Jon.
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.2 (GNU/Linux)
Comment: Using GnuPG with Thunderbird - http://enigmail.mozdev.org

iD8DBQFBtPHKeTyyexZHHxERAuNaAJ9VlY9c//XhS/OtkcoVU1jl0KGIhQCgifyp tgaWdko23Sztn76TyCGEbPg=
=SHSz
-----END PGP SIGNATURE-----

#7 lore raw
Quoted 22 lines · Jon Masters

Blaisorblade wrote:

| On Sunday 05 December 2004 14:30, Jon Masters wrote:
|>Jeff Dike wrote:
|>| [email protected] said:
|>|>That's great, but do any of these patches address various undefines in
|>|>arch/um/kernel/process.c:check_sysemu when built without skas?
|>|
|>| Apparently they did.  I just checked with skas turned off and got a
|>| successful build.
|
| They don't - check_sysemu is used also in TT mode.

I wasn't building for me, but I've not applied these patches yet.

|>Good. I've got a working build on an Intel box but it's being more
|>stubburn building for ppc in 2.6.9 - I'll post an update when I've
|>actually looked at it.
|
| PPC port is not maintained at the moment - there are some rumors of

somebody

Quoted 7 lines

| reviving it, but nothing is certain.

I want it for unrelated reasons, but I don't want to say I'll do it because I probably won't find some time to do it :-)

(I will look though - it would be nice to have UML building on ppc since that's what I have with me most of the time)

If you search on uml-devel and/or uml-user:

http://marc.theaimsgroup.com/?l=user-mode-linux-user&r=1&w=2

http://marc.theaimsgroup.com/?l=user-mode-linux-devel&r=1&w=2

you'll find

Quoted 13 lines
|>|>Also, on 2.6.9, I get dud CFLAGS defined when CONFIG_PROF is set *and*
|>|>CONFIG_FRAME_POINTER is also set - gcc complains about use of "-gp"
|>|>and "-fomit-frame-pointer" but surely it should be building with frame
|>|>pointers anyway if I've asked it to do so?
|
| I saw that from someone else - I don't remember what was the problem,

but it

| seemed to be some strange kind of .config. Make sure that

CONFIG_DEBUG_INFO

Quoted 7 lines
| and CONFIG_FRAME_POINTER are both set (the second is the needed one, the
| first implies the second for UML).
|
| "make oldconfig ARCH=um" should fix such problems.

Nope. My config wasn't that strange either - but I'm perfectly able to figure out why it's breaking though. I just wanted to mention it.

Yes, that's always appreciated... however, the dependencies between options seem correct, i.e. you can enable the -pg flag (for Gprof, IIRC) only if you have enabled debugging info, which also disables -fomit-frame-pointer.

Quoted 1 line

Jon.

Signature · 3 lines
Paolo Giarrusso, aka Blaisorblade
Linux registered user n. 292729
http://www.user-mode-linux.org/~blaisorblade