* [PATCH RESEND] signal: annotate siglock acquisition
@ 2010-09-25 3:20 Namhyung Kim
2010-09-25 3:26 ` Al Viro
0 siblings, 1 reply; 3+ messages in thread
From: Namhyung Kim @ 2010-09-25 3:20 UTC (permalink / raw)
To: Oleg Nesterov, Roland McGrath; +Cc: linux-kernel
lock_task_sighand() conditionally acquires sighand->siglock in case of
returning non-NULL but unlock_task_sighand() releases it unconditionally.
This leads sparse to complain about the lock context imbalance. Annotate it
to make sparse happier.
Signed-off-by: Namhyung Kim <namhyung@gmail.com>
---
kernel/signal.c | 4 ++++
1 files changed, 4 insertions(+), 0 deletions(-)
diff --git a/kernel/signal.c b/kernel/signal.c
index bded651..766ae03 100644
--- a/kernel/signal.c
+++ b/kernel/signal.c
@@ -1038,6 +1038,7 @@ int do_send_sig_info(int sig, struct siginfo *info, struct task_struct *p,
int ret = -ESRCH;
if (lock_task_sighand(p, &flags)) {
+ __acquire(&p->sighand->siglock); /* make sparse happy */
ret = send_signal(sig, info, p, group);
unlock_task_sighand(p, &flags);
}
@@ -1227,6 +1228,7 @@ int kill_pid_info_as_uid(int sig, struct siginfo *info, struct pid *pid,
if (sig) {
if (lock_task_sighand(p, &flags)) {
+ __acquire(&p->sighand->siglock);
ret = __send_signal(sig, info, p, 1, 0);
unlock_task_sighand(p, &flags);
} else
@@ -1406,6 +1408,8 @@ int send_sigqueue(struct sigqueue *q, struct task_struct *t, int group)
if (!likely(lock_task_sighand(t, &flags)))
goto ret;
+ __acquire(&t->sighand->siglock); /* make sparse happy */
+
ret = 1; /* the signal is ignored */
if (!prepare_signal(sig, t, 0))
goto out;
--
1.7.2.2
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH RESEND] signal: annotate siglock acquisition
2010-09-25 3:20 [PATCH RESEND] signal: annotate siglock acquisition Namhyung Kim
@ 2010-09-25 3:26 ` Al Viro
2010-09-25 3:44 ` Namhyung Kim
0 siblings, 1 reply; 3+ messages in thread
From: Al Viro @ 2010-09-25 3:26 UTC (permalink / raw)
To: Namhyung Kim; +Cc: Oleg Nesterov, Roland McGrath, linux-kernel
On Sat, Sep 25, 2010 at 12:20:56PM +0900, Namhyung Kim wrote:
> lock_task_sighand() conditionally acquires sighand->siglock in case of
> returning non-NULL but unlock_task_sighand() releases it unconditionally.
> This leads sparse to complain about the lock context imbalance. Annotate it
> to make sparse happier.
That's not a good way to do it; use __cond_lock instead.
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH RESEND] signal: annotate siglock acquisition
2010-09-25 3:26 ` Al Viro
@ 2010-09-25 3:44 ` Namhyung Kim
0 siblings, 0 replies; 3+ messages in thread
From: Namhyung Kim @ 2010-09-25 3:44 UTC (permalink / raw)
To: Al Viro; +Cc: Oleg Nesterov, Roland McGrath, linux-kernel
On Sat, Sep 25, 2010 at 12:26, Al Viro <viro@zeniv.linux.org.uk> wrote:
> On Sat, Sep 25, 2010 at 12:20:56PM +0900, Namhyung Kim wrote:
>> lock_task_sighand() conditionally acquires sighand->siglock in case of
>> returning non-NULL but unlock_task_sighand() releases it unconditionally.
>> This leads sparse to complain about the lock context imbalance. Annotate it
>> to make sparse happier.
>
> That's not a good way to do it; use __cond_lock instead.
>
Thanks. I'll resend a patch that uses it.
--
Regards,
Namhyung Kim
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2010-09-25 3:44 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-09-25 3:20 [PATCH RESEND] signal: annotate siglock acquisition Namhyung Kim
2010-09-25 3:26 ` Al Viro
2010-09-25 3:44 ` Namhyung Kim
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®