lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAH6sp9P5J6-a8gqmt53fS6puAF90TA4hm2-7s6NOq0+s4-Qdcg@mail.gmail.com>
Date:	Thu, 21 May 2015 13:39:02 +0200
From:	Frans Klaver <fransklaver@...il.com>
To:	Ingo Molnar <mingo@...nel.org>
Cc:	Maninder Singh <maninder1.s@...sung.com>,
	Andrew Morton <akpm@...ux-foundation.org>, oleg@...hat.com,
	Michal Hocko <mhocko@...e.cz>,
	Peter Zijlstra <peterz@...radead.org>,
	Rik van Riel <riel@...hat.com>, ionut.m.alexa@...il.com,
	Peter Hurley <peter@...leysoftware.com>,
	"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
	"v.narang@...sung.com" <v.narang@...sung.com>,
	AKHILESH KUMAR <akhilesh.k@...sung.com>,
	Peter Zijlstra <a.p.zijlstra@...llo.nl>
Subject: Re: [EDT][PATCH] kernel/exit.c : Fix missing read_unlock

On 21 May 2015 12:56:22 CEST, Ingo Molnar <mingo@...nel.org> wrote:
>
>* Frans Klaver <fransklaver@...il.com> wrote:
>
>> On Thu, May 21, 2015 at 8:03 AM, Ingo Molnar <mingo@...nel.org>
>wrote:
>> >
>> > * Maninder Singh <maninder1.s@...sung.com> wrote:
>> >
>> >>  EP-F6AA0618C49C4AEDA73BFF1B39950BAB
>> >> Hi,
>> >>
>> >> From: Maninder Singh <maninder1.s@...sung.com>
>> >>
>> >> Subject: [PATCH 1/1] kernel/exit.c : Fix missing task_unlock
>> >>
>> >> This patch adds missing read_unlock if do_wait_thread or
>ptrace_do_wait
>> >> returns non zero.
>> >>
>> >> Signed-off-by: Maninder Singh <maninder1.s@...sung.com>
>> >> Signed-off-by: Vaneet Narang <v.narang@...sung.com>
>> >> Reviewd-by: Akhilesh Kumar <akhilesh.k@...sung.com>
>> >> ---
>> >>  kernel/exit.c |    8 ++++++--
>> >>  1 files changed, 6 insertions(+), 2 deletions(-)
>> >>
>> >> diff --git a/kernel/exit.c b/kernel/exit.c
>> >> index 22fcc05..31a061f 100644
>> >> --- a/kernel/exit.c
>> >> +++ b/kernel/exit.c
>> >> @@ -1486,12 +1486,16 @@ repeat:
>> >>       tsk = current;
>> >>       do {
>> >>               retval = do_wait_thread(wo, tsk);
>> >> -             if (retval)
>> >> +             if (retval) {
>> >> +                     read_unlock(&tasklist_lock);
>> >>                       goto end;
>> >> +             }
>> >>
>> >>               retval = ptrace_do_wait(wo, tsk);
>> >> -             if (retval)
>> >> +             if (retval) {
>> >> +                     read_unlock(&tasklist_lock);
>> >>                       goto end;
>> >> +             }
>> >>
>> >>               if (wo->wo_flags & __WNOTHREAD)
>> >>                       break;
>> >
>> > That's surprising <snip>
>>
>> Still it looks like it is a legitimate change. I don't see where the
>> unlock would be done otherwise.
>
>No, it does not look like a legitimate change, that's why I asked the
>questions. I think this patch breaks the kernel badly.
>
>As it is explained in the comments as well, the various wait-loop
>functions (do_wait_thread(), ptrace_do_wait()) fundamentally unlock
>the tasklist_lock if they return an error.

Ah, right. Given that I agree. I can imagine a static checker not
seeing that either. Sorry for the noise here.

Thanks,
Frans
--
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

Powered by Openwall GNU/*/Linux Powered by OpenVZ