From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752888AbdK3M6F (ORCPT ); Thu, 30 Nov 2017 07:58:05 -0500 Received: from Galois.linutronix.de ([146.0.238.70]:44377 "EHLO Galois.linutronix.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751443AbdK3M6D (ORCPT ); Thu, 30 Nov 2017 07:58:03 -0500 Date: Thu, 30 Nov 2017 13:57:55 +0100 (CET) From: Thomas Gleixner To: Alexey Dobriyan cc: Dmitry Vyukov , security@kernel.org, Akinobu Mita , Andrew Morton , "Eric W. Biederman" , Josh Poimboeuf , LKML , Ingo Molnar , syzkaller-bugs@googlegroups.com, Vegard Nossum Subject: Re: general protection fault in show_timer In-Reply-To: Message-ID: References: <94eb2c18a77ce8d832055f2cf263@google.com> User-Agent: Alpine 2.20 (DEB 67 2015-01-07) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, 30 Nov 2017, Alexey Dobriyan wrote: > [cc security@] > 100% oops with interrupts disabled by nobody > or kernel memory read > [nods] > you named the bug already > > "notify" directly comes from userspace struct sigevent::sigev_notify > without adult supervision. > > Reproducer is timer_create + read(/proc/self/timers) Bah. That's a really old one. Tentative fix below. That needs more though but looking at the existing check there is only one valid combo with SIGEV_THREAD_ID. Thanks, tglx 8<---------------- --- a/kernel/time/posix-timers.c +++ b/kernel/time/posix-timers.c @@ -434,6 +434,16 @@ static struct pid *good_sigevent(sigeven { struct task_struct *rtn = current->group_leader; + switch (event->sigev_notify) { + case SIGEV_NONE: + case SIGEV_SIGNAL: + case SIGEV_SIGNAL | SIGEV_THREAD_ID: + case SIGEV_THREAD: + break; + default: + return NULL; + } + if ((event->sigev_notify & SIGEV_THREAD_ID ) && (!(rtn = find_task_by_vpid(event->sigev_notify_thread_id)) || !same_thread_group(rtn, current) ||