From patchwork Sat Jun 18 18:03:20 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kees Cook X-Patchwork-Id: 9185773 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id A6AC76075F for ; Sat, 18 Jun 2016 18:03:43 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 9AA9C27DCE for ; Sat, 18 Jun 2016 18:03:43 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 8BCE628365; Sat, 18 Jun 2016 18:03:43 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-4.1 required=2.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_MED,T_DKIM_INVALID autolearn=ham version=3.3.1 Received: from mother.openwall.net (mother.openwall.net [195.42.179.200]) by mail.wl.linuxfoundation.org (Postfix) with SMTP id 850B327DCE for ; Sat, 18 Jun 2016 18:03:42 +0000 (UTC) Received: (qmail 13713 invoked by uid 550); 18 Jun 2016 18:03:41 -0000 Mailing-List: contact kernel-hardening-help@lists.openwall.com; run by ezmlm Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-ID: Reply-To: kernel-hardening@lists.openwall.com Delivered-To: mailing list kernel-hardening@lists.openwall.com Received: (qmail 13500 invoked from network); 18 Jun 2016 18:03:33 -0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=date:from:to:cc:subject:message-id:mime-version:content-disposition; bh=0g3+MppjL46/LV3kHp7jAGRpAfwJnw4NiRT652Kb2Y8=; b=WFETlm9+ltOq7t6Tq7HbyE4R1WmruSbRxm/Mn5kj0BDQBYuluY+2GzWSiKq8RpaM/a Baa0pHmhBwCHhUQqr6HQcESwVJ/pVdv7wb0LDn/J7nn54S69eKh3HAC4/qlAzbRNSSo3 +onrHxcqRI392R2d5F6NNv5hxAkFlfvrO3FWA= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:date:from:to:cc:subject:message-id:mime-version :content-disposition; bh=0g3+MppjL46/LV3kHp7jAGRpAfwJnw4NiRT652Kb2Y8=; b=l1HuvXjn6t5dONT7cB8kpFzFFwxNBU0wOn7WPW+xpTU9whN5fqXD5MwyRPGHWetiqe 29Jths6AbXq9uG2yw8oSR3aY6cTfLpcgrA67uJSZR4DRuhcT4B2g5kWLVrODazrd6Sej xH5+qLbWIMZb7x3yEZ65rBaimAMi9ThgNTqhWfotxv1vg+Qy+WOE5uKS1ohh31+Stx7q JqQykPHoYEnBhtxfavTqT6R1ah8E5ZqgEKFO8wyAUR/ZyuTY1eGGF2RYcdDZyIr/6/+i PuuTrDTEV5+0gqHinzgWr34NZDr1RkN0nvq/2FZLHm9zojyW77glC5YIp9dOc1OxfJkd EqvA== X-Gm-Message-State: ALyK8tJ0n3grqibLJVbUlviNdsS8cBk4vG88QmgY7PL9P9z1Q1JidGsrIJIXFZWDZyGo2S/p X-Received: by 10.66.26.36 with SMTP id i4mr10090651pag.3.1466273001316; Sat, 18 Jun 2016 11:03:21 -0700 (PDT) Date: Sat, 18 Jun 2016 11:03:20 -0700 From: Kees Cook To: kernel-hardening@lists.openwall.com Cc: Emese Revfy Message-ID: <20160618180320.GA862@www.outflux.net> MIME-Version: 1.0 Content-Disposition: inline Subject: [kernel-hardening] [PATCH] latent_entropy: provide userspace visibility X-Virus-Scanned: ClamAV using ClamSMTP This is just a toy to look at the latent_entropy value as it changes from userspace. Not intended for actual use... Signed-off-by: Kees Cook --- kernel/ksysfs.c | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/kernel/ksysfs.c b/kernel/ksysfs.c index 152da4a48867..64aed735098a 100644 --- a/kernel/ksysfs.c +++ b/kernel/ksysfs.c @@ -180,6 +180,15 @@ static ssize_t rcu_normal_store(struct kobject *kobj, KERNEL_ATTR_RW(rcu_normal); #endif /* #ifndef CONFIG_TINY_RCU */ +#ifdef CONFIG_GCC_PLUGIN_LATENT_ENTROPY +static ssize_t latent_entropy_show(struct kobject *kobj, + struct kobj_attribute *attr, char *buf) +{ + return sprintf(buf, "0x%08llx\n", latent_entropy); +} +KERNEL_ATTR_RO(latent_entropy); +#endif + /* * Make /sys/kernel/notes give the raw contents of our kernel .notes section. */ @@ -225,6 +234,9 @@ static struct attribute * kernel_attrs[] = { &rcu_expedited_attr.attr, &rcu_normal_attr.attr, #endif +#ifdef CONFIG_GCC_PLUGIN_LATENT_ENTROPY + &latent_entropy_attr.attr, +#endif NULL };