Thread (32 messages) 32 messages, 4 authors, 2018-03-06

Re: [PATCH 6/7] lkdtm: crash on overwriting protected pmalloc var

From: J Freyensee <hidden>
Date: 2018-03-06 17:08:30
Also in: linux-mm, linux-security-module


On 3/6/18 9:05 AM, J Freyensee wrote:
quoted
  +#ifdef CONFIG_PROTECTABLE_MEMORY
+void lkdtm_WRITE_RO_PMALLOC(void)
+{
+    struct gen_pool *pool;
+    int *i;
+
+    pool = pmalloc_create_pool("pool", 0);
+    if (unlikely(!pool)) {
+        pr_info("Failed preparing pool for pmalloc test.");
+        return;
+    }
+
+    i = (int *)pmalloc(pool, sizeof(int), GFP_KERNEL);
+    if (unlikely(!i)) {
+        pr_info("Failed allocating memory for pmalloc test.");
+        pmalloc_destroy_pool(pool);
+        return;
+    }
+
+    *i = INT_MAX;
+    pmalloc_protect_pool(pool);
+
+    pr_info("attempting bad pmalloc write at %p\n", i);
+    *i = 0;
Opps, disregard this, this is the last series of this patch series, not 
the most recent one :-(.


Seems harmless, but I don't get why *i local variable needs to be set 
to 0 at the end of this function.


Otherwise,

Reviewed-by: Jay Freyensee <redacted>
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help