From patchwork Sat Jul 27 17:00:51 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Oleg Nesterov X-Patchwork-Id: 2834644 Return-Path: X-Original-To: patchwork-linux-nfs@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork1.web.kernel.org (Postfix) with ESMTP id A4D0F9F4E2 for ; Sat, 27 Jul 2013 17:06:19 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id D347520144 for ; Sat, 27 Jul 2013 17:06:18 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id E4AE02013D for ; Sat, 27 Jul 2013 17:06:17 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752411Ab3G0RGI (ORCPT ); Sat, 27 Jul 2013 13:06:08 -0400 Received: from mx1.redhat.com ([209.132.183.28]:13165 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752406Ab3G0RGI (ORCPT ); Sat, 27 Jul 2013 13:06:08 -0400 Received: from int-mx12.intmail.prod.int.phx2.redhat.com (int-mx12.intmail.prod.int.phx2.redhat.com [10.5.11.25]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id r6RH61bR008188 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Sat, 27 Jul 2013 13:06:01 -0400 Received: from tranklukator.brq.redhat.com (dhcp-1-192.brq.redhat.com [10.34.1.192]) by int-mx12.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with SMTP id r6RH5wSp008800; Sat, 27 Jul 2013 13:05:59 -0400 Received: by tranklukator.brq.redhat.com (nbSMTP-1.00) for uid 500 oleg@redhat.com; Sat, 27 Jul 2013 19:00:54 +0200 (CEST) Date: Sat, 27 Jul 2013 19:00:51 +0200 From: Oleg Nesterov To: Toralf =?iso-8859-1?Q?F=F6rster?= , "Serge E. Hallyn" Cc: Andrey Vagin , "Eric W. Biederman" , Al Viro , Linux NFS mailing list Subject: Re: fuzz tested user mode linux core dumps in fs/lockd/clntproc.c:131 Message-ID: <20130727170051.GA31447@redhat.com> References: <51F39AE8.3090401@gmx.de> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <51F39AE8.3090401@gmx.de> User-Agent: Mutt/1.5.18 (2008-05-17) X-Scanned-By: MIMEDefang 2.68 on 10.5.11.25 Sender: linux-nfs-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-nfs@vger.kernel.org X-Spam-Status: No, score=-8.3 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP On 07/27, Toralf Förster wrote: > > I do have a user mode linux image (stable 32 bit Gentoo Linux ) which erratically crashes > while fuzz tested with trinity if the victim files are located on a NFS share. > > The back trace of the core dumps always looks like the attached. > > To bisect it is hard. However after few attempts in the last weeks the following > commit is either the first bad commit or at least the upper limit (less likely). > > > commit 8aac62706adaaf0fab02c4327761561c8bda9448 > Author: Oleg Nesterov > Date: Fri Jun 14 21:09:49 2013 +0200 > > move exit_task_namespaces() outside of exit_notify() > > #15 nlmclnt_setlockargs (req=0x48e18860, fl=0x48f27c8c) at fs/lockd/clntproc.c:131 Thanks. So nlmclnt_setlockargs()->utsname() crashes and we probably need the patch below. But is it correct? I know _absolutely_ nothing about nfs/sunrpc/etc and I never looked into this code before, most probably I am wrong. But it seems that __nlm_async_call() relies on workqueues. nlmclnt_async_call() does rpc_wait_for_completion_task(), but what if the caller is killed? nlm_rqst can't go away, ->a_count was incremented. But can't the caller exit before call->name is used? In this case the memory it points to can be already freed. Oleg. Acked-by: Andrew Vagin --- To unsubscribe from this list: send the line "unsubscribe linux-nfs" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html --- x/kernel/exit.c +++ x/kernel/exit.c @@ -783,8 +783,8 @@ void do_exit(long code) exit_shm(tsk); exit_files(tsk); exit_fs(tsk); - exit_task_namespaces(tsk); exit_task_work(tsk); + exit_task_namespaces(tsk); check_stack_usage(); exit_thread();