Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp4565030imu; Mon, 12 Nov 2018 13:09:38 -0800 (PST) X-Google-Smtp-Source: AJdET5fWCAAQla6xxcP+STjj7B5y/MNAqeXDU33KHX6B+7/iCo2Rmy6y5x2iF+x0+tyv9hMICFcu X-Received: by 2002:a63:1b48:: with SMTP id b8mr2224634pgm.187.1542056978909; Mon, 12 Nov 2018 13:09:38 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1542056978; cv=none; d=google.com; s=arc-20160816; b=T038Q0hep9M7MbtljFNs5XCINACi89kH7/GzFNsIGBHZNFraZqw/7Oe2p3as7plKQK OecaWf5ZJAgV3Abo5Lby+SD6VhN/6N/Njsz6C1GmLS92p65mK8QYWKTL13T+pwAruyf6 eZ37XpeXJItb+hcJ2IYDtWpHWV6dD+Ua9NbsxOZ9ijqQnAzhr3novz1JPvmvJToqmbGa 7PTZ9txfySeBA4sW6WN8uERXkdAgsTL2Iw14+gEaWzBvJ9ygKI+joKaczHdauQABfqhW q9yETtMc1+oyYzJYWs4GEmkviSHidt5f83jF6GAg0k5upn9WN20WV9Js/YRYQQd8QX+Y Gqzg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:message-id:date:subject:to:from; bh=qxuszTR3LwvrqFPDYOyXJJpAmPdQXyw0C/VLoea8Ewg=; b=LOHOpmV+W1FYMjfd5OfID90lSfALXcRjThyAUQ7yhVkv/9xTa9HW5C/1LAsa3vWFlA FZEE2xZpA/Xn/7+qGyIaOAblUxiXH10/gJh0+mVmAedDN6pRRrG9Y442/fcMrZPIk8Kh /i7pJRBMf6QMqwaPfwOiKhoyWsHUE+KG6or5B2hXU0e6rE54JJT6D+GqIW2LSePu5QRf nQSTc7ADell4+r9Kj8Zr73SxBPYjrRUzf9nXN1l3fsMKIb8JONl5MSWxJ28P291G50qp WIVKgA6Ue3kXJuUWTz3lDNdlSdGhRXFBiqGglo77zF+jt3No81fRrkcUp0X9Q5ko9Zvd vu1g== ARC-Authentication-Results: i=1; mx.google.com; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id q16-v6si16562576pgb.266.2018.11.12.13.09.22; Mon, 12 Nov 2018 13:09:38 -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; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730391AbeKMHD7 (ORCPT + 99 others); Tue, 13 Nov 2018 02:03:59 -0500 Received: from mail-lj1-f193.google.com ([209.85.208.193]:39106 "EHLO mail-lj1-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725817AbeKMHD7 (ORCPT ); Tue, 13 Nov 2018 02:03:59 -0500 Received: by mail-lj1-f193.google.com with SMTP id t9-v6so8888480ljh.6 for ; Mon, 12 Nov 2018 13:09:00 -0800 (PST) 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=lvrnmgyMaDAGVoFrOjrzuPcJU0h0W9nADgR5Mlm7+Bqx3zrYSx71qPQXKwJ+xKE/q0 8pKn7CqCDNABGaPEn/2hmA17TGZApmlefFItZFQC3VYeSMQVFIq9qqwjiCyfp2EexOpU 3AVi3+7TNUV7Zl0eQl8DIleU0a7Bris7Y5H+lejCEnqQCw0Y5JMHR9F601nA7uVfsxe+ s2zxKHTsuSDbsg837lp639sx1uJUpPA4pFlS+ko4ZKA/824ZXIWs1tMvm/DdhANGY9ay TelImA+tPT6tVdj4wSmmGJyRasus16sSe8NlVqj7ZBnQADx9FRE9QfXv+sL9A0sFRVht ocHA== X-Gm-Message-State: AGRZ1gI9Ys4BrEGpkJPKrfgMVvMpY2WperCwzIJJf+75ODIW8GUWGjyq Huk1KSdalvXnoT7ywmVreqg= X-Received: by 2002:a2e:197:: with SMTP id f23-v6mr1664189lji.144.1542056939843; Mon, 12 Nov 2018 13:08:59 -0800 (PST) Received: from hobbit.lan (128-68-186-150.broadband.corbina.ru. [128.68.186.150]) by smtp.gmail.com with ESMTPSA id t81sm3230292lfe.84.2018.11.12.13.08.58 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); 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 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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 --- 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) { -- 2.7.4