From: Roland McGrath <roland@redhat.com>
To: Linus Torvalds <torvalds@osdl.org>, Andrew Morton <akpm@osdl.org>
Cc: Linux Kernel Mailing List <linux-kernel@vger.kernel.org>
Subject: [PATCH] fix sigqueue accounting for posix-timers broken by new RLIMIT_SIGPENDING tracking code
Date: Thu, 9 Sep 2004 22:10:31 -0700 [thread overview]
Message-ID: <200409100510.i8A5AVD7025919@magilla.sf.frob.com> (raw)
The introduction of RLIMIT_SIGPENDING and the associated tracking code was
broken for the case of preallocated sigqueue elements, i.e. posix-timers.
It wrongly includes the timer's preallocated sigqueue structs in the count
towards the per-user when allocating them, but (rightly) does not decrement
the count when they are freed.
This patch fixes it by keeping preallocated sigqueue structs out of the
per-user accounting altogether.
Thanks,
Roland
Signed-off-by: Roland McGrath <roland@redhat.com>
--- vanilla-linux-2.6/kernel/signal.c.orig 2004-09-09 22:07:56.492060454 -0700
+++ vanilla-linux-2.6/kernel/signal.c 2004-09-09 21:55:45.604292751 -0700
@@ -264,7 +264,7 @@ next_signal(struct sigpending *pending,
return sig;
}
-static struct sigqueue *__sigqueue_alloc(void)
+static struct sigqueue *__sigqueue_alloc(int flags)
{
struct sigqueue *q = NULL;
@@ -273,10 +273,13 @@ static struct sigqueue *__sigqueue_alloc
q = kmem_cache_alloc(sigqueue_cachep, GFP_ATOMIC);
if (q) {
INIT_LIST_HEAD(&q->list);
- q->flags = 0;
q->lock = NULL;
- q->user = get_uid(current->user);
- atomic_inc(&q->user->sigpending);
+ q->user = NULL;
+ q->flags = flags;
+ if (!(flags & SIGQUEUE_PREALLOC)) {
+ q->user = get_uid(current->user);
+ atomic_inc(&q->user->sigpending);
+ }
}
return(q);
}
@@ -1331,11 +1334,7 @@ kill_proc(pid_t pid, int sig, int priv)
struct sigqueue *sigqueue_alloc(void)
{
- struct sigqueue *q;
-
- if ((q = __sigqueue_alloc()))
- q->flags |= SIGQUEUE_PREALLOC;
- return(q);
+ return __sigqueue_alloc(SIGQUEUE_PREALLOC);
}
void sigqueue_free(struct sigqueue *q)
next reply other threads:[~2004-09-10 5:10 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2004-09-10 5:10 Roland McGrath [this message]
2004-09-10 6:49 ` Chris Wright
2004-09-10 17:42 ` Chris Wright
2004-09-10 19:24 ` Roland McGrath
2004-09-10 19:34 ` Chris Wright
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=200409100510.i8A5AVD7025919@magilla.sf.frob.com \
--to=roland@redhat.com \
--cc=akpm@osdl.org \
--cc=linux-kernel@vger.kernel.org \
--cc=torvalds@osdl.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®