When creating files on disk, e.g. for EAL configuration or shared memory
locks, etc., there is no need to grant any permissions on those files to
other users. All directories are already created with 0700 permissions, so
we should create all files with 0600 permissions.
Cc: stable@dpdk.org
Signed-off-by: Bruce Richardson <bruce.richardson@intel.com>
return;
if (mem_cfg_fd < 0){
return;
if (mem_cfg_fd < 0){
- mem_cfg_fd = open(pathname, O_RDWR | O_CREAT, 0660);
+ mem_cfg_fd = open(pathname, O_RDWR | O_CREAT, 0600);
if (mem_cfg_fd < 0)
rte_panic("Cannot open '%s' for rte_mem_config\n", pathname);
}
if (mem_cfg_fd < 0)
rte_panic("Cannot open '%s' for rte_mem_config\n", pathname);
}
map_shared_memory(const char *filename, const size_t mem_size, int flags)
{
void *retval;
map_shared_memory(const char *filename, const size_t mem_size, int flags)
{
void *retval;
- int fd = open(filename, flags, 0666);
+ int fd = open(filename, flags, 0600);
if (fd < 0)
return NULL;
if (ftruncate(fd, mem_size) < 0) {
if (fd < 0)
return NULL;
if (ftruncate(fd, mem_size) < 0) {
rte_mem_cfg_addr = NULL;
if (mem_cfg_fd < 0){
rte_mem_cfg_addr = NULL;
if (mem_cfg_fd < 0){
- mem_cfg_fd = open(pathname, O_RDWR | O_CREAT, 0660);
+ mem_cfg_fd = open(pathname, O_RDWR | O_CREAT, 0600);
if (mem_cfg_fd < 0)
rte_panic("Cannot open '%s' for rte_mem_config\n", pathname);
}
if (mem_cfg_fd < 0)
rte_panic("Cannot open '%s' for rte_mem_config\n", pathname);
}
map_shared_memory(const char *filename, const size_t mem_size, int flags)
{
void *retval;
map_shared_memory(const char *filename, const size_t mem_size, int flags)
{
void *retval;
- int fd = open(filename, flags, 0666);
+ int fd = open(filename, flags, 0600);
if (fd < 0)
return NULL;
if (ftruncate(fd, mem_size) < 0) {
if (fd < 0)
return NULL;
if (ftruncate(fd, mem_size) < 0) {
- fd = open(filename, O_CREAT | O_RDWR, 0666);
+ fd = open(filename, O_CREAT | O_RDWR, 0600);
if (fd < 0)
return NULL;
if (ftruncate(fd, mem_size) < 0) {
if (fd < 0)
return NULL;
if (ftruncate(fd, mem_size) < 0) {