DPDK patches and discussions
 help / color / mirror / Atom feed
From: Robin Jarry <robin.jarry@6wind.com>
To: sergio.gonzalez.monroy@intel.com
Cc: dev@dpdk.org
Subject: [dpdk-dev] [PATCH] eal/linux: use more restrictive perms in hugedir
Date: Wed, 10 Aug 2016 16:52:54 +0200	[thread overview]
Message-ID: <1470840774-14793-1-git-send-email-robin.jarry@6wind.com> (raw)

There is no need for the page files to be readable (and executable) by
other users. This can be exploited by non-privileged users to access the
working memory of a DPDK app.

Open the files with 0600.

Signed-off-by: Robin Jarry <robin.jarry@6wind.com>
---
 lib/librte_eal/linuxapp/eal/eal_memory.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/lib/librte_eal/linuxapp/eal/eal_memory.c b/lib/librte_eal/linuxapp/eal/eal_memory.c
index 41e0a9288765..3eb72657085c 100644
--- a/lib/librte_eal/linuxapp/eal/eal_memory.c
+++ b/lib/librte_eal/linuxapp/eal/eal_memory.c
@@ -442,7 +442,7 @@ map_all_hugepages(struct hugepage_file *hugepg_tbl,
 #endif
 
 		/* try to create hugepage file */
-		fd = open(hugepg_tbl[i].filepath, O_CREAT | O_RDWR, 0755);
+		fd = open(hugepg_tbl[i].filepath, O_CREAT | O_RDWR, 0600);
 		if (fd < 0) {
 			RTE_LOG(DEBUG, EAL, "%s(): open failed: %s\n", __func__,
 					strerror(errno));
@@ -581,7 +581,7 @@ remap_all_hugepages(struct hugepage_file *hugepg_tbl, struct hugepage_info *hpi)
 				hugepg_tbl[page_idx].file_id);
 
 		/* try to create hugepage file */
-		fd = open(filepath, O_CREAT | O_RDWR, 0755);
+		fd = open(filepath, O_CREAT | O_RDWR, 0600);
 		if (fd < 0) {
 			RTE_LOG(ERR, EAL, "%s(): open failed: %s\n", __func__, strerror(errno));
 			return -1;
-- 
2.1.4

             reply	other threads:[~2016-08-10 14:53 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-08-10 14:52 Robin Jarry [this message]
2016-09-16 12:51 ` Thomas Monjalon

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1470840774-14793-1-git-send-email-robin.jarry@6wind.com \
    --to=robin.jarry@6wind.com \
    --cc=dev@dpdk.org \
    --cc=sergio.gonzalez.monroy@intel.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).