Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/compat/linux MINSIGSTKSZ on linux is different depending...



details:   https://anonhg.NetBSD.org/src/rev/59fada1d3cc5
branches:  trunk
changeset: 584466:59fada1d3cc5
user:      christos <christos%NetBSD.org@localhost>
date:      Mon Sep 19 02:46:49 2005 +0000

description:
MINSIGSTKSZ on linux is different depending on the platform and usually
smaller than ours.

diffstat:

 sys/compat/linux/arch/alpha/linux_signal.h   |   4 ++-
 sys/compat/linux/arch/amd64/linux_signal.h   |   4 ++-
 sys/compat/linux/arch/arm/linux_signal.h     |   4 ++-
 sys/compat/linux/arch/i386/linux_signal.h    |   4 ++-
 sys/compat/linux/arch/m68k/linux_signal.h    |   4 ++-
 sys/compat/linux/arch/mips/linux_signal.h    |   4 ++-
 sys/compat/linux/arch/powerpc/linux_signal.h |   4 ++-
 sys/compat/linux/common/linux_signal.c       |  34 +++++++++++++++++----------
 8 files changed, 42 insertions(+), 20 deletions(-)

diffs (189 lines):

diff -r 010bf41fe7c5 -r 59fada1d3cc5 sys/compat/linux/arch/alpha/linux_signal.h
--- a/sys/compat/linux/arch/alpha/linux_signal.h        Mon Sep 19 00:59:56 2005 +0000
+++ b/sys/compat/linux/arch/alpha/linux_signal.h        Mon Sep 19 02:46:49 2005 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: linux_signal.h,v 1.5 2005/05/19 21:16:29 manu Exp $    */
+/*     $NetBSD: linux_signal.h,v 1.6 2005/09/19 02:46:49 christos Exp $        */
 
 /*-
  * Copyright (c) 1998 The NetBSD Foundation, Inc.
@@ -89,6 +89,8 @@
 #define LINUX__NSIG_WORDS      (LINUX__NSIG / LINUX__NSIG_BPW)
 #define LINUX_NSIG             32
 
+#define        LINUX_MINSIGSTKSZ       4096
+
 /* sa_flags */
 #define LINUX_SA_ONSTACK       0x00000001
 #define LINUX_SA_RESTART       0x00000002
diff -r 010bf41fe7c5 -r 59fada1d3cc5 sys/compat/linux/arch/amd64/linux_signal.h
--- a/sys/compat/linux/arch/amd64/linux_signal.h        Mon Sep 19 00:59:56 2005 +0000
+++ b/sys/compat/linux/arch/amd64/linux_signal.h        Mon Sep 19 02:46:49 2005 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: linux_signal.h,v 1.2 2005/05/19 21:16:29 manu Exp $ */
+/*     $NetBSD: linux_signal.h,v 1.3 2005/09/19 02:46:49 christos Exp $ */
 
 /*-
  * Copyright (c) 2005 Emmanuel Dreyfus, all rights reserved.
@@ -91,6 +91,8 @@
 #define LINUX__NSIG_BPW                64
 #define LINUX__NSIG_WORDS      (LINUX__NSIG / LINUX__NSIG_BPW)
 
+#define        LINUX_MINSIGSTKSZ       2048
+
 typedef unsigned int linux_old_sigset_t;
 
 typedef struct {
diff -r 010bf41fe7c5 -r 59fada1d3cc5 sys/compat/linux/arch/arm/linux_signal.h
--- a/sys/compat/linux/arch/arm/linux_signal.h  Mon Sep 19 00:59:56 2005 +0000
+++ b/sys/compat/linux/arch/arm/linux_signal.h  Mon Sep 19 02:46:49 2005 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: linux_signal.h,v 1.5 2005/05/19 21:16:29 manu Exp $    */
+/*     $NetBSD: linux_signal.h,v 1.6 2005/09/19 02:46:49 christos Exp $        */
 
 /*-
  * Copyright (c) 1995, 1998 The NetBSD Foundation, Inc.
@@ -98,6 +98,8 @@
 #define LINUX_SA_ONESHOT       0x80000000
 #define LINUX_SA_ALLBITS       0xfc000007
 
+#define LINUX_MINSIGSTKSZ      2048
+
 typedef void   (*linux_handler_t) __P((int));
 
 typedef u_long linux_old_sigset_t;
diff -r 010bf41fe7c5 -r 59fada1d3cc5 sys/compat/linux/arch/i386/linux_signal.h
--- a/sys/compat/linux/arch/i386/linux_signal.h Mon Sep 19 00:59:56 2005 +0000
+++ b/sys/compat/linux/arch/i386/linux_signal.h Mon Sep 19 02:46:49 2005 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: linux_signal.h,v 1.12 2002/11/26 18:42:38 christos Exp $       */
+/*     $NetBSD: linux_signal.h,v 1.13 2005/09/19 02:46:49 christos Exp $       */
 
 /*-
  * Copyright (c) 1995, 1998 The NetBSD Foundation, Inc.
@@ -98,6 +98,8 @@
 #define LINUX_SA_ONESHOT       0x80000000
 #define LINUX_SA_ALLBITS       0xfc000007
 
+#define LINUX_MINSIGSTKSZ      2048
+
 typedef void   (*linux_handler_t) __P((int));
 
 typedef unsigned long  linux_old_sigset_t;
diff -r 010bf41fe7c5 -r 59fada1d3cc5 sys/compat/linux/arch/m68k/linux_signal.h
--- a/sys/compat/linux/arch/m68k/linux_signal.h Mon Sep 19 00:59:56 2005 +0000
+++ b/sys/compat/linux/arch/m68k/linux_signal.h Mon Sep 19 02:46:49 2005 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: linux_signal.h,v 1.3 2002/11/26 18:43:21 christos Exp $        */
+/*     $NetBSD: linux_signal.h,v 1.4 2005/09/19 02:46:49 christos Exp $        */
 
 /*-
  * Copyright (c) 1998 The NetBSD Foundation, Inc.
@@ -108,6 +108,8 @@
 #define LINUX_SIG_UNBLOCK      1
 #define LINUX_SIG_SETMASK      2
 
+#define        LINUX_MINSIGSTKSZ       2048
+
 typedef void   (*linux_handler_t) __P((int));
 
 typedef u_long linux_old_sigset_t;
diff -r 010bf41fe7c5 -r 59fada1d3cc5 sys/compat/linux/arch/mips/linux_signal.h
--- a/sys/compat/linux/arch/mips/linux_signal.h Mon Sep 19 00:59:56 2005 +0000
+++ b/sys/compat/linux/arch/mips/linux_signal.h Mon Sep 19 02:46:49 2005 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: linux_signal.h,v 1.9 2005/02/26 23:10:19 perry Exp $ */
+/* $NetBSD: linux_signal.h,v 1.10 2005/09/19 02:46:49 christos Exp $ */
 
 /*-
  * Copyright (c) 1995, 1998, 2001 The NetBSD Foundation, Inc.
@@ -121,6 +121,8 @@
 #define LINUX_SA_ONESHOT       LINUX_SA_RESETHAND
 #define LINUX_SA_ALLBITS       0xfc010009 /* XXX from i386, not in mips. */
 
