Skip to content

Commit 35502a5

Browse files
committed
Remove some redundant seccomp entries from allow lists
These have been determined by static analysis of a Firecracker binary (see also follow up commits): The removed seccomp rules here trigger syscalls that are either not present at all in the entire Firecracker binary, or are not reachable from the entry point of a specific Firecracker thread (this analysis has only been done for the vcpu thread for now, due to being fairly tricky). Some explanations for why some of these entries are no longer needed can be found below - The `uname` syscall was used back when we supported 4.14, to query the host kernel version and disable specific Firecracker features that were not supported pre-5.10 (io_uring and hugepages for memfd). With 4.14 support dropped, there are no such checks anymore. - Various KVM_SET_* ioctls do not need to be allowed on the vcpu thread, because they are all called _before_ the vcpu seccomp filters are installed (as they are only used during snapshot restore / when preparing KVM state for boot). - on aarch64, we can additionally remove KVM_{SET,GET}VCPU_EVENTS, as we never call this ioctl on arm (only on x86) Signed-off-by: Patrick Roy <[email protected]>
1 parent cb9521f commit 35502a5

File tree

2 files changed

+3
-203
lines changed

2 files changed

+3
-203
lines changed

resources/seccomp/aarch64-unknown-linux-musl.json

Lines changed: 0 additions & 52 deletions
Original file line numberDiff line numberDiff line change
@@ -42,10 +42,6 @@
4242
{
4343
"syscall": "close"
4444
},
45-
{
46-
"syscall": "uname",
47-
"comment": "Used for getting the kernel version, for validating io_uring support"
48-
},
4945
{
5046
"syscall": "eventfd2",
5147
"comment": "Used for creating io_uring completion event, on drive patch"
@@ -970,42 +966,6 @@
970966
}
971967
]
972968
},
973-
{
974-
"syscall": "ioctl",
975-
"args": [
976-
{
977-
"index": 1,
978-
"type": "dword",
979-
"op": "eq",
980-
"val": 1074048665,
981-
"comment": "KVM_SET_MP_STATE"
982-
}
983-
]
984-
},
985-
{
986-
"syscall": "ioctl",
987-
"args": [
988-
{
989-
"index": 1,
990-
"type": "dword",
991-
"op": "eq",
992-
"val": 2151722655,
993-
"comment": "KVM_GET_VCPU_EVENTS"
994-
}
995-
]
996-
},
997-
{
998-
"syscall": "ioctl",
999-
"args": [
1000-
{
1001-
"index": 1,
1002-
"type": "dword",
1003-
"op": "eq",
1004-
"val": 1077980832,
1005-
"comment": "KVM_SET_VCPU_EVENTS"
1006-
}
1007-
]
1008-
},
1009969
{
1010970
"syscall": "ioctl",
1011971
"args": [
@@ -1018,18 +978,6 @@
1018978
}
1019979
]
1020980
},
1021-
{
1022-
"syscall": "ioctl",
1023-
"args": [
1024-
{
1025-
"index": 1,
1026-
"type": "dword",
1027-
"op": "eq",
1028-
"val": 1074835116,
1029-
"comment": "KVM_SET_ONE_REG"
1030-
}
1031-
]
1032-
},
1033981
{
1034982
"syscall": "ioctl",
1035983
"args": [

resources/seccomp/x86_64-unknown-linux-musl.json

Lines changed: 3 additions & 151 deletions
Original file line numberDiff line numberDiff line change
@@ -42,10 +42,6 @@
4242
{
4343
"syscall": "close"
4444
},
45-
{
46-
"syscall": "uname",
47-
"comment": "Used for getting the kernel version, for validating io_uring support"
48-
},
4945
{
5046
"syscall": "eventfd2",
5147
"comment": "Used for creating io_uring completion event, on drive patch"
@@ -111,8 +107,8 @@
111107
"comment": "sigaltstack is used by Rust stdlib to remove alternative signal stack during thread teardown."
112108
},
113109
{
114-
"syscall": "getrandom",
115-
"comment": "getrandom is used by aws-lc library which we consume in virtio-rng"
110+
"syscall": "getrandom",
111+
"comment": "getrandom is used by aws-lc library which we consume in virtio-rng"
116112
},
117113
{
118114
"syscall": "accept4",
@@ -214,7 +210,7 @@
214210
},
215211
{
216212
"syscall": "madvise",
217-
"comment": "Used by the VirtIO balloon device and by musl for some customer workloads. It is also used by aws-lc during random number generation. They setup a memory page that mark with MADV_WIPEONFORK to be able to detect forks. They also call it with -1 to see if madvise is supported in certain platforms."
213+
"comment": "Used by the VirtIO balloon device and by musl for some customer workloads. It is also used by aws-lc during random number generation. They setup a memory page that mark with MADV_WIPEONFORK to be able to detect forks. They also call it with -1 to see if madvise is supported in certain platforms."
218214
},
219215
{
220216
"syscall": "mmap",
@@ -978,18 +974,6 @@
978974
}
979975
]
980976
},
981-
{
982-
"syscall": "ioctl",
983-
"args": [
984-
{
985-
"index": 1,
986-
"type": "dword",
987-
"op": "eq",
988-
"val": 1074048665,
989-
"comment": "KVM_SET_MP_STATE"
990-
}
991-
]
992-
},
993977
{
994978
"syscall": "ioctl",
995979
"args": [
@@ -1002,18 +986,6 @@
1002986
}
1003987
]
1004988
},
1005-
{
1006-
"syscall": "ioctl",
1007-
"args": [
1008-
{
1009-
"index": 1,
1010-
"type": "dword",
1011-
"op": "eq",
1012-
"val": 1077980832,
1013-
"comment": "KVM_SET_VCPU_EVENTS"
1014-
}
1015-
]
1016-
},
1017989
{
1018990
"syscall": "ioctl",
1019991
"args": [
@@ -1038,78 +1010,6 @@
10381010
}
10391011
]
10401012
},
1041-
{
1042-
"syscall": "ioctl",
1043-
"args": [
1044-
{
1045-
"index": 1,
1046-
"type": "dword",
1047-
"op": "eq",
1048-
"val": 1074310800,
1049-
"comment": "KVM_SET_CPUID2"
1050-
}
1051-
]
1052-
},
1053-
{
1054-
"syscall": "ioctl",
1055-
"args": [
1056-
{
1057-
"index": 1,
1058-
"type": "dword",
1059-
"op": "eq",
1060-
"val": 1140895375,
1061-
"comment": "KVM_SET_LAPIC"
1062-
}
1063-
]
1064-
},
1065-
{
1066-
"syscall": "ioctl",
1067-
"args": [
1068-
{
1069-
"index": 1,
1070-
"type": "dword",
1071-
"op": "eq",
1072-
"val": 1074310793,
1073-
"comment": "KVM_SET_MSRS"
1074-
}
1075-
]
1076-
},
1077-
{
1078-
"syscall": "ioctl",
1079-
"args": [
1080-
{
1081-
"index": 1,
1082-
"type": "dword",
1083-
"op": "eq",
1084-
"val": 1083223682,
1085-
"comment": "KVM_SET_REGS"
1086-
}
1087-
]
1088-
},
1089-
{
1090-
"syscall": "ioctl",
1091-
"args": [
1092-
{
1093-
"index": 1,
1094-
"type": "dword",
1095-
"op": "eq",
1096-
"val": 1094233732,
1097-
"comment": "KVM_SET_SREGS"
1098-
}
1099-
]
1100-
},
1101-
{
1102-
"syscall": "ioctl",
1103-
"args": [
1104-
{
1105-
"index": 1,
1106-
"type": "dword",
1107-
"op": "eq",
1108-
"val": 2154868383,
1109-
"comment": "KVM_GET_PIT2"
1110-
}
1111-
]
1112-
},
11131013
{
11141014
"syscall": "ioctl",
11151015
"args": [
@@ -1158,18 +1058,6 @@
11581058
}
11591059
]
11601060
},
1161-
{
1162-
"syscall": "ioctl",
1163-
"args": [
1164-
{
1165-
"index": 1,
1166-
"type": "dword",
1167-
"op": "eq",
1168-
"val": 1082175138,
1169-
"comment": "KVM_SET_DEBUGREGS"
1170-
}
1171-
]
1172-
},
11731061
{
11741062
"syscall": "ioctl",
11751063
"args": [
@@ -1182,18 +1070,6 @@
11821070
}
11831071
]
11841072
},
1185-
{
1186-
"syscall": "ioctl",
1187-
"args": [
1188-
{
1189-
"index": 1,
1190-
"type": "dword",
1191-
"op": "eq",
1192-
"val": 1342221989,
1193-
"comment": "KVM_SET_XSAVE"
1194-
}
1195-
]
1196-
},
11971073
{
11981074
"syscall": "ioctl",
11991075
"args": [
@@ -1206,30 +1082,6 @@
12061082
}
12071083
]
12081084
},
1209-
{
1210-
"syscall": "ioctl",
1211-
"args": [
1212-
{
1213-
"index": 1,
1214-
"type": "dword",
1215-
"op": "eq",
1216-
"val": 1099476647,
1217-
"comment": "KVM_SET_XCRS"
1218-
}
1219-
]
1220-
},
1221-
{
1222-
"syscall": "ioctl",
1223-
"args": [
1224-
{
1225-
"index": 1,
1226-
"type": "dword",
1227-
"op": "eq",
1228-
"val": 44706,
1229-
"comment": "KVM_SET_TSC_KHZ"
1230-
}
1231-
]
1232-
},
12331085
{
12341086
"syscall": "ioctl",
12351087
"args": [

0 commit comments

Comments
 (0)