From patchwork Mon Nov 12 21:08:48 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alexander Popov X-Patchwork-Id: 10679285 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 5264A13B5 for ; Mon, 12 Nov 2018 21:09:15 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 43F072A600 for ; Mon, 12 Nov 2018 21:09:15 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 371D72A609; Mon, 12 Nov 2018 21:09:15 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-5.2 required=2.0 tests=BAYES_00,MAILING_LIST_MULTI, RCVD_IN_DNSWL_MED autolearn=ham version=3.3.1 Received: from mother.openwall.net (mother.openwall.net [195.42.179.200]) by mail.wl.linuxfoundation.org (Postfix) with SMTP id ADCE92A600 for ; Mon, 12 Nov 2018 21:09:13 +0000 (UTC) Received: (qmail 24503 invoked by uid 550); 12 Nov 2018 21:09:12 -0000 Mailing-List: contact kernel-hardening-help@lists.openwall.com; run by ezmlm Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-ID: Delivered-To: mailing list kernel-hardening@lists.openwall.com Received: (qmail 24467 invoked from network); 12 Nov 2018 21:09:11 -0000 X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:subject:date:message-id; bh=qxuszTR3LwvrqFPDYOyXJJpAmPdQXyw0C/VLoea8Ewg=; b=GdRjGABThQwqFLhQ/nsgfokym4dBFa4vMqcfQu2bNTTOApI0BdJpRPVx4Gg8KbzLd4 x2AqGB6YvCSGSSbraIVS/OBKmgj/m2aF8eB0mDkIn2/XIlFo2Norm5mcrjaz2fXZnlCb 74SuwCIIlGihmb4vsaYMdSJyJvTvGRWMNbJ0jivQ7xUrzY4bIWSp0ZmRRpDfrZMM2Yzt vuE2awcQTFhwouD+hiWhgd4rxgU4U9DmjQ74M2ly+OaCWJdZEPTFKGTkiN0U8+BgS17m fPP6dbxo8JwKmvlxdErDbd88liZ94AJ2q02xTZ9zElGgzjaXnqwBBJ+FQy28PZW3BoRP nqAw== X-Gm-Message-State: AGRZ1gJS4u7zhv7H0XFj0dLqKWy7ekXW/ReE+XdVzTZllUgNTLoMPN34 tV1ZPyS0M2nfGBq/ClRbKPCzod7G X-Google-Smtp-Source: AJdET5dzs8V/msDo7Ok268KZsTytGhGWhudK9yGUZ/CqqcNfWpiNZdRYgSHiByDOiwevFm1DZyGSjA== X-Received: by 2002:a2e:197:: with SMTP id f23-v6mr1664189lji.144.1542056939843; Mon, 12 Nov 2018 13:08:59 -0800 (PST) From: Alexander Popov To: kernel-hardening@lists.openwall.com, Kees Cook , Jann Horn , Ingo Molnar , Andy Lutomirski , Joerg Roedel , Borislav Petkov , Thomas Gleixner , Dave Hansen , Steven Rostedt , Peter Zijlstra , Jan Kara , Mathieu Desnoyers , Dan Williams , Masahiro Yamada , Masami Hiramatsu , x86@kernel.org, alex.popov@linux.com, linux-kernel@vger.kernel.org Subject: [PATCH 1/1] stackleak: Disable function tracing and kprobes for stackleak_erase() Date: Tue, 13 Nov 2018 00:08:48 +0300 Message-Id: <1542056928-10917-1-git-send-email-alex.popov@linux.com> X-Mailer: git-send-email 2.7.4 X-Virus-Scanned: ClamAV using ClamSMTP The stackleak_erase() function is called on the trampoline stack at the end of syscall. This stack is not big enough for ftrace and kprobes operations, e.g. it can be exhausted if we use kprobe_events for stackleak_erase(). So let's disable function tracing and kprobes for stackleak_erase(). Reported-by: kernel test robot Signed-off-by: Alexander Popov Reviewed-by: Steven Rostedt (VMware) Reviewed-by: Masami Hiramatsu --- kernel/stackleak.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/kernel/stackleak.c b/kernel/stackleak.c index e428929..08cb57e 100644 --- a/kernel/stackleak.c +++ b/kernel/stackleak.c @@ -11,6 +11,7 @@ */ #include +#include #ifdef CONFIG_STACKLEAK_RUNTIME_DISABLE #include @@ -47,7 +48,7 @@ int stack_erasing_sysctl(struct ctl_table *table, int write, #define skip_erasing() false #endif /* CONFIG_STACKLEAK_RUNTIME_DISABLE */ -asmlinkage void stackleak_erase(void) +asmlinkage void notrace stackleak_erase(void) { /* It would be nice not to have 'kstack_ptr' and 'boundary' on stack */ unsigned long kstack_ptr = current->lowest_stack; @@ -101,6 +102,7 @@ asmlinkage void stackleak_erase(void) /* Reset the 'lowest_stack' value for the next syscall */ current->lowest_stack = current_top_of_stack() - THREAD_SIZE/64; } +NOKPROBE_SYMBOL(stackleak_erase); void __used stackleak_track_stack(void) {