From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id E619AC433EF for ; Wed, 4 May 2022 19:09:09 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:In-Reply-To:MIME-Version:References: Message-ID:Subject:Cc:To:From:Date:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=5SLL0LA3XK6OU562M6jTU507FrXN2vt0jE2lGS4U4sE=; b=UILn9NW3H0YZwg OdFqezygH/rKJhBDRna44ntZy7f9FioUSqdKyXqq684lZF2Y3RxT9Ig2/Irm/vfZ20Th0bvhd5Ex1 tseWAFEeAH7t89sg33NQW1a1UvUZ/wHJMbew8YUVvnGTr61WTH4CyxAPKG0kthpMBTrWSlco9qd15 t96RhVjMBuWZ76JHX4iI5kvFqZbjb2yLGGyNi9DoR8NQjqRTfPDIdiE7cLpeK1Dt7YRMjcI7me627 jf40bSTwMpDoISfsftakelvWuID6QNPpwUYw/9+Rdvtz/Xh59Vy0ATQGsvjWoVPQF8kAkrTuF09o/ BItQyJwcGJB1NpaoIt8g==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1nmKM1-00CIiO-Te; Wed, 04 May 2022 19:08:06 +0000 Received: from mail-pl1-x633.google.com ([2607:f8b0:4864:20::633]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1nmKLy-00CIh6-AV for linux-arm-kernel@lists.infradead.org; Wed, 04 May 2022 19:08:03 +0000 Received: by mail-pl1-x633.google.com with SMTP id n18so2281300plg.5 for ; Wed, 04 May 2022 12:07:59 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to; bh=1NLrXVkZbGvcjOZGn3V43bG6P23uJxS+WvWDtv6ftUw=; b=V035LlW/suuLYmq2whqz7nWNDcWJ0bWZ7JlvvMg43vQqd9Ijkjh5vRtZWrIg+AElWN 0F76O0rqrVr3vDzwX0i8m+uZV0/A6KpOwBQkcX0Tysyn6WWHFybiVCiFXMXiLZMRKkIX WKxWVRZ1NRBz7JKxIdZtmxXOQE+NM0NOTyWag= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=1NLrXVkZbGvcjOZGn3V43bG6P23uJxS+WvWDtv6ftUw=; b=Fka7BAC4Xirel1HzzX7okEBKLU0Ni6jwVfzSqKAtD6MVWPcNKPqi0DYVAeYdCx05B2 fBceHgINT+d0u296bQD8Br2zdqIuN/7sHcaYMAUNYldF5Nps+rJvg640MXZ8B0r/j1kQ Yn+mjtue7XmrCc4Eeqaz9TnoL9T4uhLoHl3ndm3we0fcUibGMYT6UBsq0a7bTRtiPkSu GGyCv4pCXMvDGMV9p/m6eNSI12p+vmimXtrtehhtn6+wC/wEq1wJfR13YYE009G2i2oX eaPagwJ9fgHsWwhpv7M5vsOUp9oEGZK8VkVWUpeXkqZMLNWluI8wxnjhDB7wdDPhuDXV C0vQ== X-Gm-Message-State: AOAM531JIqQTTIpX+F1LUZn909kFxDMhRphPNdpetUL+V8RBYE3m2UrE cv+gUmVHN6JYLdFhSU3fdgQHRQ== X-Google-Smtp-Source: ABdhPJy9u+QW5lZIpB3ltPiys1+HxI4FHV55hPmgEabatNCHNWjjD5WduiYt7Ke854+7rHOSZNyrXQ== X-Received: by 2002:a17:90a:4413:b0:1cd:2d00:9d0b with SMTP id s19-20020a17090a441300b001cd2d009d0bmr1097083pjg.81.1651691278894; Wed, 04 May 2022 12:07:58 -0700 (PDT) Received: from www.outflux.net (smtp.outflux.net. [198.145.64.163]) by smtp.gmail.com with ESMTPSA id w2-20020a170902e88200b0015e8d4eb224sm8794928plg.110.2022.05.04.12.07.58 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 04 May 2022 12:07:58 -0700 (PDT) Date: Wed, 4 May 2022 12:07:57 -0700 From: Kees Cook To: Mark Rutland Cc: linux-arm-kernel@lists.infradead.org, akpm@linux-foundation.org, alex.popov@linux.com, catalin.marinas@arm.com, linux-kernel@vger.kernel.org, luto@kernel.org, will@kernel.org Subject: Re: [PATCH v2 09/13] lkdtm/stackleak: rework boundary management Message-ID: <202205041205.803FD491@keescook> References: <20220427173128.2603085-1-mark.rutland@arm.com> <20220427173128.2603085-10-mark.rutland@arm.com> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <20220427173128.2603085-10-mark.rutland@arm.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20220504_120802_416144_6A236004 X-CRM114-Status: GOOD ( 17.62 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org On Wed, Apr 27, 2022 at 06:31:24PM +0100, Mark Rutland wrote: > There are a few problems with the way the LKDTM STACKLEAK_ERASING test > manipulates the stack pointer and boundary values: > > * It uses the address of a local variable to determine the current stack > pointer, rather than using current_stack_pointer directly. As the > local variable could be placed anywhere within the stack frame, this > can be an over-estimate of the true stack pointer value. > > * Is uses an estiamte of the current stack pointer as the upper boundary > when scanning for poison, even though prior functions could have used > more stack (and may have updated current->lowest stack accordingly). > > * A pr_info() call is made in the middle of the test. As the printk() > code is out-of-line and will make use of the stack, this could clobber > poison and/or adjust current->lowest_stack. It would be better to log > the metadata after the body of the test to avoid such problems. Yeah, I noticed this too when I was testing the v1 series. I started cleaning it up, but your version is much better. :) -- Kees Cook _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel