Received: by 10.223.185.116 with SMTP id b49csp3947831wrg; Mon, 26 Feb 2018 08:39:29 -0800 (PST) X-Google-Smtp-Source: AH8x2272XQ2f676ywzS+yzFZAHAmI67FXnU33eAYLhh2WxDczmkZhwcy7ocSEtrz2xSClp/94nqP X-Received: by 10.98.247.9 with SMTP id h9mr11162564pfi.212.1519663169817; Mon, 26 Feb 2018 08:39:29 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1519663169; cv=none; d=google.com; s=arc-20160816; b=iaoOxth3JTIqJgoGtbdPV92pML6n3UG6YM2kkWbEiggAmoAfcOqrnKrFBf43rzG6F4 qvCM+ZfPEVZAl2tYXqiNactEUN3IWcN8rmZrVCyfAxLsg84vFl0kWMdzwDN68uFgUxCH nK1FubThyQNleMfrSqJP0HRQtJkPf+7gFuKH2NEKWt6yKxprGrKB39phw6znUURnTLUy Y5Z2V4Zezy+ruX77mh+73Mk0JPW49Wgaxgi7DyoGN3XP9hYClIiVxWCED2dhIsF6IlZN OWLj4tjwqlWfehyJpVfD3ewiAyyReA4Ts2Sw0b9My3dfP5o4SLLRT+dGTrIbJnPvhWLi 72pQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :references:in-reply-to:mime-version:dkim-signature :arc-authentication-results; bh=y+ul6Sty/UrsoaRaq+Ui0TvzhIYwc8zGaM+MemyW+z4=; b=yaxeEAq7HjrKzkOB6JJ10+/2TOvQLGZ5J6pphEz8Lj7zyBN/2go6mtYp2SRSH8jApV eOD3//0yk/iZ7h0qPdjnxiDJdi7lk/eIoTgZodPX8KTxHlYi7HJNS2YAIFgjDKgAANS8 FND8ouldo9MkYoFg90n+3I/IbIbWXDVt2YMerwbpJ9PAmUJFgReGf+o9kpRcuTtdKc30 81Ac5EUjcIdRLxdKe1uRUttxG/2M1cJf+AvfYhpdAIT8dC6vlrtVjB0zhCn3TbXAwJfl SEYrKeZrpQ5RzRzsyNrt1l10xCrN9pU6CsqqzIzWvLeQ0YLAtTPjQCEHCJfuy370xFF9 Id3A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@android.com header.s=20161025 header.b=eSZWx7Ao; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=android.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id d9si5760195pfb.232.2018.02.26.08.39.15; Mon, 26 Feb 2018 08:39:29 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@android.com header.s=20161025 header.b=eSZWx7Ao; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=android.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751789AbeBZQie (ORCPT + 99 others); Mon, 26 Feb 2018 11:38:34 -0500 Received: from mail-qk0-f194.google.com ([209.85.220.194]:38061 "EHLO mail-qk0-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750757AbeBZQic (ORCPT ); Mon, 26 Feb 2018 11:38:32 -0500 Received: by mail-qk0-f194.google.com with SMTP id s198so19775032qke.5 for ; Mon, 26 Feb 2018 08:38:32 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=android.com; s=20161025; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc; bh=y+ul6Sty/UrsoaRaq+Ui0TvzhIYwc8zGaM+MemyW+z4=; b=eSZWx7Ao8ZkO3aqAcUdeRZI89HA9EJnz9qEk+l4qSBfKWR8r2ayKZbe4kNT7CsOHsX Mwl0dtemQLJefx4ZLictRWp63xtUVUi6Bj9EksxintBLLT2mxr/QhUjt+J8kcxWgaNQ3 fI5aNWTHC7IofQLV110qEGi4Yn14NELfnizfM22x5dkipVpfJawyKz88xhRTo80TDgle gMsd7fbEVlmitcOg2g/rUCsh4c1IiN0w2ieNVhcLZeWSTj7zkxynTu0iE+hQ6CKD1MWK oA9w1fBgdiC1rRGkyAg606jsRKE7wZkhlwL1DgOLAgYwgHpytAPXTYNt9zDSLBCmiM7p YYFg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to:cc; bh=y+ul6Sty/UrsoaRaq+Ui0TvzhIYwc8zGaM+MemyW+z4=; b=gwM/XtUZ0Fq6nC5ja6C6bUk09iG494qBK4D/FcAUFtSCOjHeahBLlEcN9VCeEIrbcT uMd2cqbE2UCkg4TtUBeHgGgs6ip+VwmiMmHUU2xOcJtO9yRtRbyPtGdelknqfYICYD3l JC+P8+coLAPonQ7xVEAvf50uZB6Altp8Qpn+kI2252UzwpXgDTMswOVQpxaAjUhFVuE+ /kl5WJxG4hXHVfqZJS9up7BHLOqQ2txvc/pJNUE3gRga12FwwizyCd0/NdfzmxJ+1T4k 4js2TOdFSV7J5zEo8en/45v4oEIPS9jwoRbRSzQkTSZQu4G3mhCY0b/ykpWkCsQkM7g1 VZhQ== X-Gm-Message-State: APf1xPBov9aZi62tz1kHH3IDjEmTO1yWbHNiwKWfswBmKf92mOAM/tMs pR1j6adIJaIgcQwncDp1XtLPBGwyobDrYAHZh+Pdfw== X-Received: by 10.55.174.129 with SMTP id x123mr17160780qke.166.1519663108924; Mon, 26 Feb 2018 08:38:28 -0800 (PST) MIME-Version: 1.0 Received: by 10.140.85.227 with HTTP; Mon, 26 Feb 2018 08:38:28 -0800 (PST) In-Reply-To: References: <20180216190201.59572-1-joelaf@google.com> <20180222134832.GA1400@kroah.com> From: Todd Kjos Date: Mon, 26 Feb 2018 08:38:28 -0800 Message-ID: Subject: Re: [PATCH v2] staging: android: ashmem: Fix lockdep issue during llseek To: Joel Fernandes Cc: Greg Kroah-Hartman , LKML , Todd Kjos , Arve Hjonnevag , Greg Hackmann , stable@vger.kernel.org Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Ack. I confirmed that the syzbot could not reproduce the issue with this patch. On Thu, Feb 22, 2018 at 1:02 PM, Joel Fernandes wrote: > (reposting in plain text, sorry for the previous HTML email, I should > have not posted from the Phone) > > On Thu, Feb 22, 2018 at 5:48 AM, Greg Kroah-Hartman > wrote: >> On Fri, Feb 16, 2018 at 11:02:01AM -0800, Joel Fernandes wrote: >>> ashmem_mutex create a chain of dependencies like so: >>> >>> (1) >>> mmap syscall -> >>> mmap_sem -> (acquired) >>> ashmem_mmap >>> ashmem_mutex (try to acquire) >>> (block) >>> >>> (2) >>> llseek syscall -> >>> ashmem_llseek -> >>> ashmem_mutex -> (acquired) >>> inode_lock -> >>> inode->i_rwsem (try to acquire) >>> (block) >>> >>> (3) >>> getdents -> >>> iterate_dir -> >>> inode_lock -> >>> inode->i_rwsem (acquired) >>> copy_to_user -> >>> mmap_sem (try to acquire) >>> >>> There is a lock ordering created between mmap_sem and inode->i_rwsem >>> causing a lockdep splat [2] during a syzcaller test, this patch fixes >>> the issue by unlocking the mutex earlier. Functionally that's Ok since >>> we don't need to protect vfs_llseek. >>> >>> [1] https://patchwork.kernel.org/patch/10185031/ >>> [2] https://lkml.org/lkml/2018/1/10/48 >>> >>> Cc: Todd Kjos >>> Cc: Arve Hjonnevag >>> Cc: Greg Hackmann >>> Cc: Greg Kroah-Hartman >>> Cc: stable@vger.kernel.org >>> Reported-by: syzbot+8ec30bb7bf1a981a2012@syzkaller.appspotmail.com >>> Signed-off-by: Joel Fernandes >>> --- >>> Changes since first version: >>> Don't relock after vfs call since its not needed. Only reason we lock is >>> to protect races with asma->file. >>> https://patchwork.kernel.org/patch/10185031/ >> >> I'd like some acks from others before I take this patch. > > GregH, Todd, could you provide Acks? > >> >> Joel, did the original reporter say this patch solved their issue or >> not? For some reason I didn't think it worked properly... > > That's a different but similar issue: > https://patchwork.kernel.org/patch/10202127/. That was related to > RECLAIM_FS lockdep recursion. That was posted as an RFC unlike this > one, and its still being investigated since Miles reported that the > lockdep inode annotation doesn't fix the issue. > > This one on the other hand has a straightforward fix, and was verified > by the syzbot. > > I can see why its easy to confuse the two issues. > > Thanks, > > - Joel