linux-um archives
 help / color / mirror / Atom feed
* RE: [uml-devel] Minor problems with interrupted systemcalls
@ 2004-09-22 17:12 Stroesser, Bodo
  2004-09-24 21:32 ` Jeff Dike
                   ` (4 more replies)
  0 siblings, 5 replies; 12+ messages in thread
From: Stroesser, Bodo @ 2004-09-22 17:12 UTC (permalink / raw)
  To: user-mode-linux-devel; +Cc: BlaisorBlade, Jeff Dike

On Tuesday 21 September 2004 19:31, BlaisorBlade wrote:

> ...
> Ignoring a return value for a good reason should always be documented
in the code as you did here - also, the i386 handle_signal() returns a
void, while here we must understand just how to handle this - should
kern_do_signal return 0 or 1?
> 
> Actually, do_signal is not standard among archs, and its return value
it's either ignored or used as whether the syscall is interrupted or not
(for sigsuspend and such, below).
> ...
> Yes, I agree they should be similar. Er, shouldn't the check "Did we
come from a syscall" be added like in i386 to handle_signal too? The
"ERESTART_*" 
handling in handle_signal is at least useless in case we are not
handling a syscall, and may cause bugs (I'm not sure here, but why
bother?).
> ...

Thank you for pointing out this!

Thinking about it lead me to a bug in the patch. Systemcall restarting
never was done, if a signal handler had to be started. The problem came
from removing the call to do_signal(result) in syscall_handler_tt() and
handle_syscall() (The argument "result" had been the syscall-result read
from the regs). Now do_signal() is called only with parameter "0" or
"-EINTR", so no syscall restart is done.

To fix the problem, I made a new patch. Now
- handle_signal() is void
- do_signal() no longer takes a parameter
- syscall restarting is always based on the result found in the regs and
is done only if "we come from a syscall"
- sys_sigsuspend() and sys_rt_sigsuspend() write -EINTR into the regs
before calling kern_do_signal()
- I did some reordering of the code in handle_signal()/kern_do_signal()
to be more similar to i386.
I hope, now it works correctly and the code is as similar to i386 as
possible.

I tested with 2.6.8.1-1 + incremental patches up to September 12, 2004
(hope, the tests were more complete than the last time ...), it works
fine for me. You'll find the new patch at the end of this mail.

There are two more issues:

- 2.6.8.1-1 panics on my host, which doesn't support sysemu. Last Monday
I wrote a mail "(no subject)"  (sorry, i missed to give it a title)
about this with a patch appended. This patch helps for me, but is it the
right place to patch? What did happen exactly?

- Did you read the last part of kern_do_signal() regarding
singlestepping syscalls? The comments are about tt-mode only (tracing
thread ...), but it's a problem in skas-mode too! I wrote a little test
that forks, then the child is singlestepped by the parent. In tt-mode it
works fine, but in skas-mode the singlestepped systemcalls are executed
on the host! Even more: bad guys could write a program using "sysenter"
instead of "int 0x80" and they could execute their syscall on the host
in tt- and skas-mode. I've tried to do that, and I could do it. Even the
hosts vsyscall-page helped me, because it is executable for user
programs in UML, but can't be read via ptrace( PEEKTEXT, ...). And: if a
invalid systemcall number is passed in eax, the host will skip all
syscall handling, so the next "singlestep"-trap visible to a uml-user
will be after the next valid systemcall. I am working to create a patch
for this all. Do you think, I should integrate it with the systemcall
restart patch below before sending to LKML?

Greets 
Bodo




--- orig/arch/um/kernel/tt/syscall_user.c	2004-09-22
12:46:00.508456961 +0200
+++ new/arch/um/kernel/tt/syscall_user.c	2004-09-22
12:49:23.409926312 +0200
@@ -17,10 +17,6 @@
 #include "syscall_user.h"
 #include "tt.h"
 
