@@ -145,8 +145,11 @@ __lxcfs_fuse_ops int proc_getattr(const char *path, struct stat *sb)
145145 strcmp (path , "/proc/swaps" ) == 0 ||
146146 strcmp (path , "/proc/loadavg" ) == 0 ||
147147 strcmp (path , "/proc/slabinfo" ) == 0 ) {
148- if (liblxcfs_functional ())
148+ if (liblxcfs_functional ()) {
149+ if (!can_access_personality ())
150+ return log_error (- EACCES , RESTRICTED_PERSONALITY_ACCESS_POLICY );
149151 sb -> st_size = get_procfile_size_with_personality (path );
152+ }
150153 else
151154 sb -> st_size = get_procfile_size (path );
152155 sb -> st_mode = S_IFREG | 00444 ;
@@ -206,8 +209,11 @@ __lxcfs_fuse_ops int proc_open(const char *path, struct fuse_file_info *fi)
206209
207210 info -> type = type ;
208211
209- if (liblxcfs_functional ())
212+ if (liblxcfs_functional ()) {
213+ if (!can_access_personality ())
214+ return log_error (- EACCES , RESTRICTED_PERSONALITY_ACCESS_POLICY );
210215 info -> buflen = get_procfile_size_with_personality (path ) + BUF_RESERVE_SIZE ;
216+ }
211217 else
212218 info -> buflen = get_procfile_size (path ) + BUF_RESERVE_SIZE ;
213219
@@ -1646,8 +1652,11 @@ __lxcfs_fuse_ops int proc_read(const char *path, char *buf, size_t size,
16461652 return read_file_fuse_with_offset (LXC_TYPE_PROC_MEMINFO_PATH ,
16471653 buf , size , offset , f );
16481654 case LXC_TYPE_PROC_CPUINFO :
1649- if (liblxcfs_functional ())
1655+ if (liblxcfs_functional ()) {
1656+ if (!can_access_personality ())
1657+ return log_error (- EACCES , RESTRICTED_PERSONALITY_ACCESS_POLICY );
16501658 return proc_read_with_personality (& proc_cpuinfo_read , buf , size , offset , fi );
1659+ }
16511660
16521661 return read_file_fuse_with_offset (LXC_TYPE_PROC_CPUINFO_PATH ,
16531662 buf , size , offset , f );
0 commit comments