From patchwork Fri Apr 14 14:47:56 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: tip-bot2 for Thomas Gleixner X-Patchwork-Id: 83467 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:6358:3046:b0:115:7a1d:dabb with SMTP id p6csp379354rwl; Fri, 14 Apr 2023 07:57:35 -0700 (PDT) X-Google-Smtp-Source: AKy350Zx3QrKOCIlXwHJjibycAZTmbfo7mrUM0+64y8Dc2MA+4AaC5F9BI4jzwNYqofd/Mt6HLcx X-Received: by 2002:a05:6a20:7aa5:b0:d9:2028:dfd4 with SMTP id u37-20020a056a207aa500b000d92028dfd4mr5844990pzh.19.1681484255247; Fri, 14 Apr 2023 07:57:35 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1681484255; cv=none; d=google.com; s=arc-20160816; b=E9NhuytjEZczRDxf5z6Pz9EyUAaouWNwUA02JUtMNu5SO6NW3elMUt8+FhWP0ILX5Q IrpqKq/k28mFbnTe6dlPdFpsK3EnGcnX4oa3m6U5vpHr1W3Eb25rDrrGk9Yxd9AHmkNC ymcJWKOk3NlY+CQ7NvOcNETLEcJ+rNm7zwIV27ZV81hpNv4LHg7//xcxXg/PLkPtFztk 7PBHLAJh9oG/TbkEVI3cnWu9iBFz26yJO25sFtFg9f8tIcc6T5W8q4jjJG0wpFwfRiLY pd86YtGvvnhEYnjvZlnLNlBTQZIoIh3GmqutRBIyDEUTo+UIdbWdU6fLajc9JHKvt3ZQ ZTwA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:robot-unsubscribe :robot-id:message-id:mime-version:references:in-reply-to:cc:subject :to:reply-to:sender:from:dkim-signature:dkim-signature:date; bh=2brZAFpo52iG6Oe/F9g2rqrK5dNYf8LiVl1mjLMwZhc=; b=QI17Pw9PxIhipbCkrtbUdM1Nz0qkLT//6Lb5ZVyBFBhr//oTR6vgOVYllq8ZD3+SIT 650zkZcXYh0PK7nppShvwzp2or3z/xAu1zjbSDCKqLo+SJVrp38dORdvnmfTHS26nmCH vpbIRi+x2lIuF5eCUjgqasLiKVwmvhE3x09G4TwY047RWfPcXEWKNunKtkx3EnmVzWG1 2uvpsokllfPBI9iswU/kJqF9cE9487+LGxlePgcQsTn0IjBFzZnPudlVjHO3kCZ59syy mti2T2ghquNBfSOr1821GUf/Qw2qVdvNJxze+ihxN6EjxSOSbbPzDGXNd/CwFoU6rpbn YAIQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linutronix.de header.s=2020 header.b=tMr2l7m8; dkim=neutral (no key) header.i=@linutronix.de; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=linutronix.de Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id q6-20020a63f946000000b0051b856ffbbbsi1477pgk.294.2023.04.14.07.57.23; Fri, 14 Apr 2023 07:57:35 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linutronix.de header.s=2020 header.b=tMr2l7m8; dkim=neutral (no key) header.i=@linutronix.de; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=linutronix.de Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230255AbjDNOsW (ORCPT + 99 others); Fri, 14 Apr 2023 10:48:22 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42318 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230512AbjDNOsC (ORCPT ); Fri, 14 Apr 2023 10:48:02 -0400 Received: from galois.linutronix.de (Galois.linutronix.de [IPv6:2a0a:51c0:0:12e:550::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8C3ACB76D; Fri, 14 Apr 2023 07:48:00 -0700 (PDT) Date: Fri, 14 Apr 2023 14:47:56 -0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020; t=1681483677; h=from:from:sender:sender:reply-to:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=2brZAFpo52iG6Oe/F9g2rqrK5dNYf8LiVl1mjLMwZhc=; b=tMr2l7m8cePaq8aDYJrS9FhpoJZf2Kxm8LGe1WbXS29jt5vguvqbUDCi4sx4WbmR+u3sXn /yBlZqUjsvcTSiF4pqo8rofuEu/nhpzaKd8aw+Dt/2PL2MJreKj+0PDcW52SeGTblrs90x v7StzyUvYeI+VfqTQIjKdcrKQr607eko+YQ8cMZRnsal1ugc+RW5z0aZghkcZg7Pi+loWV VBllWVwo6Ozft5YCwiYx7LcwH88fLivpNjtEBJV9rAybgiBgJOF7oi3jO0kqphSbjWp8HD +Yy4XFIwZAlDuLDC5cPjBpv8UF7trBXJhQPydBXGndZPeo8ar11kLJRysQtxgA== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1681483677; h=from:from:sender:sender:reply-to:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=2brZAFpo52iG6Oe/F9g2rqrK5dNYf8LiVl1mjLMwZhc=; b=V9IzN1G4/DXVVaH0p/oB/fVnG8LdeNCzbtZW2d3edze3PYeYjSP5qQCGDfDbVn/U/iW3B4 mxmqLpgMA1SxdgDg== From: "tip-bot2 for Josh Poimboeuf" Sender: tip-bot2@linutronix.de Reply-to: linux-kernel@vger.kernel.org To: linux-tip-commits@vger.kernel.org Subject: [tip: objtool/core] lkdtm/stackleak: Fix noinstr violation Cc: Josh Poimboeuf , "Peter Zijlstra (Intel)" , x86@kernel.org, linux-kernel@vger.kernel.org In-Reply-To: References: MIME-Version: 1.0 Message-ID: <168148367693.404.11671377096764603064.tip-bot2@tip-bot2> Robot-ID: Robot-Unsubscribe: Contact to get blacklisted from these emails X-Spam-Status: No, score=-4.4 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_MED,SPF_HELO_NONE, SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1762993989490696456?= X-GMAIL-MSGID: =?utf-8?q?1763164034303365201?= The following commit has been merged into the objtool/core branch of tip: Commit-ID: f571da059f86fd9d432aea32c9c7e5aaa53245d8 Gitweb: https://git.kernel.org/tip/f571da059f86fd9d432aea32c9c7e5aaa53245d8 Author: Josh Poimboeuf AuthorDate: Wed, 12 Apr 2023 10:24:08 -07:00 Committer: Peter Zijlstra CommitterDate: Fri, 14 Apr 2023 16:08:26 +02:00 lkdtm/stackleak: Fix noinstr violation Fixes the following warning: vmlinux.o: warning: objtool: check_stackleak_irqoff+0x2b6: call to _printk() leaves .noinstr.text section Signed-off-by: Josh Poimboeuf Signed-off-by: Peter Zijlstra (Intel) Link: https://lore.kernel.org/r/ee5209f53aa0a62aea58be18f2b78b17606779a6.1681320026.git.jpoimboe@kernel.org --- drivers/misc/lkdtm/stackleak.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/drivers/misc/lkdtm/stackleak.c b/drivers/misc/lkdtm/stackleak.c index 025b133..f1d0221 100644 --- a/drivers/misc/lkdtm/stackleak.c +++ b/drivers/misc/lkdtm/stackleak.c @@ -43,12 +43,14 @@ static void noinstr check_stackleak_irqoff(void) * STACK_END_MAGIC, and in either casee something is seriously wrong. */ if (current_sp < task_stack_low || current_sp >= task_stack_high) { + instrumentation_begin(); pr_err("FAIL: current_stack_pointer (0x%lx) outside of task stack bounds [0x%lx..0x%lx]\n", current_sp, task_stack_low, task_stack_high - 1); test_failed = true; goto out; } if (lowest_sp < task_stack_low || lowest_sp >= task_stack_high) { + instrumentation_begin(); pr_err("FAIL: current->lowest_stack (0x%lx) outside of task stack bounds [0x%lx..0x%lx]\n", lowest_sp, task_stack_low, task_stack_high - 1); test_failed = true; @@ -86,11 +88,14 @@ static void noinstr check_stackleak_irqoff(void) if (*(unsigned long *)poison_low == STACKLEAK_POISON) continue; + instrumentation_begin(); pr_err("FAIL: non-poison value %lu bytes below poison boundary: 0x%lx\n", poison_high - poison_low, *(unsigned long *)poison_low); test_failed = true; + goto out; } + instrumentation_begin(); pr_info("stackleak stack usage:\n" " high offset: %lu bytes\n" " current: %lu bytes\n" @@ -113,6 +118,7 @@ out: } else { pr_info("OK: the rest of the thread stack is properly erased\n"); } + instrumentation_end(); } static void lkdtm_STACKLEAK_ERASING(void)