Received: by 2002:a25:1506:0:0:0:0:0 with SMTP id 6csp5222316ybv; Tue, 11 Feb 2020 11:28:14 -0800 (PST) X-Google-Smtp-Source: APXvYqwNQ33sAGtUVUhIJwR1uFIioMML8WQwJBy7T60h7nwBCmtvflFwqEPhzl1vdDz6VZPGerwN X-Received: by 2002:aca:a816:: with SMTP id r22mr3945304oie.1.1581449294036; Tue, 11 Feb 2020 11:28:14 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1581449294; cv=none; d=google.com; s=arc-20160816; b=q6mR9zlLMrAtOIMl6Z6TCOlAjAUGfOb/nRMKsOCmuxXZsDoTKi42FA2F4z41sLLo+N QFI+zwPmGxbLQl/bPwmapgW1V6FiZLLUa8WjQ+oA/yZuv4YgEkeZlBgchNZr9WZObKqw 2WQivImeWh3XBcdXLpUarCO4Q8BI0AKdIT76FhMdiBXJB1d7SSCvrShXsHijhuIuIw64 XTDDXuMwXAI9hGvAiC/TG3JpxpHfPE4BvjrikuohNMwMuGrXUI8O4EscrD/rjgf7q8QT vggzDkx4l3a+2W9NLijK2NO6biH6FCW+PuhG0KsBcFlOJR/ADHHwy5hnxEEBQSY2OAL6 aFuA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:in-reply-to:content-disposition :mime-version:references:message-id:subject:cc:to:from:date; bh=8cgNAO4B25wEg33NZwvYgAdQ9VUv6VgpqS6MAS3FJvI=; b=E46sYhLXMdh4lu4PTFBSQ2YPuaftyA7Cuui3WOMy5DchCIlsjFW855E1sKoVtY1XEA ax21svCNprF+K9W+CTbT8gh5TeDRVfK7Oz6NJ3WHFfsqnHu2/fbya+lePQnoPpOHUTku S2MVeLNnu24Z8+IbRN/HBUmA+ZPLn8SrKERCIGnIaNmtfY4U8093lhQ1DTYTS5yTyvdj 59iwa1k1d1+aBB+3cSSFpZm72viPkoCj3gkRfUWg6qo7h9XuKlnPWaCpZ6VQlGwfpjg3 qycAmMJwRHjHVnhtZb1BysdLAn4A9xupIAEGxNyd5Tq2KnCXjSmBHIXpe33kRLFpPw2t pNkg== 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 a22si2267116otp.84.2020.02.11.11.28.01; Tue, 11 Feb 2020 11:28:14 -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; 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 S1730916AbgBKQvO (ORCPT + 99 others); Tue, 11 Feb 2020 11:51:14 -0500 Received: from foss.arm.com ([217.140.110.172]:49706 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728188AbgBKQvO (ORCPT ); Tue, 11 Feb 2020 11:51:14 -0500 Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 6900C1FB; Tue, 11 Feb 2020 08:51:13 -0800 (PST) Received: from arrakis.emea.arm.com (arrakis.cambridge.arm.com [10.1.196.71]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 9FEAC3F68E; Tue, 11 Feb 2020 08:51:12 -0800 (PST) Date: Tue, 11 Feb 2020 16:51:10 +0000 From: Catalin Marinas To: Qian Cai Cc: akpm@linux-foundation.org, elver@google.com, linux-mm@kvack.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH -next] mm/kmemleak: annotate a data race in checksum Message-ID: <20200211165110.GI153117@arrakis.emea.arm.com> References: <1581438245-24391-1-git-send-email-cai@lca.pw> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1581438245-24391-1-git-send-email-cai@lca.pw> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, Feb 11, 2020 at 11:24:05AM -0500, Qian Cai wrote: > The value of object->pointer could be accessed concurrently as noticed > by KCSAN, > > BUG: KCSAN: data-race in crc32_le_base / do_raw_spin_lock > > write to 0xffffb0ea683a7d50 of 4 bytes by task 23575 on cpu 12: > do_raw_spin_lock+0x114/0x200 > debug_spin_lock_after at kernel/locking/spinlock_debug.c:91 > (inlined by) do_raw_spin_lock at kernel/locking/spinlock_debug.c:115 > _raw_spin_lock+0x40/0x50 > __handle_mm_fault+0xa9e/0xd00 > handle_mm_fault+0xfc/0x2f0 > do_page_fault+0x263/0x6f9 > page_fault+0x34/0x40 > > read to 0xffffb0ea683a7d50 of 4 bytes by task 839 on cpu 60: > crc32_le_base+0x67/0x350 > crc32_le_base+0x67/0x350: > crc32_body at lib/crc32.c:106 > (inlined by) crc32_le_generic at lib/crc32.c:179 > (inlined by) crc32_le at lib/crc32.c:197 > kmemleak_scan+0x528/0xd90 > update_checksum at mm/kmemleak.c:1172 > (inlined by) kmemleak_scan at mm/kmemleak.c:1497 > kmemleak_scan_thread+0xcc/0xfa > kthread+0x1e0/0x200 > ret_from_fork+0x27/0x50 > > Reported by Kernel Concurrency Sanitizer on: > CPU: 60 PID: 839 Comm: kmemleak Tainted: G W L 5.5.0-next-20200210+ #3 > Hardware name: HPE ProLiant DL385 Gen10/ProLiant DL385 Gen10, BIOS A40 07/10/2019 > > crc32() will dereference object->pointer. If a shattered value was > returned due to a data race, it will be corrected in the next scan. > Thus, annotate it as an intentional data race using the data_race() > macro. > > Signed-off-by: Qian Cai Acked-by: Catalin Marinas