Received: by 2002:ac0:946b:0:0:0:0:0 with SMTP id j40csp4109746imj; Tue, 12 Feb 2019 09:56:54 -0800 (PST) X-Google-Smtp-Source: AHgI3IZOxKFzAlSb6AwSQZ/C+oSm20PQfnNpip9dY1e8TSTn1A/X2tuxBKQYaNviV2bM5jRBGpr/ X-Received: by 2002:aa7:854a:: with SMTP id y10mr3415523pfn.210.1549994214248; Tue, 12 Feb 2019 09:56:54 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1549994214; cv=none; d=google.com; s=arc-20160816; b=kKTzIWclKD2E72ZJ8zohl2pLmV29GraU0EFEwIXoUILsduD3zheVe7aNQl4mqZ5hqN XpCcgeYEzP5reu5Pe3ZFtDVynl3NHI1mBnrl0NpbqGkqfeLj/1/usFetP1rBxuXBl51b PToTUrkKmZI2hYXVoL/nbDNb9yE3sZFU6sGFQ3WYdp1Epz8Qyn263wJb22zeYTuGKgOm +z+rJfkDkvOAsLr77avGZGjNjZEUwPiOug4Pn0Y523Qp0co8GQD5xCSVCM5U4O8s3g1t w00XHaruWU/TVTGUKivBpd2KgkgYAgPNabNmWx6SITzWIeEY9cog2rfPmY+vPuzQvq8k AzMg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:dkim-signature; bh=bsXKwkLM/R+hXtwloqz5pZs2yFDYV/aAOBs3Mg0VcqE=; b=N34GyN/5xrvuztL9zg2gXbRpuMT9rJkd5IPNCxW2CAwuM3l4BjVvUb6dyfnrsNn7d9 6W14ztFisgRqImHx4yUWDBnZ6K/1bWE5Kof/n81d8RSLafeciVYCMFvMyxDdcwfMQbIr TbmII3gtng1urS7Bz4MpMx8Kja+bRcdpBz+qQ1S1G6x3r4CUEz6Olv4jUeEgCJT5KlmU USANmY69wW0AvRBKsTvC1hTeg8WHKYblSpRILUzbwzbNG3fgn5j9gsMLi69MUTlXlPXM 4Wrw0VVaaDyP1tSgeEaz9C6wrqCQpFIn7t70UoidUmVsTKejTPdR8YkQ4yQzq9obXr13 8PjA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b="YXi/S/5k"; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=chromium.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id z3si13617459pfi.157.2019.02.12.09.56.38; Tue, 12 Feb 2019 09:56:54 -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; dkim=pass header.i=@chromium.org header.s=google header.b="YXi/S/5k"; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=chromium.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729821AbfBLRy4 (ORCPT + 99 others); Tue, 12 Feb 2019 12:54:56 -0500 Received: from mail-vs1-f67.google.com ([209.85.217.67]:37069 "EHLO mail-vs1-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728952AbfBLRyz (ORCPT ); Tue, 12 Feb 2019 12:54:55 -0500 Received: by mail-vs1-f67.google.com with SMTP id s16so2140888vsk.4 for ; Tue, 12 Feb 2019 09:54:54 -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=eEVJ5/zVH6tUUOHdKWQNQq+SXpzXHfcPIaaw+bnkBADAOLqNrW8NGqsn350JWeqzWU T6LRsccL9YpfdUfZV1KhqSmTmcgGecOiVXbW3QnOv2ZQkOKDbUKw6Y7C2qGumlvO3KYZ iRMPNCmXtrKSP4V8OHS3QUq2+cZp70325bgYr5iGyvBKq6x+j34uT2ql/aUHD7WjnVO2 3e0GhrcaV0KBMtUa8S2uwd0y058g2cOhKisbyZn6lVDHDNkg1ffLJYksCIMZg6k1VMZL uD9CavhfuMe4A3JR8gM4mhb4Rcv40htzK07sLObLJMKfdfM7OCg+sioWZItSVsd1sgka bbDA== X-Gm-Message-State: AHQUAubDwXvY/5BRW5ycjxzWwXB5We8Wkao0sZI/FOtsV8HnYRQwkoMx ZADmRsgnbcAIaE0B74Hot3uCLHqmavc= X-Received: by 2002:a67:5c7:: with SMTP id 190mr2073868vsf.15.1549994093173; Tue, 12 Feb 2019 09:54:53 -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 b1sm1609011vkf.9.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 u64so2104711vsc.12 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-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@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