Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp3591633imu; Sun, 11 Nov 2018 18:52:57 -0800 (PST) X-Google-Smtp-Source: AJdET5cZYMgPUAb46kyV2eSr4PgICPOLyuivy73n/GM6sel9u9dOmAR5gy3Gtev/xUyGpZ+XxDpT X-Received: by 2002:a62:704a:: with SMTP id l71-v6mr18330173pfc.68.1541991177918; Sun, 11 Nov 2018 18:52:57 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1541991177; cv=none; d=google.com; s=arc-20160816; b=J4M4BlzFAywKslqILvlj9UseeZjOPhYgrIIN44QhoCi1gKFXzFQqC3TTN5dguoOj+w 3z5F+IevgFyy5Mb6bO9H4+59wt/uGJNJfyGH1pYQGdbs+mUsJGPq9OBUC6vhwzDH8KWr rH7jjc0TecXopjd7hzZPF/xWc1yiLpSejuX0ivjycS45OY1tn1MXnPJrxBvi6KyxMPua ZLUCe5VewopHpMgeZesOjdnmhadmz9ueYHjKQ5WJFD5POAWu04k3S1MQdpvRzBX5WRZ0 0Sqq4yInUuseNLXuqXXNK8dDVsg85+e2XohbifquGqRcpNNx6cWvRfPaqcfsbrP1/2kW 9pGw== 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 :dkim-signature; bh=cdsWmIuvbwluBhipkHlCH2y6VZK8EVupkJ3ZpHm0Y48=; b=hCfOwnnG/8oR2jgKaoIpWatitADi5h7M611wsbD/UwLDInJQLElcHPlO2Ux+ey6xFi zNATYku5OhSGCSQr228UZ2gDJLcvNR5PeEVVi/n971eQR3gaQ91ec+oT0lexsnkHO+sW IWaPm7YiWvEWMDaRoMmE95/W+vkJfEfcC5IRc2lqvAxFAaI07WD/4pIzZWOC5nD6rIjF rLFEDaAESsFRzjjgEdVg4qVjg+ILegTuMWnHQEnx2OL6EpgDQW1pzInxbUIOyUPjH19v ZU39mOQI4D/1Fi1Td3UNetoGEVKl7grmPSdvACOLZcQdy6tYErtfftntryZ/EjucRkes tuPA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=2L9sN0Kq; 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=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id r18si14486669pgb.491.2018.11.11.18.52.41; Sun, 11 Nov 2018 18:52:57 -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=@kernel.org header.s=default header.b=2L9sN0Kq; 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=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730345AbeKLMmG (ORCPT + 99 others); Mon, 12 Nov 2018 07:42:06 -0500 Received: from mail.kernel.org ([198.145.29.99]:49610 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730260AbeKLMmG (ORCPT ); Mon, 12 Nov 2018 07:42:06 -0500 Received: from devnote (NE2965lan1.rev.em-net.ne.jp [210.141.244.193]) (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 BE68120881; Mon, 12 Nov 2018 02:51:00 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1541991063; bh=8ZP9A9bYAHBJPDaWSaqzCqZIJ2bVA0w1izDTg1cOkdI=; h=Date:From:To:Cc:Subject:In-Reply-To:References:From; b=2L9sN0KqZH0YkM8jeYL/bs7dkmk0oNI7sNfszQxPMeo6cx42mTXkBHgrrF84VqCxB cdJyAjEXzEC+UB3PnIY20lz14qicPy63rEEjv1lNvKIoEcoNfDGR95Pf/rkS8Pq5Tr nOyP4FwXxng5mkEMgPNvw6h460Ridm1eCt6CNiPM= Date: Mon, 12 Nov 2018 11:50:58 +0900 From: Masami Hiramatsu To: Steven Rostedt Cc: Alexander Popov , kernel-hardening@lists.openwall.com, Kees Cook , Jann Horn , Ingo Molnar , Andy Lutomirski , Joerg Roedel , Borislav Petkov , Thomas Gleixner , Dave Hansen , Peter Zijlstra , Jan Kara , Mathieu Desnoyers , Dan Williams , Masahiro Yamada , Masami Hiramatsu , x86@kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH 1/1] stackleak: Disable ftrace for stackleak.c Message-Id: <20181112115058.39e98750750c91eeb349cfdf@kernel.org> In-Reply-To: <20181111205351.1874bb1e@vmware.local.home> References: <1541887530-16610-1-git-send-email-alex.popov@linux.com> <20181110183011.2290fc20@gandalf.local.home> <20181111205351.1874bb1e@vmware.local.home> X-Mailer: Sylpheed 3.5.0 (GTK+ 2.24.30; 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 Hi Alexander and Steve, On Sun, 11 Nov 2018 20:53:51 -0500 Steven Rostedt wrote: > On Sun, 11 Nov 2018 13:19:45 +0300 > Alexander Popov wrote: > > > On 11.11.2018 2:30, Steven Rostedt wrote: > > > On Sun, 11 Nov 2018 01:05:30 +0300 > > > Alexander Popov wrote: > > > > > >> The stackleak_erase() function is called on the trampoline stack at the > > >> end of syscall. This stack is not big enough for ftrace operations, > > >> e.g. it can be overflowed if we enable kprobe_events for stackleak_erase(). > > > > > > Is the issue with kprobes or with function tracing? Because this stops > > > function tracing which I only want disabled if function tracing itself > > > is an issue, not for other things that may use the function tracing > > > infrastructure. > > > > Hello Steven, > > > > I believe that stackleak erasing is not compatible with function tracing itself. > > That's what the kernel testing robot has hit: > > https://www.openwall.com/lists/kernel-hardening/2018/11/09/1 > > > > I used kprobe_events just to reproduce the problem: > > https://www.openwall.com/lists/kernel-hardening/2018/11/09/4 > > Have you tried adding a "notrace" to stackleak_erase()? > > Not tracing the entire file is a bit of overkill. There's no reason > ftrace can't trace stack_erasing_sysctl() or perhaps even > stackleak_track_stack() as that may be very interesting to trace. I think it is not enough for stopping kprobes. If you want to stop the kprobes (int3 version) on stackleak_erase(), you should use NOKPROBE_SYMBOL(stackleak_erase), since kprobes can work without ftrace. Thank you, -- Masami Hiramatsu