Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp3852426imu; Mon, 7 Jan 2019 10:37:40 -0800 (PST) X-Google-Smtp-Source: ALg8bN6B8FHEiLsBqj9WHvlFtAy+7NYfgFXAvYLMR0pgkAt2WcFmFflHFvo9TiB+YrQjr2mmkZjK X-Received: by 2002:a63:181c:: with SMTP id y28mr11542758pgl.75.1546886260585; Mon, 07 Jan 2019 10:37:40 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1546886260; cv=none; d=google.com; s=arc-20160816; b=U+4BI07dP49hgI0+86iKyb31m8QpYkq8+4R1D4q6LE5Eg6MpBnHJNBVTMQvgKc1EO8 EuHSI7B1qyzOhPO+eY7mraJZuraCkg1JtrFaoZoJxWSLgAO6jmMU3Qa7F1qNhjRlmNNs 5HqxEuzXr15+JIBl/dwjmbyjYxgDJuMurqoIiPM94wfxAcRRBkGEyQDZUpuFhSXA8XSd nWPspGC0fTxIGoQpXvhStLUl/U1fIyCTMTMjZ7CQ4RDt2S+SdR/VntbPkdfguZxtGXfe AkRma6Lc1qJL4tgjZntXQ4uvjYTy67lsME0HYP1UedgNM73HSKHUIxVyHhSSrPH1QY+9 2CqA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:dkim-signature; bh=euARqB5kVSyB8NpufQQY56ama9yogfHlo/3p11W57dY=; b=RgkvpGc20vHlKZM7du2FGYVY34c3GFMZ6eYRPnf2RZ3x7OcjEZnEV4ZDnHrI0Ez11f IdC3kBezT/sbLqgyYicZwkQ0vLKtN8e5SNqT2xOyOCbPkueUsF58/xGL2hLeA/HNGsID gGF0A2xXsTUElk/V7uJlysigkJcsK4WIafd9rt9iaHh9duki7LXvZxi8Lam2pe2VyHYf hDO/jCAfLrHfHMP7YaSt1zABb2uRI1lRXvFfhx+mKIANKttUwc44iXeN96cwnN9iRTWK xgb2Dr82jYv4qGDaZTT5vAZuo4XX4c4OfuN5JqVAXHSBiYebSHkQ6+Wz7ntdY1FFQOdF fMNQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=WQmglvb9; 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=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id 59si8092050ple.291.2019.01.07.10.37.25; Mon, 07 Jan 2019 10:37:40 -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=@gmail.com header.s=20161025 header.b=WQmglvb9; 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=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727131AbfAGSes (ORCPT + 99 others); Mon, 7 Jan 2019 13:34:48 -0500 Received: from mail-wm1-f66.google.com ([209.85.128.66]:56169 "EHLO mail-wm1-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726132AbfAGSes (ORCPT ); Mon, 7 Jan 2019 13:34:48 -0500 Received: by mail-wm1-f66.google.com with SMTP id y139so1780558wmc.5 for ; Mon, 07 Jan 2019 10:34:47 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to:user-agent; bh=euARqB5kVSyB8NpufQQY56ama9yogfHlo/3p11W57dY=; b=WQmglvb9jQBTTbIeHYHOveVrKsdh4LhjWK6HKkVpSKsto7fUWxchLqLtjsI+K775dX v5rSpBlPP3XMTFa7tfy2i2S/9mivbDBYlfIzoOt0tQlA4qPd31aiSyRNcVFj8NdlMeR4 nWUmNqt5JEtqC4d4Gf7lrJwBWiJ61lzcYqiy/r7T1HfrSEs22whHdHchqORCLiXSvW2M +Zid/fmDZyakfDB9eovWSTS98DCUKyl0OOZJnrc9+lJaZTkYS4o0ZGvVUAH3oubHy9Gv rP/xaQZtbkg7aCPTTsZmuJXQhZ5Ya0Lh73ODFgPjkjBtqXFuMqGcLhKca2NjOmq6iXBo LBUA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to:user-agent; bh=euARqB5kVSyB8NpufQQY56ama9yogfHlo/3p11W57dY=; b=eSmGESNW9V+Nrf2a5YimZx2CVGsvd6MvILmke76HANxJnuQ97r3kpjPDm0eX5j7zrK 0sJRPEK4aiSEe3WY0bpjot7dt4N4XjsH+BweLfJIld4cWJhQCmDHrkpZSky+Z/kKviuX +uXkKYAEtLrZj/ALUA/+x35TR/L0p/LKKZRyLgbhiVAMHZaFHA/TmOWIVfXeOwRRmBkK 2MsSGRHDrBh7uK/y1ld0jbTEU9PjSNkzeWjLcSeHDBSxTt4/NDSWLQdsxNayoTVALreg X39dxowf/BvsuxTMhDS391sBhLInApAoJotIJdwFBp+ApLa8NOQghJa+rFs5tgVEZj6n f67Q== X-Gm-Message-State: AJcUukdm08614LpZ3gMhngJQb0xA1IycuzGmNI8j0AzcVr0Vx2/3OXXA o0Qlso3TF2nLWZ8DknRjAQ== X-Received: by 2002:a1c:8f41:: with SMTP id r62mr9154944wmd.141.1546886086231; Mon, 07 Jan 2019 10:34:46 -0800 (PST) Received: from localhost (host89-130-dynamic.43-79-r.retail.telecomitalia.it. [79.43.130.89]) by smtp.gmail.com with ESMTPSA id j124sm3064916wmb.48.2019.01.07.10.34.45 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Mon, 07 Jan 2019 10:34:45 -0800 (PST) Date: Mon, 7 Jan 2019 19:34:44 +0100 From: Andrea Righi To: Masami Hiramatsu Cc: Ingo Molnar , peterz@infradead.org, Mathieu Desnoyers , linux-kernel , Steven Rostedt Subject: Re: [PATCH 0/2] kprobes: Fix kretprobe incorrect stacking order problem Message-ID: <20190107183444.GA5966@xps-13> References: <154686789378.15479.2886543882215785247.stgit@devbox> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <154686789378.15479.2886543882215785247.stgit@devbox> User-Agent: Mutt/1.9.4 (2018-02-28) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, Jan 07, 2019 at 10:31:34PM +0900, Masami Hiramatsu wrote: ... > BTW, this is not all of issues. To remove CONFIG_KPROBE_EVENTS_ON_NOTRACE > I'm trying to find out other notrace functions which can cause > kernel crash by probing. Mostly done on x86, so I'll post it > after this series. Not sure if you found it already, but it looks like some of the _raw_spin_lock/unlock* functions (when they're not inlined) are causing the same problem (or something similar), I can deadlock the system by doing this for example: echo "r:event_1 __fdget" >> kprobe_events echo "r:event_2 _raw_spin_lock_irqsave" >> kprobe_events echo 1 > events/kprobes/enable [DEADLOCK] Sending the following just in case... Thanks, kernel/locking/spinlock.c | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/kernel/locking/spinlock.c b/kernel/locking/spinlock.c index 936f3d14dd6b..d93e88019239 100644 --- a/kernel/locking/spinlock.c +++ b/kernel/locking/spinlock.c @@ -19,6 +19,7 @@ #include #include #include +#include #include #include @@ -128,6 +129,7 @@ int __lockfunc _raw_spin_trylock(raw_spinlock_t *lock) return __raw_spin_trylock(lock); } EXPORT_SYMBOL(_raw_spin_trylock); +NOKPROBE_SYMBOL(_raw_spin_trylock); #endif #ifndef CONFIG_INLINE_SPIN_TRYLOCK_BH @@ -136,6 +138,7 @@ int __lockfunc _raw_spin_trylock_bh(raw_spinlock_t *lock) return __raw_spin_trylock_bh(lock); } EXPORT_SYMBOL(_raw_spin_trylock_bh); +NOKPROBE_SYMBOL(_raw_spin_trylock_bh); #endif #ifndef CONFIG_INLINE_SPIN_LOCK @@ -144,6 +147,7 @@ void __lockfunc _raw_spin_lock(raw_spinlock_t *lock) __raw_spin_lock(lock); } EXPORT_SYMBOL(_raw_spin_lock); +NOKPROBE_SYMBOL(_raw_spin_lock); #endif #ifndef CONFIG_INLINE_SPIN_LOCK_IRQSAVE @@ -152,6 +156,7 @@ unsigned long __lockfunc _raw_spin_lock_irqsave(raw_spinlock_t *lock) return __raw_spin_lock_irqsave(lock); } EXPORT_SYMBOL(_raw_spin_lock_irqsave); +NOKPROBE_SYMBOL(_raw_spin_lock_irqsave); #endif #ifndef CONFIG_INLINE_SPIN_LOCK_IRQ @@ -160,6 +165,7 @@ void __lockfunc _raw_spin_lock_irq(raw_spinlock_t *lock) __raw_spin_lock_irq(lock); } EXPORT_SYMBOL(_raw_spin_lock_irq); +NOKPROBE_SYMBOL(_raw_spin_lock_irq); #endif #ifndef CONFIG_INLINE_SPIN_LOCK_BH @@ -168,6 +174,7 @@ void __lockfunc _raw_spin_lock_bh(raw_spinlock_t *lock) __raw_spin_lock_bh(lock); } EXPORT_SYMBOL(_raw_spin_lock_bh); +NOKPROBE_SYMBOL(_raw_spin_lock_bh); #endif #ifdef CONFIG_UNINLINE_SPIN_UNLOCK @@ -176,6 +183,7 @@ void __lockfunc _raw_spin_unlock(raw_spinlock_t *lock) __raw_spin_unlock(lock); } EXPORT_SYMBOL(_raw_spin_unlock); +NOKPROBE_SYMBOL(_raw_spin_unlock); #endif #ifndef CONFIG_INLINE_SPIN_UNLOCK_IRQRESTORE @@ -184,6 +192,7 @@ void __lockfunc _raw_spin_unlock_irqrestore(raw_spinlock_t *lock, unsigned long __raw_spin_unlock_irqrestore(lock, flags); } EXPORT_SYMBOL(_raw_spin_unlock_irqrestore); +NOKPROBE_SYMBOL(_raw_spin_unlock_irqrestore); #endif #ifndef CONFIG_INLINE_SPIN_UNLOCK_IRQ @@ -192,6 +201,7 @@ void __lockfunc _raw_spin_unlock_irq(raw_spinlock_t *lock) __raw_spin_unlock_irq(lock); } EXPORT_SYMBOL(_raw_spin_unlock_irq); +NOKPROBE_SYMBOL(_raw_spin_unlock_irq); #endif #ifndef CONFIG_INLINE_SPIN_UNLOCK_BH @@ -200,6 +210,7 @@ void __lockfunc _raw_spin_unlock_bh(raw_spinlock_t *lock) __raw_spin_unlock_bh(lock); } EXPORT_SYMBOL(_raw_spin_unlock_bh); +NOKPROBE_SYMBOL(_raw_spin_unlock_bh); #endif #ifndef CONFIG_INLINE_READ_TRYLOCK Signed-off-by: Andrea Righi