+#define        LINUX_MINSIGSTKSZ       2048
+
 typedef void (*linux___sighandler_t) __P((int));
 
 typedef unsigned long linux_old_sigset_t;
diff -r 010bf41fe7c5 -r 59fada1d3cc5 sys/compat/linux/arch/powerpc/linux_signal.h
--- a/sys/compat/linux/arch/powerpc/linux_signal.h      Mon Sep 19 00:59:56 2005 +0000
+++ b/sys/compat/linux/arch/powerpc/linux_signal.h      Mon Sep 19 02:46:49 2005 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: linux_signal.h,v 1.7 2005/05/19 21:16:29 manu Exp $ */
+/* $NetBSD: linux_signal.h,v 1.8 2005/09/19 02:46:49 christos Exp $ */
 
 /*-
  * Copyright (c) 1995, 1998, 2001 The NetBSD Foundation, Inc.
@@ -105,6 +105,8 @@
 #define LINUX_SA_ONESHOT       LINUX_SA_RESETHAND
 #define LINUX_SA_ALLBITS       0xfc000007
 
+#define        LINUX_MINSIGSTKSZ       2048
+
 typedef void (*linux_handler_t) __P((int));
 
 typedef unsigned long linux_old_sigset_t;
diff -r 010bf41fe7c5 -r 59fada1d3cc5 sys/compat/linux/common/linux_signal.c
--- a/sys/compat/linux/common/linux_signal.c    Mon Sep 19 00:59:56 2005 +0000
+++ b/sys/compat/linux/common/linux_signal.c    Mon Sep 19 02:46:49 2005 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: linux_signal.c,v 1.47 2005/05/20 01:06:50 mrg Exp $    */
+/*     $NetBSD: linux_signal.c,v 1.48 2005/09/19 02:46:49 christos Exp $       */
 /*-
  * Copyright (c) 1995, 1998 The NetBSD Foundation, Inc.
  * All rights reserved.
@@ -54,7 +54,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: linux_signal.c,v 1.47 2005/05/20 01:06:50 mrg Exp $");
+__KERNEL_RCSID(0, "$NetBSD: linux_signal.c,v 1.48 2005/09/19 02:46:49 christos Exp $");
 
 #define COMPAT_LINUX 1
 
@@ -625,25 +625,33 @@
        } */ *uap = v;
        struct proc *p = l->l_proc;
        struct linux_sigaltstack ss;
-       struct sigaltstack nss, oss;
+       struct sigaltstack nss;
        int error;
 
+       if (SCARG(uap, oss)) {
+               native_to_linux_sigaltstack(&ss, &p->p_sigctx.ps_sigstk);
+               if ((error = copyout(&ss, SCARG(uap, oss), sizeof(ss))) != 0)
+                       return error;
+       }
+
        if (SCARG(uap, ss) != NULL) {
                if ((error = copyin(SCARG(uap, ss), &ss, sizeof(ss))) != 0)
                        return error;
                linux_to_native_sigaltstack(&nss, &ss);
+
+               if (nss.ss_flags & ~SS_ALLBITS)
+                       return EINVAL;
+
+               if (nss.ss_flags & SS_DISABLE) {
+                       if (p->p_sigctx.ps_sigstk.ss_flags & SS_ONSTACK)
+                               return EINVAL;
+               } else {
+                       if (nss.ss_size < LINUX_MINSIGSTKSZ)
+                               return ENOMEM;
+               }
+               p->p_sigctx.ps_sigstk = nss;
        }
 
-       error = sigaltstack1(p,
-           SCARG(uap, ss) ? &nss : NULL, SCARG(uap, oss) ? &oss : NULL);
-       if (error)
-               return error;
-
-       if (SCARG(uap, oss) != NULL) {
-               native_to_linux_sigaltstack(&ss, &oss);
-               if ((error = copyout(&ss, SCARG(uap, oss), sizeof(ss))) != 0)
-                       return error;
-       }
        return 0;
 }
 #endif /* LINUX_SS_ONSTACK */



Home | Main Index | Thread Index | Old Index