Received: by 10.213.65.68 with SMTP id h4csp727726imn; Fri, 23 Mar 2018 14:41:32 -0700 (PDT) X-Google-Smtp-Source: AG47ELvv76vbNi2blaBXtGmZHUOfQyopbNOK3Y5WYToroEGS/2+wkm0OB9ba+IUBfBxvBNwwBbLw X-Received: by 10.101.75.81 with SMTP id k17mr12776143pgt.335.1521841292735; Fri, 23 Mar 2018 14:41:32 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1521841292; cv=none; d=google.com; s=arc-20160816; b=ubUzYKsI69CyNKQ665HL7RO3FzJ9gXX2J7bTpi4Vke5Yz5zUfsVU9OveHcsKSxd7kE dpR1TqMJe8CI+otDpIP5s3otxABZJEDcb/jr+vaCfF0thuVbHdR9tCOwrTkJS+w3+XPI cn41d7Huz00SyWcJHf6bfeUUcsL1JKh5GRCpNzywdeycH7888AyAIZzbNZqO0rJSzKFl /fCkjdYgA3DN46n4znpx1U2vhNQ4UFZhsOwMHGbw0yCiBEIeGFIf6xn2KFb802xLVyJ4 tmD7HyDwGdS9cWDHCYWcVNb8XLOhRRbgUGOpiJOHVntCGjA0N7ONKdDopDfsdT7w1AKF r4kQ== 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 :references:in-reply-to:message-id:subject:cc:to:from:date :dmarc-filter:arc-authentication-results; bh=MlUVmQSdWjg3iYHMPqohrEr1oshjJaaSqQQ3ClW2VdE=; b=J3DLWAH6CTYN0dTWizvp9FyzQPerAnXQ0scwbKuV9tKAqRbtvQGpMa2BQqa2Y4RD1u TyPdkq4iEF47rEdMm+IyeO394DbN2ZDfSzLj6SvjYQ2Lx6Hd9VgHIwSjRPmG/NZuiy2G ldzHmJ7ge++PQ08UhzuziRW+v4jRMzd/O5aXfRKF3XjXAcnlXoQW1+Of05H0xG1aKTBL yfawjKT3WbSadGkT1HM5Rm57o5aRzGAyMUNh7uhRQqOYtfaH6EYtbhf8YIkoqfP33n19 zaCn4/p3DoBXIN0EtByi/meM1nVOuw20SRODQGJpZ9fzsiYb9qlJ3y9cNcANUR8oaovR j0qA== 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 t11si6604776pgn.624.2018.03.23.14.41.17; Fri, 23 Mar 2018 14:41:32 -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 S1752256AbeCWVk1 (ORCPT + 99 others); Fri, 23 Mar 2018 17:40:27 -0400 Received: from mail.kernel.org ([198.145.29.99]:55718 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752026AbeCWVk0 (ORCPT ); Fri, 23 Mar 2018 17:40:26 -0400 Received: from gandalf.local.home (cpe-172-100-180-131.stny.res.rr.com [172.100.180.131]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 2A2CF21749; Fri, 23 Mar 2018 21:40:25 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 2A2CF21749 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=goodmis.org Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=rostedt@goodmis.org Date: Fri, 23 Mar 2018 17:40:23 -0400 From: Steven Rostedt To: Thomas Gleixner Cc: LKML , "Paul E. McKenney" , Peter Zijlstra , Josh Triplett , Mathieu Desnoyers , Lai Jiangshan , Joel Fernandes Subject: Re: rcu: Add might_sleep() check to synchronize_rcu() Message-ID: <20180323174023.60579f45@gandalf.local.home> In-Reply-To: References: <20180323172843.763579a9@gandalf.local.home> X-Mailer: Claws Mail 3.16.0 (GTK+ 2.24.31; x86_64-pc-linux-gnu) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, 23 Mar 2018 22:33:29 +0100 (CET) Thomas Gleixner wrote: > On Fri, 23 Mar 2018, Steven Rostedt wrote: > > > On Fri, 23 Mar 2018 22:12:24 +0100 (CET) > > Thomas Gleixner wrote: > > > > > synchronize_rcu() lacks a might_sleep() check which would have caught that > > > issue way earlier because it would trigger with the minimal debug options > > > enabled. > > > > > > Add a might_sleep() check to catch such cases. > > > > I'm not against the patch, but really? I would think that > > synchronize_rcu() would pretty much always schedule, and scheduling > > from atomic would have triggered with minimal debug options enabled. > > Dunno. The reported splat is here: > > https://pastebin.com/raw/puvh0cXE [ 150.560848] ODEBUG: object is not on stack, but annotated [ 150.566398] ------------[ cut here ]------------ [ 150.571133] WARNING: CPU: 1 PID: 0 at lib/debugobjects.c:300 __debug_object_init+0x526/0xc40 [ 150.579682] Kernel panic - not syncing: panic_on_warn set ... [ 150.579682] [ 150.587012] CPU: 1 PID: 0 Comm: swapper/1 Not tainted 4.9.89-g960923f #61 [ 150.593906] Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 01/01/2011 [ 150.603233] ffff8801db307a08 ffffffff81d96069 ffffffff83a482c0 ffff8801db307ae0 [ 150.611190] ffffffff83c19700 ffffffff81dfefb6 0000000000000009 ffff8801db307ad0 [ 150.619157] ffffffff8142fbd1 0000000041b58ab3 ffffffff8418bd08 ffffffff8142fa15 [ 150.627118] Call Trace: [ 150.629667] [ 150.631700] [] dump_stack+0xc1/0x128 [ 150.637051] [] ? __debug_object_init+0x526/0xc40 [ 150.643431] [] panic+0x1bc/0x3a8 [ 150.648416] [] ? percpu_up_read_preempt_enable.constprop.53+0xd7/0xd7 [ 150.656611] [] ? load_image_and_restore+0xf9/0xf9 [ 150.663070] [] ? vprintk_default+0x1d/0x30 [ 150.668925] [] ? __warn+0x1a9/0x1e0 [ 150.674170] [] ? __debug_object_init+0x526/0xc40 [ 150.680543] [] __warn+0x1c4/0x1e0 [ 150.685614] [] warn_slowpath_null+0x2c/0x40 [ 150.691972] [] __debug_object_init+0x526/0xc40 [ 150.698174] [] ? debug_object_fixup+0x30/0x30 [ 150.704283] [] debug_object_init_on_stack+0x19/0x20 [ 150.710917] [] __wait_rcu_gp+0x93/0x1b0 [ 150.716508] [] synchronize_rcu.part.65+0x101/0x110 [ 150.723054] [] ? rcu_pm_notify+0xc0/0xc0 [ 150.728735] [] ? __call_rcu.constprop.72+0x910/0x910 [ 150.735459] [] ? __lock_is_held+0xa1/0xf0 [ 150.741223] [] synchronize_rcu+0x27/0x90 [ 150.746908] [] __l2tp_session_unhash+0x3d5/0x550 Looks like __l2tp_session_unhash() is the real culprit here. [ 150.753281] [] ? __l2tp_session_unhash+0x1bf/0x550 [ 150.759828] [] ? __local_bh_enable_ip+0x6a/0xd0 [ 150.766123] [] ? l2tp_udp_encap_recv+0xd90/0xd90 [ 150.772497] [] l2tp_tunnel_closeall+0x1e7/0x3a0 [ 150.778782] [] l2tp_tunnel_destruct+0x30e/0x5a0 [ 150.785067] [] ? l2tp_tunnel_destruct+0x1aa/0x5a0 [ 150.791537] [] ? l2tp_tunnel_del_work+0x460/0x460 [ 150.797997] [] __sk_destruct+0x53/0x570 [ 150.803588] [] rcu_process_callbacks+0x898/0x1300 [ 150.810048] [] ? rcu_process_callbacks+0x977/0x1300 [ 150.816684] [] ? __sk_dst_check+0x240/0x240 [ 150.822625] [] __do_softirq+0x206/0x951 [ 150.828223] [] irq_exit+0x165/0x190 [ 150.833557] [] smp_apic_timer_interrupt+0x7b/0xa0 [ 150.840018] [] apic_timer_interrupt+0xa0/0xb0 [ 150.846132] [ 150.848166] [] ? native_safe_halt+0x6/0x10 [ 150.854036] [] ? trace_hardirqs_on+0xd/0x10 [ 150.859973] [] default_idle+0x55/0x360 [ 150.865478] [] arch_cpu_idle+0xa/0x10 I think you want this instead, as __l2tp_session_unhash is what looks like might be hiding the call to synchronize_rcu(). It's not called in all instances, and I don't think your patch would have triggered the issues before hand. You want this: diff --git a/net/l2tp/l2tp_core.c b/net/l2tp/l2tp_core.c index 194a7483bb93..857b494bee29 100644 --- a/net/l2tp/l2tp_core.c +++ b/net/l2tp/l2tp_core.c @@ -1677,6 +1677,8 @@ void __l2tp_session_unhash(struct l2tp_session *session) { struct l2tp_tunnel *tunnel = session->tunnel; + might_sleep(); + /* Remove the session from core hashes */ if (tunnel) { /* Remove from the per-tunnel hash */ -- Steve