Skip to content

Commit 4f6c7eb

Browse files
committed
Label soft_offline_page with memory_offline_page_t
Label /sys/devices/system/memory/soft_offline_page with memory_offline_page_t. Resolves: RHEL-86926
1 parent 792dcf0 commit 4f6c7eb

File tree

3 files changed

+30
-1
lines changed

3 files changed

+30
-1
lines changed

policy/modules/kernel/devices.fc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -297,6 +297,7 @@ ifdef(`distro_redhat',`
297297
#
298298
/sys(/.*)? gen_context(system_u:object_r:sysfs_t,s0)
299299
/sys/devices/system/cpu/online gen_context(system_u:object_r:cpu_online_t,s0)
300+
/sys/devices/system/memory/soft_offline_page gen_context(system_u:object_r:memory_offline_page_t,s0)
300301

301302
/usr/lib/udev/devices(/.*)? gen_context(system_u:object_r:device_t,s0)
302303
/usr/lib/udev/devices/lp.* -c gen_context(system_u:object_r:printer_device_t,s0)

policy/modules/kernel/devices.if

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5180,6 +5180,29 @@ interface(`dev_relabel_cpu_online',`
51805180
allow $1 cpu_online_t:file relabel_file_perms;
51815181
')
51825182

5183+
########################################
5184+
## <summary>
5185+
## Write memory offline page.
5186+
## </summary>
5187+
## <desc>
5188+
## <p>
5189+
## Allow the specified domain write to /sys/devices/system/memory/soft_offline_page
5190+
## </p>
5191+
## </desc>
5192+
## <param name="domain">
5193+
## <summary>
5194+
## Domain allowed access.
5195+
## </summary>
5196+
## </param>
5197+
#
5198+
interface(`dev_write_memory_offline_page',`
5199+
gen_require(`
5200+
type memory_offline_page_t;
5201+
')
5202+
5203+
dev_search_sysfs($1)
5204+
allow $1 memory_offline_page_t:file read_file_perms;
5205+
')
51835206

51845207
########################################
51855208
## <summary>

policy/modules/kernel/devices.te

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ attribute device_node;
99
attribute memory_raw_read;
1010
attribute memory_raw_write;
1111
attribute devices_unconfined_type;
12+
attribute sysfs_type;
1213

1314
#
1415
# device_t is the type of /dev.
@@ -383,10 +384,14 @@ files_mountpoint(sysfs_t)
383384
fs_type(sysfs_t)
384385
genfscon sysfs / gen_context(system_u:object_r:sysfs_t,s0)
385386

386-
type cpu_online_t;
387+
type cpu_online_t, sysfs_type;
387388
files_type(cpu_online_t)
388389
dev_associate_sysfs(cpu_online_t)
389390

391+
type memory_offline_page_t, sysfs_type;
392+
files_type(memory_offline_page_t)
393+
dev_associate_sysfs(memory_offline_page_t)
394+
390395
#
391396
# Type for /dev/tmc_etb[0-9]+ /dev/tmc_etf[0-9]+ /dev/tmc_etr[0-9]+
392397
#

0 commit comments

Comments
 (0)