--- old/usr/src/uts/common/os/rctl_proc.c	2013-06-24 12:53:16.659710950 +0000
+++ new/usr/src/uts/common/os/rctl_proc.c	2013-06-24 12:53:16.675883876 +0000
@@ -23,8 +23,6 @@
  * Use is subject to license terms.
  */
 
-#pragma ident	"%Z%%M%	%I%	%E% SMI"
-
 #include <sys/types.h>
 #include <sys/cmn_err.h>
 #include <sys/sysmacros.h>
@@ -32,6 +30,7 @@
 #include <sys/rctl.h>
 #include <sys/rctl_impl.h>
 #include <sys/port_kernel.h>
+#include <sys/signal.h>
 
 #include <sys/vmparam.h>
 #include <sys/machparam.h>
@@ -65,6 +64,7 @@
 rctl_hndl_t rc_process_semmsl;
 rctl_hndl_t rc_process_semopm;
 rctl_hndl_t rc_process_portev;
+rctl_hndl_t rc_process_sigqueue;
 
 /*
  * process.max-cpu-time / RLIMIT_CPU
@@ -288,7 +288,7 @@
  *   here as the native and ILP32 infinite values for each resource control.
  */
 void
-rctlproc_init()
+rctlproc_init(void)
 {
 	rctl_set_t *set;
 	rctl_alloc_gp_t *gp;
@@ -368,6 +368,14 @@
 	rctl_add_default_limit("process.max-port-events", PORT_DEFAULT_EVENTS,
 	    RCPRIV_PRIVILEGED, RCTL_LOCAL_DENY);
 
+	rc_process_sigqueue = rctl_register("process.max-sigqueue-size",
+	    RCENTITY_PROCESS, RCTL_GLOBAL_LOWERABLE | RCTL_GLOBAL_DENY_ALWAYS |
+	    RCTL_GLOBAL_COUNT, _SIGQSZ_MAX, _SIGQSZ_MAX, &rctl_absolute_ops);
+	rctl_add_default_limit("process.max-sigqueue-size", _SIGQSZ_DEFAULT,
+	    RCPRIV_BASIC, RCTL_LOCAL_DENY);
+	rctl_add_default_limit("process.max-sigqueue-size", _SIGQSZ_PRIVILEGED,
+	    RCPRIV_PRIVILEGED, RCTL_LOCAL_DENY);
+
 	/*
 	 * Place minimal set of controls on "sched" process for inheritance by
 	 * processes created via newproc().
--- old/usr/src/uts/common/os/sig.c	2013-06-24 12:53:17.160907664 +0000
+++ new/usr/src/uts/common/os/sig.c	2013-06-24 12:53:17.171093779 +0000
@@ -2373,8 +2373,8 @@
 	return (0);
 }
 
-#ifndef	UCHAR_MAX
-#define	UCHAR_MAX	255
+#ifndef	INT_MAX
+#define	INT_MAX	2147483647
 #endif
 
 /*
@@ -2389,11 +2389,11 @@
 	sigqhdr_t *sqh;
 
 	i = (maxcount * size) + sizeof (sigqhdr_t);
-	ASSERT(maxcount <= UCHAR_MAX && i <= USHRT_MAX);
+	ASSERT(maxcount <= INT_MAX);
 	sqh = kmem_alloc(i, KM_SLEEP);
-	sqh->sqb_count = (uchar_t)maxcount;
-	sqh->sqb_maxcount = (uchar_t)maxcount;
-	sqh->sqb_size = (ushort_t)i;
+	sqh->sqb_count = maxcount;
+	sqh->sqb_maxcount = maxcount;
+	sqh->sqb_size = i;
 	sqh->sqb_pexited = 0;
 	sqh->sqb_sent = 0;
 	sqh->sqb_free = sq = (sigqueue_t *)(sqh + 1);
--- old/usr/src/uts/common/sys/signal.h	2013-06-24 12:53:17.728955161 +0000
+++ new/usr/src/uts/common/sys/signal.h	2013-06-24 12:53:17.738959763 +0000
@@ -20,8 +20,7 @@
  */
 
 /*
- * Copyright 2010 Sun Microsystems, Inc.  All rights reserved.
- * Use is subject to license terms.
+ * Copyright (c) 1988, 2012, Oracle and/or its affiliates. All rights reserved.
  */
 
 /*	Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T	*/
@@ -303,16 +302,22 @@
 
 typedef struct sigqhdr {		/* sigqueue pool header		*/
 	sigqueue_t	*sqb_free;	/* free sigq struct list	*/
-	uchar_t		sqb_count;	/* sigq free count		*/
-	uchar_t		sqb_maxcount;	/* sigq max free count		*/
-	ushort_t	sqb_size;	/* size of header+free structs	*/
+	int		sqb_count;	/* sigq free count		*/
+	uint_t		sqb_maxcount;	/* sigq max free count		*/
+	size_t		sqb_size;	/* size of header+free structs	*/
 	uchar_t		sqb_pexited;	/* process has exited		*/
-	uchar_t		sqb_sent;	/* number of sigq sent		*/
+	uint_t		sqb_sent;	/* number of sigq sent		*/
 	kcondvar_t	sqb_cv;		/* waiting for a sigq struct	*/
 	kmutex_t	sqb_lock;	/* lock for sigq pool		*/
 } sigqhdr_t;
 
-#define	_SIGQUEUE_MAX	32
+/*
+ * Limits on maximum number of sigqueue(3C) entries per process.
+ */
+#define	_SIGQSZ_DEFAULT		128	/* default number */
+#define	_SIGQSZ_PRIVILEGED	512	/* privilege required to set abouve */
+#define	_SIGQSZ_MAX		8192	/* max even with privilege */
+
 #define	_SIGNOTIFY_MAX	32
 
 extern	void	setsigact(int, void (*)(int), const k_sigset_t *, int);
--- old/usr/src/uts/common/syscall/sigqueue.c	2013-06-24 12:53:18.134793340 +0000
+++ new/usr/src/uts/common/syscall/sigqueue.c	2013-06-24 12:53:18.145088336 +0000
@@ -26,8 +26,6 @@
 
 /* Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T */
 
-#pragma ident	"%Z%%M%	%I%	%E% SMI"
-
 #include <sys/param.h>
 #include <sys/types.h>
 #include <sys/sysmacros.h>
@@ -40,6 +38,8 @@
 #include <sys/siginfo.h>
 #include <sys/debug.h>
 
+extern rctl_hndl_t rc_process_sigqueue;
+
 static int
 sigqkill(pid_t pid, sigsend_t *sigsend)
 {
@@ -121,7 +121,7 @@
  */
 int
 sigqueue(pid_t pid, int sig, /* union sigval */ void *value,
-	int si_code, int block)
+    int si_code, int block)
 {
 	int error;
 	sigsend_t v;
@@ -133,8 +133,15 @@
 		return (set_errno(EINVAL));
 
 	if ((sqh = p->p_sigqhdr) == NULL) {
+		rlim64_t sigqsz_max;
+
+		mutex_enter(&p->p_lock);
+		sigqsz_max = rctl_enforced_value(rc_process_sigqueue,
+		    p->p_rctls, p);
+		mutex_exit(&p->p_lock);
+
 		/* Allocate sigqueue pool first time */
-		sqh = sigqhdralloc(sizeof (sigqueue_t), _SIGQUEUE_MAX);
+		sqh = sigqhdralloc(sizeof (sigqueue_t), (uint_t)sigqsz_max);
 		mutex_enter(&p->p_lock);
 		if (p->p_sigqhdr == NULL) {
 			/* hang the pool head on proc */
--- old/usr/src/uts/common/syscall/sysconfig.c	2013-06-24 12:53:18.479872176 +0000
+++ new/usr/src/uts/common/syscall/sysconfig.c	2013-06-24 12:53:18.489030080 +0000
@@ -47,6 +47,8 @@
 #include <sys/zone.h>
 #include <sys/vm_usage.h>
 
+extern rctl_hndl_t rc_process_sigqueue;
+
 long
 sysconfig(int which)
 {
@@ -140,7 +142,17 @@
 		return (_SEM_VALUE_MAX);
 
 	case _CONFIG_SIGQUEUE_MAX:
-		return (_SIGQUEUE_MAX);
+		/*
+		 * Maximum number of outstanding queued signals.
+		 */
+		{
+			rlim64_t sigqsz_max;
+			mutex_enter(&curproc->p_lock);
+			sigqsz_max = rctl_enforced_value(rc_process_sigqueue,
+			    curproc->p_rctls, curproc);
+			mutex_exit(&curproc->p_lock);
+			return ((uint_t)sigqsz_max);
+		}
 
 	case _CONFIG_SIGRT_MIN:
 		return (_SIGRTMIN);
