Skip to contentSkip to conversation

Problem with copy_siginfo_to_user32()

PATCH Jurij Smakov 2 participants 2 messages Apr 16, 2005 – Apr 17, 2005

lore
Share & tools
lore
#0 lore raw

Hello,

In Debian's bug 272683 [0] submitter describes incorrect behavior of the F_NOTIFY function of fcntl(), which reports the wrong number of the file descriptor, on which the event has occured. I believe that the culprit in this case is the copy_siginfo_to_user32() function in arch/sparc64/kernel/signal32.c. Comparison with other arches (like
ppc64), shows that the __SI_POLL branch in the case statement should fill out the si_band and si_fd fields of the siginfo_t structure (si_fd is used by fcntl() to pass the fd number back to user). Currently it does not do that. Attached patch (against 2.6.11.7) separates __SI_FAULT and __SI_POLL branches and does (presumably) the right thing in the latter by copying the si_band and si_fd into the siginfo_t passed to user. With this change the test program attached to the bug [0] works as expected (tested on 2.6.8, against which the original bug was filed).

Please review and apply if it makes sense :-).

[0] http://bugs.debian.org/272683

Best regards,

Jurij Smakov [email protected]
Key: http://www.wooyd.org/pgpkey/ KeyID: C99E03CC

arch/sparc64/kernel/signal32.c +4 -1
@@ -192,10 +192,13 @@
 			err |= __put_user(from->si_uid, &to->si_uid);
 			break;
 		case __SI_FAULT >> 16:
-		case __SI_POLL >> 16:
 			err |= __put_user(from->si_trapno, &to->si_trapno);
 			err |= __put_user((unsigned long)from->si_addr, &to->si_addr);
 			break;
+		case __SI_POLL >> 16:
+			err |= __put_user(from->si_band, &to->si_band);
+			err |= __put_user(from->si_fd, &to->si_fd);
+			break;
 		case __SI_RT >> 16: /* This is not generated by the kernel as of now.  */
 		case __SI_MESGQ >> 16:
 			err |= __put_user(from->si_pid, &to->si_pid);
#1 lore raw
Quoted 1 line · On Sat, 16 Apr 2005 03:10:17 -0400 (EDT) Jurij Smakov <[email protected]> wrote:

Please review and apply if it makes sense :-).

Looks good, I'll apply this.

Thanks Jurij.