Date: Mon, 12 Nov 2018 11:50:58 +0900 From: Masami Hiramatsu 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> Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit 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 List-ID: 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