-/* XXX Bogus */
-#define ERESTARTSYS	512
-#define ERESTARTNOINTR	513
-#define ERESTARTNOHAND	514
 
 void syscall_handler_tt(int sig, union uml_pt_regs *regs)
 {
@@ -42,9 +38,6 @@
 	UPT_SC(regs) = sc;
 
 	SC_SET_SYSCALL_RETURN(sc, result);
-	if((result == -ERESTARTNOHAND) || (result == -ERESTARTSYS) || 
-	   (result == -ERESTARTNOINTR))
-		do_signal(result);
 
 	syscall_trace(regs, 0);
 	record_syscall_end(index, result);
@@ -63,7 +56,7 @@
 	regs = TASK_REGS(task);
 	UPT_SYSCALL_NR(regs) = syscall;
 
-	if(syscall < 1) return(0);
+	if(syscall < 0) return(0);
 
 	if((syscall != __NR_sigreturn) &&
 	   ((unsigned long *) PT_IP(proc_regs) >= &_stext) && 
--- orig/arch/um/kernel/skas/syscall_user.c	2004-09-22
12:45:54.685419251 +0200
+++ new/arch/um/kernel/skas/syscall_user.c	2004-09-22
12:49:23.409926312 +0200
@@ -10,10 +10,6 @@
 #include "sysdep/ptrace.h"
 #include "sysdep/sigcontext.h"
 
-/* XXX Bogus */
-#define ERESTARTSYS	512
-#define ERESTARTNOINTR	513
-#define ERESTARTNOHAND	514
 
 void handle_syscall(union uml_pt_regs *regs)
 {
@@ -26,9 +22,6 @@
 	result = execute_syscall(regs);
 
 	REGS_SET_SYSCALL_RETURN(regs->skas.regs, result);
-	if((result == -ERESTARTNOHAND) || (result == -ERESTARTSYS) || 
-	   (result == -ERESTARTNOINTR))
-		do_signal(result);
 
 	syscall_trace(regs, 0);
 	record_syscall_end(index, result);
--- orig/arch/um/kernel/skas/process.c	2004-09-22 12:46:00.508456961
+0200
+++ new/arch/um/kernel/skas/process.c	2004-09-22 13:33:58.479855435
+0200
@@ -63,7 +63,7 @@
 
 	syscall_nr = PT_SYSCALL_NR(regs->skas.regs);
 	UPT_SYSCALL_NR(regs) = syscall_nr;
-	if(syscall_nr < 1){
+	if(syscall_nr < 0){
 		relay_signal(SIGTRAP, regs);
 		return;
 	}
--- orig/arch/um/kernel/process_kern.c	2004-09-22 12:45:54.679420243
+0200
+++ new/arch/um/kernel/process_kern.c	2004-09-22 13:19:07.593079661
+0200
@@ -137,7 +137,7 @@
 void interrupt_end(void)
 {
 	if(need_resched()) schedule();
-	if(test_tsk_thread_flag(current, TIF_SIGPENDING)) do_signal(0);
+	if(test_tsk_thread_flag(current, TIF_SIGPENDING)) do_signal();
 }
 
 void release_thread(struct task_struct *task)
--- orig/arch/um/kernel/signal_kern.c	2004-09-22 12:45:54.681419912
+0200
+++ new/arch/um/kernel/signal_kern.c	2004-09-22 13:46:01.701338876
+0200
@@ -49,48 +49,53 @@
 /*
  * OK, we're invoking a handler
  */	
-static int handle_signal(struct pt_regs *regs, unsigned long signr, 
-			 struct k_sigaction *ka, siginfo_t *info, 
-			 sigset_t *oldset, int error)
+static void handle_signal(struct pt_regs *regs, unsigned long signr, 
+			  siginfo_t *info, sigset_t *oldset)
 {
-        __sighandler_t handler;
+	struct k_sigaction *ka = &current->sighand->action[signr -1];
 	void (*restorer)(void);
 	unsigned long sp;
-	sigset_t save;
-	int err, ret;
+	int err;
 
-	ret = 0;
 	/* Always make any pending restarted system calls return -EINTR
*/
 	current_thread_info()->restart_block.fn = do_no_restart_syscall;
-	switch(error){
-	case -ERESTART_RESTARTBLOCK:
-	case -ERESTARTNOHAND:
-		ret = -EINTR;
-		break;
-
-	case -ERESTARTSYS:
-		if (!(ka->sa.sa_flags & SA_RESTART)) {
-			ret = -EINTR;
-			break;
+
+	/* Did we come from a system call? */
+	if(PT_REGS_SYSCALL_NR(regs) >= 0){
+		/* If so, check system call restarting.. */
+		switch(PT_REGS_SYSCALL_RET(regs)){
+			case -ERESTART_RESTARTBLOCK:
+			case -ERESTARTNOHAND:
+				PT_REGS_SYSCALL_RET(regs) = -EINTR;
+				break;
+
+			case -ERESTARTSYS:
+				if (!(ka->sa.sa_flags & SA_RESTART)) {
+					PT_REGS_SYSCALL_RET(regs) =
-EINTR;
+					break;
+				}
+			/* fallthrough */
+			case -ERESTARTNOINTR:
+				PT_REGS_RESTART_SYSCALL(regs);
+				PT_REGS_ORIG_SYSCALL(regs) =
PT_REGS_SYSCALL_NR(regs);
 		}
-		/* fallthrough */
-	case -ERESTARTNOINTR:
-		PT_REGS_RESTART_SYSCALL(regs);
-		PT_REGS_ORIG_SYSCALL(regs) = PT_REGS_SYSCALL_NR(regs);
-
-		/* This is because of the UM_SET_SYSCALL_RETURN and the
fact
-		 * that on i386 the system call number and return value
are
-		 * in the same register.  When the system call restarts,
%eax
-		 * had better have the system call number in it.  Since
the
-		 * return value doesn't matter (except that it shouldn't
be
-		 * -ERESTART*), we'll stick the system call number
there.
-		 */
-		ret = PT_REGS_SYSCALL_NR(regs);
-		break;
 	}
 
-	handler = ka->sa.sa_handler;
-	save = *oldset;
+	sp = PT_REGS_SP(regs);
+	if((ka->sa.sa_flags & SA_ONSTACK) && (sas_ss_flags(sp) == 0))
+		sp = current->sas_ss_sp + current->sas_ss_size;
+	
+	if (ka->sa.sa_flags & SA_RESTORER) restorer =
ka->sa.sa_restorer;
+	else restorer = NULL;
+
+	if(ka->sa.sa_flags & SA_SIGINFO)
+		err = setup_signal_stack_si(sp, signr, (unsigned long)
ka->sa.sa_handler,
+					    restorer, regs, info,
oldset);
+	else
+		err = setup_signal_stack_sc(sp, signr, (unsigned long)
ka->sa.sa_handler,
+					    restorer, regs, oldset);
+	if(err)
+		force_segv(signr);
 
 	if (ka->sa.sa_flags & SA_ONESHOT)
 		ka->sa.sa_handler = SIG_DFL;
@@ -104,47 +109,23 @@
 		spin_unlock_irq(&current->sighand->siglock);
 	}
 
-	sp = PT_REGS_SP(regs);
-
-	if((ka->sa.sa_flags & SA_ONSTACK) && (sas_ss_flags(sp) == 0))
-		sp = current->sas_ss_sp + current->sas_ss_size;
-	
-	if(error != 0) PT_REGS_SET_SYSCALL_RETURN(regs, ret);
-
-	if (ka->sa.sa_flags & SA_RESTORER) restorer =
ka->sa.sa_restorer;
-	else restorer = NULL;
-
-	if(ka->sa.sa_flags & SA_SIGINFO)
-		err = setup_signal_stack_si(sp, signr, (unsigned long)
handler,
-					    restorer, regs, info,
&save);
-	else
-		err = setup_signal_stack_sc(sp, signr, (unsigned long)
handler,
-					    restorer, regs, &save);
-	if(err) goto segv;
-
-	return(0);
- segv:
-	force_segv(signr);
-	return(1);
+	return;
 }
 
-static int kern_do_signal(struct pt_regs *regs, sigset_t *oldset, int
error)
+static int kern_do_signal(struct pt_regs *regs, sigset_t *oldset)
 {
 	siginfo_t info;
-	struct k_sigaction *ka;
-	int err, sig;
+	int sig;
 
 	if (!oldset)
 		oldset = &current->blocked;
 
 	sig = get_signal_to_deliver(&info, regs, NULL);
-	if(sig == 0)
-		return(0);
-
-	/* Whee!  Actually deliver the signal.  */
-	ka = &current->sighand->action[sig -1 ];
-	err = handle_signal(regs, sig, ka, &info, oldset, error);
-	if(!err) return(1);
+	if(sig > 0) {
+		/* Whee!  Actually deliver the signal.  */
+		handle_signal(regs, sig, &info, oldset);
+		return(1);
+	}
 
 	/* Did we come from a system call? */
 	if(PT_REGS_SYSCALL_NR(regs) >= 0){
@@ -174,9 +155,9 @@
 	return(0);
 }
 
-int do_signal(int error)
+int do_signal( void)
 {
-	return(kern_do_signal(&current->thread.regs, NULL, error));
+	return(kern_do_signal(&current->thread.regs, NULL));
 }
 
 /*
@@ -193,10 +174,11 @@
 	recalc_sigpending();
 	spin_unlock_irq(&current->sighand->siglock);
 
+	PT_REGS_SYSCALL_RET(&current->thread.regs) = -EINTR;
 	while (1) {
 		current->state = TASK_INTERRUPTIBLE;
 		schedule();
-		if(kern_do_signal(&current->thread.regs, &saveset,
-EINTR))
+		if(kern_do_signal(&current->thread.regs, &saveset))
 			return(-EINTR);
 	}
 }
@@ -219,10 +201,11 @@
 	recalc_sigpending();
 	spin_unlock_irq(&current->sighand->siglock);
 
+	PT_REGS_SYSCALL_RET(&current->thread.regs) = -EINTR;
 	while (1) {
 		current->state = TASK_INTERRUPTIBLE;
 		schedule();
-		if (kern_do_signal(&current->thread.regs, &saveset,
-EINTR))
+		if (kern_do_signal(&current->thread.regs, &saveset))
 			return(-EINTR);
 	}
 }
--- orig/arch/um/include/kern_util.h	2004-09-22 12:45:54.661423217
+0200
+++ new/arch/um/include/kern_util.h	2004-09-22 13:18:39.944648725
+0200
@@ -29,7 +29,7 @@
 extern void syscall_segv(int sig);
 extern int current_pid(void);
 extern unsigned long alloc_stack(int order, int atomic);
-extern int do_signal(int error);
+extern int do_signal(void);
 extern int is_stack_fault(unsigned long sp);
 extern unsigned long segv(unsigned long address, unsigned long ip, 
 			  int is_write, int is_user, void *sc);


-------------------------------------------------------
This SF.Net email is sponsored by: YOU BE THE JUDGE. Be one of 170
Project Admins to receive an Apple iPod Mini FREE for your judgement on
who ports your project to Linux PPC the best. Sponsored by IBM.
Deadline: Sept. 24. Go here: http://sf.net/ppc_contest.php
_______________________________________________
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] 12+ messages in thread
* RE: [uml-devel] Minor problems with interrupted systemcalls
@ 2004-09-29 16:34 Stroesser, Bodo
  2004-09-29 21:10 ` Jeff Dike
  0 siblings, 1 reply; 12+ messages in thread
From: Stroesser, Bodo @ 2004-09-29 16:34 UTC (permalink / raw)
  To: Jeff Dike; +Cc: user-mode-linux-devel, BlaisorBlade

Jeff Dike <jdike@addtoit.com> said:
> OK, following is my breakup of your signal patch.  It all looks right
to me, and cleans up that code nicely.  Let me know if you see any
problems here.
> 
> These are also available from the incremental patches page
> 	http://user-mode-linux.sourceforge.net/patches.html
> and I would appreciate testing.
> 
> This one changes the do_signal interface to eliminate its argument.
Also, remove the calls from the system call handlers since they are
redundant.  In > all cases, pending signals are checked for in the
interrupt handler.
> Temporarily, do_signal passes the current error to kern_do_signal.
> 
> 				Jeff

Thank you.

I've tested the patches. AFAICS it works well.
A small piece of code regarding SA_ONESHOT should be removed only. In
2.6.9 this is done in get_signal_to_deliver(), and since
get_signal_to_deliver() writes a copy of the corresponding k_sigaction
into caller's ka_copy, it is a real NOOP.

Still, there is something wrong with error handling in case, that a
signal handler couldn't be started (i.E. stack limit reached or signal
stack invalid). This is a problem not only for UML, but with i386, too.
I will try to fix it for UML with separate patches.

Bodo


--- orig/arch/um/kernel/signal_kern.c	2004-09-29 18:15:46.505334183
+0200
+++ new/arch/um/kernel/signal_kern.c	2004-09-29 18:16:37.813855152
+0200
@@ -88,9 +88,6 @@
 					    (unsigned long)
ka->sa.sa_handler,
 					    restorer, regs, oldset);
 
-	if (ka->sa.sa_flags & SA_ONESHOT)
-		ka->sa.sa_handler = SIG_DFL;
-
 	if (!(ka->sa.sa_flags & SA_NODEFER)) {
 		spin_lock_irq(&current->sighand->siglock);
 		sigorsets(&current->blocked, &current->blocked, 


-------------------------------------------------------
This SF.net email is sponsored by: IT Product Guide on ITManagersJournal
Use IT products in your business? Tell us what you think of them. Give us
Your Opinions, Get Free ThinkGeek Gift Certificates! Click to find out more
http://productguide.itmanagersjournal.com/guidepromo.tmpl
_______________________________________________
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] 12+ messages in thread
* RE: [uml-devel] Minor problems with interrupted systemcalls
@ 2004-09-20 10:06 Stroesser, Bodo
  2004-09-21 17:31 ` BlaisorBlade
  0 siblings, 1 reply; 12+ messages in thread
From: Stroesser, Bodo @ 2004-09-20 10:06 UTC (permalink / raw)
  To: user-mode-linux-devel; +Cc: BlaisorBlade, Jeff Dike

Before commenting the patch in detail, let me try to explain, what I
found out about interrupted systemcalls. I didn't find any
documentation, so my knowledge comes from mailing lists and kernel code
(I evaluated i386 and s390 too). In case I've missed some facts, please
correct me!

Linux 2.6 syscall-handler use the results -ERESTARTSYS, -ERESTARTNOHAND,
ERESTARTNOINTR and -ERESTART_RESTARTBLOCK to tell do_signal(), that a
systemcall has been interrupted. The user never should see these codes,
because they are replaced by -EINTR, when the appropriate action has
been taken by do_signal(). Depending on the result and the disposition
for the signal which interrupted the systemcall, the systemcall restart
should be done or not.
If no signal handler has to be started for a signal (or no unblocked
signal is pending), get_signal_to deliver() will return 0, otherwise it
will return the number of the signal, for which a handler must be
started.
A systemcall restart should be done for
-ERESTARTSYS, if no handler has to be started or SA_RESTART is set in
the signal disposition
-ERESTARTNOHAND, if no handler has to be started
-ERESTARTNOINTR, always
-ERESTART_RESTARTBLOCK, if no handler has to be started, but with a
different systemcall number (__NR_restart_syscall). Special parameters
for that call are stored in the task's restartblock by the interrupted
systemcall handler.
If no systemcall restart is performed, the result has to be set to
-EINTR.

Further comments see below.

-----Original Message-----
> From: BlaisorBlade [mailto:blaisorblade_spam@yahoo.it] 
> Sent: Saturday, September 18, 2004 6:17 PM
> To: user-mode-linux-devel@lists.sourceforge.net; Jeff Dike
> Cc: Stroesser, Bodo
> Subject: Re: [uml-devel] Minor problems with interrupted systemcalls
> 
> On Friday 17 September 2004 19:46, Stroesser, Bodo wrote:
> > If a program is traced or debugged, in 2.6.x interrupted systemcalls
> > with the results -ERESTARTxxxxxxx are not handled correctly, no
> > systemcall restart is done.
> >
> > Here is a patch that should fix the problem. The patch is tested on
> > 2.6.6 in tt and skas modes. It applies to 2.6.8.1, but I've not
tested
> > yet.
> >
> > Hope, this helps.
> 
> I read the patch a bit and I understand and agree on most changes;
nice job, 
> mostly. However, I don't like at all the changes to 
> arch/um/kernel/signal_kern.c.
> 
> Could you explain them in more detail, and clean up this part of the
patch? 
> Comments come below.
> 
> > --- uml_orig/arch/um/kernel/signal_kern.c 2004-08-05
18:36:24.000000000 +0200
> > +++ uml/arch/um/kernel/signal_kern.c      2004-09-17
15:03:30.441065600 +0200
> > @@ -132,19 +132,18 @@
> >  {
> >       siginfo_t info;
> >       struct k_sigaction *ka;
> > -     int err, sig;
> > +     int sig;
> > 
> >       if (!oldset)
> >             oldset = &current->blocked;
> > 
> >       sig = get_signal_to_deliver(&info, regs, NULL);
> > -     if(sig == 0)
> > -           return(0);
This return skips the handling of systemcall restarts if no signal
handler is needed

> 
> Could you explain why the sig == 0 check must be dropped? I went
reading 
> get_signal_to_deliver and sig == 0 seems to mean that no signal is
available. 
> (But I don't understand what "current->notifier" is, but it does not
seem 
> related to syscall restarting).
> 
> > -
> > -     /* Whee!  Actually deliver the signal.  */
> > -     ka = &current->sighand->action[sig -1 ];
> > -     err = handle_signal(regs, sig, ka, &info, oldset, error);
> 
> Why do you drop the handling of errors from handle_signal()? If you do
this to 
> workaround handle_signal() bugs in handling -ERESTART*, fix
handle_signal(); 
> there are other errors that it can return, and that you must handle.
> 
> > -     if(!err) return(1);
> > +     if(sig > 0) {
> > +           /* Whee!  Actually deliver the signal.  */
> > +           ka = &current->sighand->action[sig -1 ];
> > +           handle_signal(regs, sig, ka, &info, oldset, error);
> > +           return(1);
> > +     }
If a handler is needed, handle_signal() is called. It contains the code
to process systemcall restarting for this case. Without a handler, the
existing code behind the patch is processed (has been skipped in almost
all cases without the patch).
But what about bad return from handle_signal()? As I could see, the only
reason for handle_signal() to return error is a SEGV, while writing to
process's stack. The handler thus could not be started. It's not a good
idea to continue with syscall restart processing, written for the case
of no signal handler...
If a SEGV occurs, force_segv() is called to deliver SIGSEGV, and that's
all we have to do. (One fact is outstanding: I believe the signal will
not be delivered on this, but on the next return from kernel to user. I
will try to write a small test for this. But if it is wrong, it's wrong
in i386 and s390 too!)
> > 
> >       /* Did we come from a system call? */
> >       if(PT_REGS_SYSCALL_NR(regs) >= 0){
> 
> -- 
> Paolo Giarrusso, aka Blaisorblade
> Linux registered user n. 292729

If you compare the patched code to i386, you will see it's *very*
similar. And it should behave very similar to i386 (that is, what it
should be - isn't it?)

Greets
Bodo


-------------------------------------------------------
This SF.Net email is sponsored by: YOU BE THE JUDGE. Be one of 170
Project Admins to receive an Apple iPod Mini FREE for your judgement on
who ports your project to Linux PPC the best. Sponsored by IBM.
Deadline: Sept. 24. Go here: http://sf.net/ppc_contest.php
_______________________________________________
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] 12+ messages in thread
* [uml-devel] Minor problems with interrupted systemcalls
@ 2004-09-17 17:46 Stroesser, Bodo
  2004-09-18 16:17 ` BlaisorBlade
  0 siblings, 1 reply; 12+ messages in thread
From: Stroesser, Bodo @ 2004-09-17 17:46 UTC (permalink / raw)
  To: user-mode-linux-devel

[-- Attachment #1: Type: text/plain, Size: 3659 bytes --]

If a program is traced or debugged, in 2.6.x interrupted systemcalls
with the results -ERESTARTxxxxxxx are not handled correctly, do
systemcall restart is done.

Here is a patch that should fix the problem. The patch is tested on
2.6.6 in tt and skas modes. It applies to 2.6.8.1, but I've not tested
yet.

Hope, this helps.

 

Bodo

 

 

 

 

--- uml_orig/arch/um/kernel/signal_kern.c 2004-08-05 18:36:24.000000000
+0200

+++ uml/arch/um/kernel/signal_kern.c      2004-09-17 15:03:30.441065600
+0200

@@ -132,19 +132,18 @@

 {

      siginfo_t info;

      struct k_sigaction *ka;

-     int err, sig;

+     int sig;

 

      if (!oldset)

            oldset = &current->blocked;

 

      sig = get_signal_to_deliver(&info, regs, NULL);

-     if(sig == 0)

-           return(0);

-

-     /* Whee!  Actually deliver the signal.  */

-     ka = &current->sighand->action[sig -1 ];

-     err = handle_signal(regs, sig, ka, &info, oldset, error);

-     if(!err) return(1);

+     if(sig > 0) {

+           /* Whee!  Actually deliver the signal.  */

+           ka = &current->sighand->action[sig -1 ];

+           handle_signal(regs, sig, ka, &info, oldset, error);

+           return(1);

+     }

 

      /* Did we come from a system call? */

      if(PT_REGS_SYSCALL_NR(regs) >= 0){

--- uml_orig/arch/um/kernel/skas/process.c      2004-08-05
18:36:24.000000000 +0200

+++ uml/arch/um/kernel/skas/process.c     2004-09-17 17:35:09.236250499
+0200

@@ -63,7 +63,7 @@

 

      syscall_nr = PT_SYSCALL_NR(regs->skas.regs);

      UPT_SYSCALL_NR(regs) = syscall_nr;

-     if(syscall_nr < 1){

+     if(syscall_nr < 0){

            relay_signal(SIGTRAP, regs);

            return;

      }

--- uml_orig/arch/um/kernel/skas/syscall_user.c 2004-08-05
18:36:24.000000000 +0200

+++ uml/arch/um/kernel/skas/syscall_user.c      2004-09-17
18:52:50.655271683 +0200

@@ -10,10 +10,6 @@

 #include "sysdep/ptrace.h"

 #include "sysdep/sigcontext.h"

 

-/* XXX Bogus */

-#define ERESTARTSYS    512

-#define ERESTARTNOINTR 513

-#define ERESTARTNOHAND 514

 

 void handle_syscall(union uml_pt_regs *regs)

 {

@@ -26,9 +22,6 @@

      result = execute_syscall(regs);

 

      REGS_SET_SYSCALL_RETURN(regs->skas.regs, result);

-     if((result == -ERESTARTNOHAND) || (result == -ERESTARTSYS) || 

-        (result == -ERESTARTNOINTR))

-           do_signal(result);

 

      syscall_trace(regs, 0);

      record_syscall_end(index, result);

--- uml_orig/arch/um/kernel/tt/syscall_user.c   2004-08-05
18:36:24.000000000 +0200

+++ uml/arch/um/kernel/tt/syscall_user.c  2004-09-17 18:52:41.978671390
+0200

@@ -17,10 +17,6 @@

 #include "syscall_user.h"

 #include "tt.h"

 

-/* XXX Bogus */

-#define ERESTARTSYS    512

-#define ERESTARTNOINTR 513

-#define ERESTARTNOHAND 514

 

 void syscall_handler_tt(int sig, union uml_pt_regs *regs)

 {

@@ -42,9 +38,6 @@

      UPT_SC(regs) = sc;

 

      SC_SET_SYSCALL_RETURN(sc, result);

-     if((result == -ERESTARTNOHAND) || (result == -ERESTARTSYS) || 

-        (result == -ERESTARTNOINTR))

-           do_signal(result);

 

      syscall_trace(regs, 0);

      record_syscall_end(index, result);

@@ -63,7 +56,7 @@

      regs = TASK_REGS(task);

      UPT_SYSCALL_NR(regs) = syscall;

 

-     if(syscall < 1) return(0);

+     if(syscall < 0) return(0);

 

      if((syscall != __NR_sigreturn) &&

         ((unsigned long *) PT_IP(proc_regs) >= &_stext) && 

 


[-- Attachment #2: Type: text/html, Size: 24629 bytes --]

^ permalink raw reply	[flat|nested] 12+ messages in thread

end of thread, other threads:[~2004-09-29 20:04 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2004-09-22 17:12 [uml-devel] Minor problems with interrupted systemcalls Stroesser, Bodo
2004-09-24 21:32 ` Jeff Dike
2004-09-24 21:32 ` Jeff Dike
2004-09-24 21:32 ` Jeff Dike
2004-09-24 21:32 ` Jeff Dike
2004-09-24 21:32 ` Jeff Dike
  -- strict thread matches above, loose matches on Subject: below --
2004-09-29 16:34 Stroesser, Bodo
2004-09-29 21:10 ` Jeff Dike
2004-09-20 10:06 Stroesser, Bodo
2004-09-21 17:31 ` BlaisorBlade
2004-09-17 17:46 Stroesser, Bodo
2004-09-18 16:17 ` BlaisorBlade

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox