Received: by 2002:a25:ad19:0:0:0:0:0 with SMTP id y25csp4207296ybi; Fri, 19 Jul 2019 17:31:55 -0700 (PDT) X-Google-Smtp-Source: APXvYqyCODOEM1H7KnTMjNpWIljHKLgojCAE3dfCbtRLKh0haHqMNGW/A1g0BenNtXx954dXBS9d X-Received: by 2002:a17:90a:23ce:: with SMTP id g72mr29732239pje.77.1563582715548; Fri, 19 Jul 2019 17:31:55 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1563582715; cv=none; d=google.com; s=arc-20160816; b=yJeUCp53+ckd5DoRq/Vs5eq5M2wTCeXIRki9NhZBUGkHGgBx3F2pIFfLQdWGF78tA0 Kx6FS1z2JNhexEHw7VWXd8mBhHx1MuuBHgcmYQeXCmP5Fl0iIREg6HAZJn23Xr8AzV3W F3sDS/udy20L2G8HJgq9rY1sBHBr+RzJrMpwd4pUng9rTyUAD5gKK/2KbHSqOMY6FvtJ /vphiGW615bh1PISoax7u4msMIO7OCk8q2+HwMDX2hipNDsC6qW35iKJA0Q0JGx4xFvM LtVwr1hG31Yb+beCgvOfd9xme0lHmdkDsP1zn5bQLi0OSlE1XP+EiGmqJY7Q6mlCERYt Y2MA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :message-id:in-reply-to:date:references:subject:cc:to:from; bh=2HvguSI+MhCiWLh4J33Llhg13COtxJ4TZKYF1qR/bDQ=; b=sldlzJxUnkwTCXDpEkeyYhbd5iHPBHLmnLKZY3to4+BCGWYo7vt59qAJ6ykxQ2MV+z jwwiEHyucnxbVU81uX+kWWdbLJyEg6/0ZHLv0y/gKFD7d1bqOtrYolyp8nxNcDlB3lfn kvrzTPy1MMelXDZ4pdoDtgchYnik/GEDEhiPCg8reJC/F8rjPd4Tlpwt9Ud8mYX3sUiV ie2lihKS8xqq/V+ux9rE4ShQgxHoqcBG5MD/vXGoRoVB0dUXZm4PHKK+eYXusSxkgSP7 EcLpdLjCqSE89LrYBgUfZm8JMxjkTe2p6GY1ddzAbnGNbvd90ZdJK0otoQQlqcLMCPgD CYGQ== ARC-Authentication-Results: i=1; mx.google.com; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id r18si21116032pgl.173.2019.07.19.17.31.36; Fri, 19 Jul 2019 17:31:55 -0700 (PDT) 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; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2387687AbfGSTpf convert rfc822-to-8bit (ORCPT + 99 others); Fri, 19 Jul 2019 15:45:35 -0400 Received: from mx2.suse.de ([195.135.220.15]:42836 "EHLO mx1.suse.de" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S2387668AbfGSTpe (ORCPT ); Fri, 19 Jul 2019 15:45:34 -0400 X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay2.suse.de (unknown [195.135.220.254]) by mx1.suse.de (Postfix) with ESMTP id 5E00FACBC; Fri, 19 Jul 2019 19:45:33 +0000 (UTC) From: Luis Henriques To: Waiman Long Cc: Borislav Petkov , Will Deacon , "huang ying" , Peter Zijlstra , , Thomas Gleixner , Linus Torvalds , Tim Chen , "Ingo Molnar" , Davidlohr Bueso , , "H. Peter Anvin" Subject: Re: [PATCH v8 13/19] locking/rwsem: Make rwsem->owner an atomic_long_t References: <20190520205918.22251-1-longman@redhat.com> <20190520205918.22251-14-longman@redhat.com> <20190719184538.GA20324@hermes.olymp> <2ed44afa-4528-a785-f188-2daf24343f97@redhat.com> Date: Fri, 19 Jul 2019 20:45:32 +0100 In-Reply-To: <2ed44afa-4528-a785-f188-2daf24343f97@redhat.com> (Waiman Long's message of "Fri, 19 Jul 2019 15:32:10 -0400") Message-ID: <87lfwtlsf7.fsf@suse.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8BIT Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Waiman Long writes: > On 7/19/19 2:45 PM, Luis Henriques wrote: >> On Mon, May 20, 2019 at 04:59:12PM -0400, Waiman Long wrote: >>> The rwsem->owner contains not just the task structure pointer, it also >>> holds some flags for storing the current state of the rwsem. Some of >>> the flags may have to be atomically updated. To reflect the new reality, >>> the owner is now changed to an atomic_long_t type. >>> >>> New helper functions are added to properly separate out the task >>> structure pointer and the embedded flags. >> I started seeing KASAN use-after-free with current master, and a bisect >> showed me that this commit 94a9717b3c40 ("locking/rwsem: Make >> rwsem->owner an atomic_long_t") was the problem. Does it ring any >> bells? I can easily reproduce it with xfstests (generic/464). >> >> Cheers, >> -- >> Luís > > This patch shouldn't change the behavior of the rwsem code. The code > only access data within the rw_semaphore structures. I don't know why it > will cause a KASAN error. I will have to reproduce it and figure out > exactly which statement is doing the invalid access. Yeah, screwing the bisection is something I've done in the past so I may have got the wrong commit. Another detail is that I was running xfstests against CephFS, I didn't tried with any other filesystem. I can try to reproduce with btrfs or xfs next week. Cheers, -- Luis