Received: by 2002:a25:824b:0:0:0:0:0 with SMTP id d11csp1728403ybn; Thu, 26 Sep 2019 01:02:16 -0700 (PDT) X-Google-Smtp-Source: APXvYqxMQw+4KkJkRkDQsZKrXVR2lWmYPFc5L1FRwfqXCd8GL9+HkM5wFzYW9qSXnk9twRYBiBNN X-Received: by 2002:a50:a8a2:: with SMTP id k31mr2091534edc.79.1569484936688; Thu, 26 Sep 2019 01:02:16 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1569484936; cv=none; d=google.com; s=arc-20160816; b=Uu52Jv3BdDuUQnYwkPNLzU5VJf0NRDGJdXHwrc2nzZwKM/b40Kp3vUHPcElI3vvJMB Zpg/HaR77De9NGn8U2J2yr71bCvRdTOhCWFUUShai/sp5riZ1tlsiHBrLHO4GBo0YrBR GNdsl5bIWuz97P1m/Lt/wfhVIzvLzV0XVUXbfn65SdwfHJ6hSnZkZIWICzDYGwYzwL+u 4/CWRXopxdagIGQ8GWDgMIwizLHbRty3y8OkKrq4mi8n3kzaWqdhoLsh6Sr4N/Ta3vYW VzpHbXPN8wKOlD8yjKbIT1LvRQ8A2RlYZO17v4RDa4hMEJySVA78tokpzaT6H7DyabmP rqLw== 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 :in-reply-to:references:mime-version:dkim-signature; bh=047KnQ6LdhsRxOhyWfYTMxQxy1h5WOedU8au5fznWn8=; b=aIAAvLZguuRm3kDRC3LTQctCSnbNis7RV2VzG86w3b/7xaNKYlKum2tncvzFDXJ3qp 50aVlYG2mj18YcLgAy1IS4O+528sE0Q03WE5MMvSvQr3f9SX2oPs4Veui2Xkco3/DsL0 4RRh75/YnXUjmEFKwBVRQDlhbpl2yr+FnYqiE89Swig8TUU5rnmT2NIjKm/6xkYK9KYN wjTc4FQPrLtIL6nTNCEvO1Oh3Tu0A+r+t9EJTlNh6/7eAy8zSIHFhYZ1Tr5nAMHKLZA2 Nf2B4x1AZhKvF+5y8AgvJuAt3ypDG2XTe36Lff/Bj+2DUT56/OxPtrioaK6W9A1ODbsn rRrA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@joelfernandes.org header.s=google header.b=yahCuT4M; 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 w30si864391edd.137.2019.09.26.01.01.53; Thu, 26 Sep 2019 01:02:16 -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; dkim=pass header.i=@joelfernandes.org header.s=google header.b=yahCuT4M; 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 S1730291AbfIXMP2 (ORCPT + 99 others); Tue, 24 Sep 2019 08:15:28 -0400 Received: from mail-qt1-f194.google.com ([209.85.160.194]:35060 "EHLO mail-qt1-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728080AbfIXMP1 (ORCPT ); Tue, 24 Sep 2019 08:15:27 -0400 Received: by mail-qt1-f194.google.com with SMTP id m15so1823215qtq.2 for ; Tue, 24 Sep 2019 05:15:26 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=joelfernandes.org; s=google; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=047KnQ6LdhsRxOhyWfYTMxQxy1h5WOedU8au5fznWn8=; b=yahCuT4MwNpleohZaQiHmCHhaUSWw5H4Pr5iiHh5pf13MCXAo/t00Gs9sjgw8G8Ah8 oTUWPliQ1GIyrLzFj7zswmCgWB4PQ9lkFE5wNZNW797RInyr0oiCgArJTuQcTK1/UXsN shiys6Jm7JyT+EugqvB62cMPK5VJZBR5OJFJQ= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=047KnQ6LdhsRxOhyWfYTMxQxy1h5WOedU8au5fznWn8=; b=GXLtVMdwkVrJ2R1TvHsYWhyLAUaSKXiIVPrPuB/pChgXoNpplRjF003a88VOYhhzOG lB0kDuwHgxMlJ3oBlA22tzebd1qtgkXUSVRdNAwEvSku5N8JSiS/Q02F4L2P8ZS0P5uI 9HsJ1E51Kc5wXfgoSXAMsHvCxkVB7VVqZ5TpQnKzEmdhOA9HdZBwEUUvlAfVc2eS8SNF 51Y7v7TotendWmyuFpSgv3u4POVKhw4sao5qzeHzo/8XwXX35jtoq1XZR1Vv5iW1ERx0 2aTaBzUMhXSlo30WVrfSHTXORew3g0Te12lBTQ0CqFoabWTcb8SZ19PX2GBJdJXRywJ0 x4Rw== X-Gm-Message-State: APjAAAXQTQzuPtHoQ/GlUtqoYV8mGBbZWUHvQwDh8wd631d0ytqnqA+7 OiEV0N/jsJkV2sE6/vRSjSDuka2isCTQy+Mj3QEBwQ== X-Received: by 2002:ac8:2f81:: with SMTP id l1mr2393360qta.269.1569327326371; Tue, 24 Sep 2019 05:15:26 -0700 (PDT) MIME-Version: 1.0 References: <20190924080510.GL20699@kadam> In-Reply-To: <20190924080510.GL20699@kadam> From: Joel Fernandes Date: Tue, 24 Sep 2019 08:15:12 -0400 Message-ID: Subject: Re: [rcu:dev.2019.09.23a 62/77] kernel/rcu/tree.c:2882 kfree_call_rcu() warn: inconsistent returns 'irqsave:flags'. To: Dan Carpenter Cc: kbuild@01.org, kbuild-all@01.org, LKML , "Paul E. McKenney" , "Joel Fernandes (Google)" 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 On Tue, Sep 24, 2019 at 4:05 AM Dan Carpenter wrote: > > tree: https://kernel.googlesource.com/pub/scm/linux/kernel/git/paulmck/linux-rcu.git dev.2019.09.23a > head: 97de53b94582c208ee239178b208b8e8b9472585 > commit: 39676bb72323718a9e7bab1ba9c4a68319a96f62 [62/77] rcu: Add support for debug_objects debugging for kfree_rcu() > > If you fix the issue, kindly add following tag > Reported-by: kbuild test robot > Reported-by: Dan Carpenter > > smatch warnings: > kernel/rcu/tree.c:2882 kfree_call_rcu() warn: inconsistent returns 'irqsave:flags'. > Locked on: line 2867 > Unlocked on: line 2882 > > git remote add rcu https://kernel.googlesource.com/pub/scm/linux/kernel/git/paulmck/linux-rcu.git > git remote update rcu > git checkout 39676bb72323718a9e7bab1ba9c4a68319a96f62 > vim +2882 kernel/rcu/tree.c > > 5f5046cc15d514 Joel Fernandes (Google 2019-08-05 2850) void kfree_call_rcu(struct rcu_head *head, rcu_callback_t func) > 5f5046cc15d514 Joel Fernandes (Google 2019-08-05 2851) { > 5f5046cc15d514 Joel Fernandes (Google 2019-08-05 2852) unsigned long flags; > 5f5046cc15d514 Joel Fernandes (Google 2019-08-05 2853) struct kfree_rcu_cpu *krcp; > 5f5046cc15d514 Joel Fernandes (Google 2019-08-05 2854) > 5f5046cc15d514 Joel Fernandes (Google 2019-08-05 2855) head->func = func; > 5f5046cc15d514 Joel Fernandes (Google 2019-08-05 2856) > 87970ccf5a9125 Paul E. McKenney 2019-09-19 2857 local_irq_save(flags); // For safely calling this_cpu_ptr(). > ^^^^^^^^^^^^^^^^^^^^^ > IRQs disabled. > > 5f5046cc15d514 Joel Fernandes (Google 2019-08-05 2858) krcp = this_cpu_ptr(&krc); > ff8db005e371cb Paul E. McKenney 2019-09-19 2859 if (krcp->initialized) > 5f5046cc15d514 Joel Fernandes (Google 2019-08-05 2860) spin_lock(&krcp->lock); > 5f5046cc15d514 Joel Fernandes (Google 2019-08-05 2861) > 87970ccf5a9125 Paul E. McKenney 2019-09-19 2862 // Queue the object but don't yet schedule the batch. > 39676bb7232371 Joel Fernandes (Google 2019-09-22 2863) if (debug_rcu_head_queue(head)) { > 39676bb7232371 Joel Fernandes (Google 2019-09-22 2864) // Probable double kfree_rcu(), just leak. > 39676bb7232371 Joel Fernandes (Google 2019-09-22 2865) WARN_ONCE(1, "%s(): Double-freed call. rcu_head %p\n", > 39676bb7232371 Joel Fernandes (Google 2019-09-22 2866) __func__, head); > 39676bb7232371 Joel Fernandes (Google 2019-09-22 2867) return; > > Need to re-enable before returning. Right. At this point the system has a bug anyway since it is a double-free. But yes, no reason to introduce more bugs. Will fix. Thank you, Dan!