Received: by 2002:a05:6a10:9e8c:0:0:0:0 with SMTP id y12csp501012pxx; Thu, 29 Oct 2020 07:39:46 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzGXzn4s/lvSr4vwC1E/oWHo/8sxHn/Yzj8TGyd0FkEiaRZe1WV2Oi6uHEbKjSJgBDT3bJ2 X-Received: by 2002:a17:907:70cb:: with SMTP id yk11mr4413727ejb.122.1603982386092; Thu, 29 Oct 2020 07:39:46 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1603982386; cv=none; d=google.com; s=arc-20160816; b=bNJMuNmmIyDj0DnFbVCbk7Rm+17FQbS1P/+z+FqwmzP8zjzbQFVRmQV3gHqBG3IOjt 9ecoKgbVcRUYlw7LJgk+C8E+AGd/rfCCop7iyMK5wXer9w38CgUieqMp9gn5smiF83AI Ml5lkstlMhr5UXalGRDZEnhJmzrYiA/VkMu0DOK6MpxhuJgIboF+IDSsF+rcAH3tj87v 9OVfqwyjwDJN4QRHs1HM96cRcK07TbOQO+xH39RhLkr7H55RNoDOmCSigmwcOm6UxISv gVbWX17US6DtpcFWJutIF6vMm0V4tgbsjyjDOPy62QxPQS1DzUZTiJKgvzSD1ji2quwW qXVA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:subject:cc:to:from:date; bh=QpLaI5V/nalMsLJZUI5vn0TNeD0kilZqv5rbVfdIw44=; b=n+Cm93Ke0dXfvJ8kK3KD3mfLCVy3yeivLndaa1cIlvj+0mGgZFcBnTTfh2GUYhg2ZX EADGeeNSAcx3HJFXA+GcOAWl/eWkhLXY1bcjuVpMkATzveX1yVKMNwPYX6lPK4qqvV/P UiHQIkaJHmz97AG9pzw0h/e75iQAOhki6wDfSIPJCCo+s9EYxMnWMBMAM2Uzy90bFGMx xir9Jj2lkr6R/01uv7c7g9G3K7d0r0BOmY1MJS83sufLUEUa61xH0DtOSoewPBRONMjG rZZmjfNQrpDe69DkLzKYwWzoofZgVluZcAQFuSaKV1rINl2/QCEz+ql+O7KduU8Y+0gt HRYw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id v19si1935455ejf.257.2020.10.29.07.39.21; Thu, 29 Oct 2020 07:39:46 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727434AbgJ2Ohs (ORCPT + 99 others); Thu, 29 Oct 2020 10:37:48 -0400 Received: from mail.kernel.org ([198.145.29.99]:54402 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726676AbgJ2Ohr (ORCPT ); Thu, 29 Oct 2020 10:37:47 -0400 Received: from gandalf.local.home (cpe-66-24-58-225.stny.res.rr.com [66.24.58.225]) (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 3FEE7204EF; Thu, 29 Oct 2020 14:37:46 +0000 (UTC) Date: Thu, 29 Oct 2020 10:37:44 -0400 From: Steven Rostedt To: Miroslav Benes Cc: linux-kernel@vger.kernel.org, Masami Hiramatsu , Andrew Morton , Josh Poimboeuf , Jiri Kosina , Petr Mladek , Joe Lawrence , live-patching@vger.kernel.org Subject: Re: [PATCH 6/9] livepatch/ftrace: Add recursion protection to the ftrace callback Message-ID: <20201029103744.0f7f52dc@gandalf.local.home> In-Reply-To: References: <20201028115244.995788961@goodmis.org> <20201028115613.291169246@goodmis.org> X-Mailer: Claws Mail 3.17.3 (GTK+ 2.24.32; x86_64-pc-linux-gnu) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, 29 Oct 2020 14:51:06 +0100 (CET) Miroslav Benes wrote: > > index b552cf2d85f8..6c0164d24bbd 100644 > > --- a/kernel/livepatch/patch.c > > +++ b/kernel/livepatch/patch.c > > @@ -45,9 +45,13 @@ static void notrace klp_ftrace_handler(unsigned long ip, > > struct klp_ops *ops; > > struct klp_func *func; > > int patch_state; > > + int bit; > > > > ops = container_of(fops, struct klp_ops, fops); > > > > + bit = ftrace_test_recursion_trylock(); > > + if (bit < 0) > > + return; > > This means that the original function will be called in case of recursion. > That's probably fair, but I'm wondering if we should at least WARN about > it. It's probably what happens today. But if you add a WARN_ON_ONCE() it may not hurt. I also plan on adding code that reports when recursion has happened, because even if it's not a problem, recursion adds extra overhead. -- Steve