e7a346
From c93ade55ce9794952b372b91aff7bc380b49fd52 Mon Sep 17 00:00:00 2001
e7a346
From: Amar Tumballi <amarts@redhat.com>
e7a346
Date: Sun, 7 Oct 2018 11:45:35 +0530
e7a346
Subject: [PATCH 394/399] io-stats: prevent taking file dump on server side
e7a346
e7a346
By allowing clients taking dump in a file on brick process, we are
e7a346
allowing compromised clients to create io-stats dumps on server,
e7a346
which can exhaust all the available inodes.
e7a346
e7a346
Fixes: CVE-2018-14659
e7a346
e7a346
BUG: 1636305
e7a346
Change-Id: I64fc530363b78f849011eb3c91355566ee0c485b
e7a346
Signed-off-by: Amar Tumballi <amarts@redhat.com>
e7a346
Reviewed-on: https://code.engineering.redhat.com/gerrit/152024
e7a346
Reviewed-by: Sunil Kumar Heggodu Gopala Acharya <sheggodu@redhat.com>
e7a346
---
e7a346
 xlators/debug/io-stats/src/io-stats.c | 9 +++++++++
e7a346
 1 file changed, 9 insertions(+)
e7a346
e7a346
diff --git a/xlators/debug/io-stats/src/io-stats.c b/xlators/debug/io-stats/src/io-stats.c
e7a346
index 16a11df..0f71334 100644
e7a346
--- a/xlators/debug/io-stats/src/io-stats.c
e7a346
+++ b/xlators/debug/io-stats/src/io-stats.c
e7a346
@@ -3022,6 +3022,15 @@ conditional_dump (dict_t *dict, char *key, data_t *value, void *data)
e7a346
         stub  = data;
e7a346
         this  = stub->this;
e7a346
 
e7a346
+        /* Don't do this on 'brick-side', only do this on client side */
e7a346
+        /* Addresses CVE-2018-14659 */
e7a346
+        if (this->ctx->process_mode != GF_CLIENT_PROCESS) {
e7a346
+                gf_log(this->name, GF_LOG_DEBUG,
e7a346
+                       "taking io-stats dump using setxattr not permitted on brick."
e7a346
+                       " Use 'gluster profile' instead");
e7a346
+                return -1;
e7a346
+        }
e7a346
+
e7a346
         /* Create a file name that is appended with the io-stats instance
e7a346
         name as well. This helps when there is more than a single io-stats
e7a346
         instance in the graph, or the client and server processes are running
e7a346
-- 
e7a346
1.8.3.1
e7a346