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 X-Spam-Level: X-Spam-Status: No, score=-1.1 required=3.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, SPF_PASS,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 9AA66C282C4 for ; Tue, 12 Feb 2019 17:54:55 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 6BFC2222BB for ; Tue, 12 Feb 2019 17:54:55 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=chromium.org header.i=@chromium.org header.b="YXi/S/5k" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729356AbfBLRyy (ORCPT ); Tue, 12 Feb 2019 12:54:54 -0500 Received: from mail-ua1-f66.google.com ([209.85.222.66]:37174 "EHLO mail-ua1-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728445AbfBLRyy (ORCPT ); Tue, 12 Feb 2019 12:54:54 -0500 Received: by mail-ua1-f66.google.com with SMTP id v26so1187845uap.4 for ; Tue, 12 Feb 2019 09:54:53 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=bsXKwkLM/R+hXtwloqz5pZs2yFDYV/aAOBs3Mg0VcqE=; b=YXi/S/5kfTLdxSWAC3y0wCGTa7uM67tEQsikFhpMThsF3Fc43hRI+myllvvpMyORc4 zalCEhLUpcmJDU69dqHBEnudfmhTKEPJI19BZwd1rnqTqZNi4sBT62dYW1rWTaQXVUiK AiWOmDGpgYilpu0vMEamKc5zcK457gNd9aeMs= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=bsXKwkLM/R+hXtwloqz5pZs2yFDYV/aAOBs3Mg0VcqE=; b=puPvJjQKk2cy7tK0XcM1prEz7oX20HXDdBzgKeZULzh7DsaPr7Q3kuMjqx4G2Kh7k/ 5/l4T/3n+EEjKkp4cz8jETIbTe9PHqtq0OgmslFO9oP9pzJtHhG05qcDZUjsW5zd1QGB x8i1a9cwz7XJBczVoYccBkV7wP7MOzuiAXTDYkGbT6a16tKSRyJMi0Yi+uFX4rj0u9hk OComOflUNv609bdfRdC5J+2x7WRs0UYuYd64+9GAg7Rjc6CO4nyaXjRJ4GMc32I7V/We PEAcNxWCN9lZ2aOlVHCzgxsubIsi+SRmUZ92qC28UgC2jqpkyoeflZ0E1wXrfNtW6RY3 7j+Q== X-Gm-Message-State: AHQUAubAFxS5BX7TkoLrKAxr7XHSvod7DdW/6l6vbLSTmv0Z58p12phi 0WAXrM4B7ff2Wfl8G44oLib2xxm533c= X-Google-Smtp-Source: AHgI3IYPdjqs/cqS73JkJReSYBzI0I19fo+GzEVjeCJWvLxXhk5SQ+gjw0JoAPEgQD0hTuXcNNbKkA== X-Received: by 2002:ab0:26d:: with SMTP id 100mr2040947uas.110.1549994092965; Tue, 12 Feb 2019 09:54:52 -0800 (PST) Received: from mail-vs1-f53.google.com (mail-vs1-f53.google.com. [209.85.217.53]) by smtp.gmail.com with ESMTPSA id f1sm311171vso.30.2019.02.12.09.54.50 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 12 Feb 2019 09:54:51 -0800 (PST) Received: by mail-vs1-f53.google.com with SMTP id e16so2143498vsq.6 for ; Tue, 12 Feb 2019 09:54:50 -0800 (PST) X-Received: by 2002:a67:ec81:: with SMTP id h1mr2023032vsp.188.1549994090430; Tue, 12 Feb 2019 09:54:50 -0800 (PST) MIME-Version: 1.0 References: <20190123110349.35882-1-keescook@chromium.org> <874b8c23-068b-f8e7-2168-12947c06e145@linux.com> In-Reply-To: <874b8c23-068b-f8e7-2168-12947c06e145@linux.com> From: Kees Cook Date: Tue, 12 Feb 2019 09:54:38 -0800 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [PATCH 0/3] gcc-plugins: Introduce stackinit plugin To: Alexander Popov Cc: LKML , Ard Biesheuvel , Laura Abbott , xen-devel , Maling list - DRI developers , intel-gfx@lists.freedesktop.org, intel-wired-lan@lists.osuosl.org, Network Development , linux-usb@vger.kernel.org, "linux-fsdevel@vger.kernel.org" , Linux-MM , dev@openvswitch.org, linux-kbuild , linux-security-module , Kernel Hardening , Greg KH , Jann Horn , William Kucharski , Jani Nikula , Edwin Zimmerman , Matthew Wilcox , Jeff Kirsher Content-Type: text/plain; charset="UTF-8" Sender: linux-fsdevel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-fsdevel@vger.kernel.org On Mon, Jan 28, 2019 at 4:12 PM Alexander Popov wrote: > > On 23.01.2019 14:03, Kees Cook wrote: > > This adds a new plugin "stackinit" that attempts to perform unconditional > > initialization of all stack variables > > Hello Kees! Hello everyone! > > I was curious about the performance impact of the initialization of all stack > variables. So I did a very brief test with this plugin on top of 4.20.5. > > hackbench on Intel Core i7-4770 showed ~0.7% slowdown. > hackbench on Kirin 620 (ARM Cortex-A53 Octa-core 1.2GHz) showed ~1.3% slowdown. Thanks for looking at this! I'll be including my hackbench measurements for the v2 here in a moment. > This test involves the kernel scheduler and allocator. I can't say whether they > use stack aggressively. Maybe performance tests of other subsystems (e.g. > network subsystem) can show different numbers. Did you try? I haven't found a stable network test yet. If someone can find a reasonable workload, I'd love to hear about it. > I've heard a hypothesis that the initialization of all stack variables would > pollute CPU caches, which is critical for some types of computations. Maybe some > micro-benchmarks can disprove/confirm that? I kind of think micro-benchmarks aren't so useful because they don't represent a real-world workload. I've heard people talk about SAP-HANA as a good test, but I can't get my hands on it. I wonder if anyone has tried "mysqlslap"? -- Kees Cook