Skip to contentSkip to conversation

latent_entropy: provide userspace visibility

PATCH New Kees Cook 1 participant 1 message Jun 18, 2016 Driver core

lore
Share & tools
lore

Kees Cook

author
#0 lore raw

PATCH 1/1 latent_entropy: provide userspace visibility

This is just a toy to look at the latent_entropy value as it changes from userspace. Not intended for actual use...

---
 kernel/ksysfs.c | 12 ++++++++++++
 1 file changed, 12 insertions(+)
kernel/ksysfs.c +12 -0
index 152da4a48867..64aed735098a 100644
@@ -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
 };
 
Signature · 6 lines
2.7.4


-- 
Kees Cook
Chrome OS & Brillo Security