[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <CAGXu5jJ3QMk-N2xmTntQnAOXbTAW6EbbYDjQcEWRda+FfvGMOw@mail.gmail.com>
Date: Mon, 30 Jul 2012 16:04:16 -0700
From: Kees Cook <keescook@...omium.org>
To: Alan Cox <alan@...rguk.ukuu.org.uk>
Cc: John Johansen <john.johansen@...onical.com>,
linux-kernel@...r.kernel.org,
James Morris <james.l.morris@...cle.com>,
linux-security-module@...r.kernel.org
Subject: Re: [PATCH] Yama: access current->comm directly
Hi,
On Mon, Jul 30, 2012 at 2:50 PM, Alan Cox <alan@...rguk.ukuu.org.uk> wrote:
> On Mon, 30 Jul 2012 14:21:33 -0700
> John Johansen <john.johansen@...onical.com> wrote:
>
>> On 07/30/2012 09:58 AM, Kees Cook wrote:
>> > The core ptrace access checking routine already holds the task lock,
>> > so there is no need to use get_task_comm() which just tries to take the
>> > lock again. Drop its use and access current->comm directly.
>> >
>> > Reported-by: Fengguang Wu <fengguang.wu@...el.com>
>> > Suggested-by: Oleg Nesterov <oleg@...hat.com>
>> > Cc: stable@...r.kernel.org
>> > Signed-off-by: Kees Cook <keescook@...omium.org>
>> yep, looks good
>>
>> Acked-by: John Johansen <john.johansen@...onical.com>
>
>
> Code looks correct but having a weird cornercase direct reference is
> asking for an accident later. For maintainability I'd rather see that as
> __get_task_comm() or get_task_commu_unlocked() which does the job, deals
> with all the edge cases and contains a WARN_ON check on the lock.
I'd be happy to refactor this area, sure. What's the best way to check
for this lock. I see in staging:
#define ASSERT_SPINLOCK(_l) WARN_ON(!spin_is_locked(_l))
but in other areas, I see things using the raw_ prefix:
WARN_ON(raw_spin_is_locked(&kvm_lock));
Which is preferred for task_lock?
-Kees
--
Kees Cook
Chrome OS Security
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists