starry-kernel 0.7.7

A Linux-compatible OS kernel built on ArceOS unikernel
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
//! Narrow test-only exports for kernel axtest targets.

pub fn user_space_base() -> usize {
    super::config::USER_SPACE_BASE
}

pub fn user_space_size() -> usize {
    super::config::USER_SPACE_SIZE
}

pub fn user_stack_top() -> usize {
    super::config::USER_STACK_TOP
}

pub fn user_stack_size() -> usize {
    super::config::USER_STACK_SIZE
}

pub fn signal_trampoline() -> usize {
    super::config::SIGNAL_TRAMPOLINE
}

pub fn invalid_timespec_is_rejected() -> bool {
    use super::time::TimeValueLike;

    let invalid = linux_raw_sys::general::__kernel_timespec {
        tv_sec: 0,
        tv_nsec: 1_000_000_000,
    };
    invalid.try_into_time_value().is_err()
}

pub fn random_write_mixes_entropy() -> bool {
    super::pseudofs::dev::random_write_mixes_entropy_for_test()
}

pub fn pipe_peer_close_with_multiple_readers_is_visible() -> bool {
    super::file::peer_close_with_multiple_readers_is_visible_for_test()
}

pub fn pipe_resize_rejects_oversized_pipe() -> bool {
    super::file::resize_rejects_oversized_pipe_for_test()
}

pub fn fcntl_setpipe_size_returns_capacity() -> bool {
    super::syscall::fcntl_setpipe_size_returns_capacity_for_test()
}

pub fn private_mmap_rejects_fault_at_file_eof() -> bool {
    super::mm::private_mmap_eof_check_for_test()
}

pub fn cow_file_max_read_len_boundary_rules_hold() -> bool {
    super::mm::cow_file_max_read_len_boundary_rules_hold_for_test()
}

pub fn concurrent_epoll_reverse_add_is_serialized() -> bool {
    super::file::concurrent_reverse_add_is_serialized_for_test()
}

pub fn process_mem_stats_formats_linux_fields() -> bool {
    use super::mm::ProcessMemStats;

    let stats = ProcessMemStats {
        vss_pages: 256,
        text_pages: 10,
        data_pages: 64,
        stack_pages: 32,
        exe_pages: 16,
        resident_pages: 48,
        rss_anon_pages: 40,
        rss_file_pages: 4,
        rss_shmem_pages: 4,
        hiwater_rss_pages: 48,
        peak_pages: 512,
        ..Default::default()
    };

    stats.format_statm() == "256 48 8 10 0 64 0\n"
        && stats.vsize_bytes() == 256 * 4096
        && stats.rss_pages() == 48
        && {
            let status = stats.format_status_vm_lines();
            status.contains("VmPeak:\t2048 kB\n")
                && status.contains("VmSize:\t1024 kB\n")
                && status.contains("VmHWM:\t192 kB\n")
                && status.contains("VmRSS:\t192 kB\n")
                && status.contains("RssAnon:\t160 kB\n")
                && status.contains("RssFile:\t16 kB\n")
                && status.contains("RssShmem:\t16 kB\n")
                && status.contains("VmData:\t256 kB\n")
                && status.contains("VmStk:\t128 kB\n")
                && status.contains("VmExe:\t64 kB\n")
        }
}

pub fn memory_accounting_tracks_cow_charge_transitions() -> bool {
    use ax_memory_addr::VirtAddr;

    use super::mm::{MemoryAccounting, RssKind};

    let acct = MemoryAccounting::new();
    let file_page = VirtAddr::from(0x1000usize);
    let moved_page = VirtAddr::from(0x2000usize);

    acct.record_charge(file_page, RssKind::File).is_ok()
        && acct.rss_file_pages() == 1
        && acct.cow_file_write_to_anon(file_page)
        && acct.rss_file_pages() == 0
        && acct.rss_anon_pages() == 1
        && acct.move_charge(file_page, moved_page).is_ok()
        && acct.charge_entries() == alloc::vec![(moved_page, RssKind::Anon)]
        && acct.remove_charge(moved_page) == Some(RssKind::Anon)
        && acct.rss_total_pages() == 0
}

pub fn memory_accounting_rejects_duplicate_and_conflicting_charges() -> bool {
    use ax_memory_addr::VirtAddr;

    use super::mm::{MemoryAccounting, RssKind};

    let acct = MemoryAccounting::new();
    let src = VirtAddr::from(0x3000usize);
    let dst = VirtAddr::from(0x4000usize);
    let orphan = VirtAddr::from(0x5000usize);

    acct.record_charge(src, RssKind::File).is_ok()
        && acct.record_charge(src, RssKind::Anon).is_err()
        && acct.record_charge(dst, RssKind::Shmem).is_ok()
        && acct.move_charge(src, dst).is_err()
        && acct.charge_entries().contains(&(src, RssKind::File))
        && acct.charge_entries().contains(&(dst, RssKind::Shmem))
        && acct.adopt_cow_write_as_anon(orphan).is_ok()
        && acct.charge_entries().contains(&(orphan, RssKind::Anon))
        && acct.rss_anon_pages() == 1
}

pub fn accounting_edge_cases_and_snapshot_rules_hold() -> bool {
    super::mm::accounting_edge_cases_and_snapshot_rules_hold_for_test()
}

pub fn rss_kind_and_accounting_rules_hold() -> bool {
    super::mm::rss_kind_and_accounting_rules_hold_for_test()
}

pub fn accounting_rss_kind_debug_and_default_hold() -> bool {
    super::mm::accounting_rss_kind_debug_and_default_hold_for_test()
}

pub fn process_vm_stat_watermarks_hold() -> bool {
    super::mm::process_vm_stat_watermarks_hold_for_test()
}

pub fn process_vm_stat_edge_cases_hold() -> bool {
    super::mm::process_vm_stat_edge_cases_hold_for_test()
}

pub fn user_pointer_metadata_rules_hold() -> bool {
    super::mm::user_pointer_metadata_rules_hold_for_test()
}

pub fn time_value_conversion_rules_hold() -> bool {
    super::time::time_value_conversion_rules_hold_for_test()
}

pub fn credential_capability_rules_hold() -> bool {
    super::task::credential_capability_rules_hold_for_test()
}

pub fn resource_limit_defaults_hold() -> bool {
    super::task::resource_limit_defaults_hold_for_test()
}

pub fn posix_timer_clock_validation_rules_hold() -> bool {
    super::task::posix_timer_clock_validation_rules_hold_for_test()
}

pub fn itimer_type_signo_and_time_conversion_rules_hold() -> bool {
    super::task::itimer_type_signo_and_time_conversion_rules_hold_for_test()
}

pub fn seccomp_filter_rules_hold() -> bool {
    super::task::seccomp_filter_rules_hold_for_test()
}

pub fn rseq_validation_rejects_invalid_arguments() -> bool {
    super::syscall::rseq_validation_rejects_invalid_arguments_for_test()
}

pub fn membarrier_validation_rules_hold() -> bool {
    super::syscall::membarrier_validation_rules_hold_for_test()
}

pub fn signal_sigset_size_and_signo_validation_rules_hold() -> bool {
    super::syscall::signal_sigset_size_and_signo_validation_rules_hold_for_test()
}

pub fn signal_sigset_and_signo_validation_rules_hold() -> bool {
    super::syscall::signal_sigset_and_signo_validation_rules_hold_for_test()
}

pub fn io_rwf_flags_validation_rules_hold() -> bool {
    super::syscall::io_rwf_flags_validation_rules_hold_for_test()
}

pub fn metadata_to_kstat_conversion_rules_hold() -> bool {
    super::file::metadata_to_kstat_conversion_rules_hold_for_test()
}

pub fn uid_valid_and_syslog_validation_rules_hold() -> bool {
    super::syscall::uid_valid_and_syslog_validation_rules_hold_for_test()
}

pub fn mempolicy_validation_rules_hold() -> bool {
    super::syscall::mempolicy_validation_rules_hold_for_test()
}

pub fn task_clone_validation_rules_hold() -> bool {
    super::syscall::task_clone_validation_rules_hold_for_test()
}

pub fn proc_formatting_contracts_hold() -> bool {
    super::pseudofs::proc::formatting_contracts_hold_for_test()
}

pub fn proc_bus_usb_devices_snapshot_matches_busybox_lsusb_layout() -> bool {
    super::pseudofs::proc::proc_bus_usb_devices_snapshot_matches_busybox_lsusb_layout_for_test()
}

pub fn bpf_unknown_command_is_invalid() -> bool {
    super::ebpf::bpf_unknown_command_is_invalid_for_test()
}

pub fn bpf_error_adapter_rules_hold() -> bool {
    super::ebpf::bpf_error_adapter_rules_hold_for_test()
}

pub fn bpf_error_more_variants_and_edge_cases_hold() -> bool {
    super::ebpf::bpf_error_more_variants_and_edge_cases_hold_for_test()
}

pub fn pipe_resize_rounding_and_state_rules_hold() -> bool {
    super::file::pipe_resize_rounding_and_state_rules_hold_for_test()
}

pub fn epoll_event_matching_rules_hold() -> bool {
    super::file::epoll_event_matching_rules_hold_for_test()
}

pub fn stats_classify_and_accumulate_rules_hold() -> bool {
    super::mm::stats_classify_and_accumulate_rules_hold_for_test()
}

pub fn capability_data_conversion_rules_hold() -> bool {
    super::syscall::capability_data_conversion_rules_hold_for_test()
}

pub fn pipe_size_rounding_and_rejection_rules_hold() -> bool {
    super::syscall::pipe_size_rounding_and_rejection_rules_hold_for_test()
}

pub fn seccomp_filter_construction_rules_hold() -> bool {
    super::task::seccomp_filter_construction_rules_hold_for_test()
}

pub fn push_topology_item_preserves_order_and_grows_capacity() -> bool {
    super::file::push_topology_item_preserves_order_and_grows_capacity()
}

pub fn epoll_edge_id_and_constants_hold() -> bool {
    super::file::epoll_edge_id_and_constants_hold_for_test()
}

pub fn epoll_topology_struct_and_methods_hold() -> bool {
    super::file::epoll_topology_struct_and_methods_hold_for_test()
}

pub fn epoll_topology_direction_and_scan_hold() -> bool {
    super::file::epoll_topology_direction_and_scan_hold_for_test()
}

pub fn epoll_edge_id_clone_copy_partial_eq_hold() -> bool {
    super::file::epoll_edge_id_clone_copy_partial_eq_hold_for_test()
}

pub fn epoll_topology_static_constants_hold() -> bool {
    super::file::epoll_topology_static_constants_hold_for_test()
}

pub fn epoll_topology_link_clone_hold() -> bool {
    super::file::epoll_topology_link_clone_hold_for_test()
}

pub fn epoll_topology_vec_and_reserve_hold() -> bool {
    super::file::epoll_topology_vec_and_reserve_hold_for_test()
}

pub fn epoll_arc_operations_hold() -> bool {
    super::file::epoll_arc_operations_hold_for_test()
}

pub fn dummy_stat_fs_fields_match_expected_defaults() -> bool {
    super::pseudofs::dummy_stat_fs_fields_match_expected_defaults_for_test()
}

pub fn perf_control_callback_runs_preemptible() -> bool {
    super::perf::control_callback_runs_preemptible_for_test()
}

pub fn stop_machine_runs_action_and_sync_on_each_cpu() -> bool {
    super::stop_machine::stop_machine_runs_action_and_sync_on_each_cpu_for_test()
}

pub fn is_wext_ioctl_validation_rules_hold() -> bool {
    super::file::is_wext_ioctl_validation_rules_hold_for_test()
}

pub fn cmsg_alignment_and_space_rules_hold() -> bool {
    super::syscall::cmsg_alignment_and_space_rules_hold_for_test()
}

pub fn seccomp_action_and_precedence_rules_hold() -> bool {
    super::task::seccomp_action_and_precedence_rules_hold_for_test()
}

pub fn seccomp_bpf_constants_hold() -> bool {
    super::task::seccomp_bpf_constants_hold_for_test()
}

pub fn syscall_signal_restart_rules_hold() -> bool {
    super::syscall::syscall_signal_restart_rules_hold_for_test()
}

pub fn futex_op_and_compare_rules_hold() -> bool {
    super::syscall::futex_op_and_compare_rules_hold_for_test()
}

pub fn mmap_capped_device_map_len_rules_hold() -> bool {
    super::syscall::mmap_capped_device_map_len_rules_hold_for_test()
}

pub fn aio_iocb_validation_rules_hold() -> bool {
    super::syscall::aio_iocb_validation_rules_hold_for_test()
}

pub fn decode_wait_status_rules_hold() -> bool {
    super::task::decode_wait_status_rules_hold_for_test()
}

pub fn xattr_name_and_value_validation_rules_hold() -> bool {
    super::syscall::xattr_name_and_value_validation_rules_hold_for_test()
}

pub fn eventfd_flags_validation_rules_hold() -> bool {
    super::syscall::eventfd_flags_validation_rules_hold_for_test()
}

pub fn signalfd_flags_validation_rules_hold() -> bool {
    super::syscall::signalfd_flags_validation_rules_hold_for_test()
}

pub fn pidfd_flags_and_signal_validation_rules_hold() -> bool {
    super::syscall::pidfd_flags_and_signal_validation_rules_hold_for_test()
}

pub fn reaping_identity_is_not_publicly_resolvable() -> bool {
    super::task::reaping_identity_is_not_publicly_resolvable_for_test()
}

pub fn timerfd_timespec_conversion_rules_hold() -> bool {
    super::syscall::timerfd_timespec_conversion_rules_hold_for_test()
}

pub fn inotify_flags_validation_rules_hold() -> bool {
    super::syscall::inotify_flags_validation_rules_hold_for_test()
}

pub fn pipe_flags_validation_rules_hold() -> bool {
    super::syscall::pipe_flags_validation_rules_hold_for_test()
}

pub fn stat_flags_validation_rules_hold() -> bool {
    super::syscall::stat_flags_validation_rules_hold_for_test()
}

pub fn memfd_flags_validation_rules_hold() -> bool {
    super::syscall::memfd_flags_validation_rules_hold_for_test()
}

pub fn mount_flags_validation_rules_hold() -> bool {
    super::syscall::mount_flags_validation_rules_hold_for_test()
}

pub fn io_offset_from_hilo_rules_hold() -> bool {
    super::syscall::io_offset_from_hilo_rules_hold_for_test()
}

pub fn io_uring_round_ring_entries_rules_hold() -> bool {
    super::syscall::io_uring_round_ring_entries_rules_hold_for_test()
}

pub fn fd_ops_flags_to_options_rules_hold() -> bool {
    super::syscall::fd_ops_flags_to_options_rules_hold_for_test()
}

pub fn rseq_validation_rules_hold() -> bool {
    super::syscall::rseq_validation_rules_hold_for_test()
}

pub fn mincore_validation_rules_hold() -> bool {
    super::syscall::mincore_validation_rules_hold_for_test()
}

pub fn time_clock_id_validation_rules_hold() -> bool {
    super::syscall::time_clock_id_validation_rules_hold_for_test()
}

pub fn exit_code_encoding_rules_hold() -> bool {
    super::syscall::exit_code_encoding_rules_hold_for_test()
}

pub fn job_setpgid_validation_rules_hold() -> bool {
    super::syscall::job_setpgid_validation_rules_hold_for_test()
}

pub fn schedule_clock_and_sched_validation_rules_hold() -> bool {
    super::syscall::schedule_clock_and_sched_validation_rules_hold_for_test()
}

pub fn thread_arch_prctl_code_rules_hold() -> bool {
    super::syscall::thread_arch_prctl_code_rules_hold_for_test()
}

pub fn resources_rlimit_validation_rules_hold() -> bool {
    super::syscall::resources_rlimit_validation_rules_hold_for_test()
}

pub fn kmod_flags_validation_rules_hold() -> bool {
    super::syscall::kmod_flags_validation_rules_hold_for_test()
}

pub fn sys_constants_and_validation_rules_hold() -> bool {
    super::syscall::sys_constants_and_validation_rules_hold_for_test()
}

pub fn select_fd_set_and_validation_rules_hold() -> bool {
    super::syscall::select_fd_set_and_validation_rules_hold_for_test()
}

pub fn poll_nfds_validation_rules_hold() -> bool {
    super::syscall::poll_nfds_validation_rules_hold_for_test()
}

pub fn epoll_validation_rules_hold() -> bool {
    super::syscall::epoll_validation_rules_hold_for_test()
}

pub fn ipc_permission_and_constants_rules_hold() -> bool {
    super::syscall::ipc_permission_and_constants_rules_hold_for_test()
}

pub fn net_addr_conversion_rules_hold() -> bool {
    super::syscall::net_addr_conversion_rules_hold_for_test()
}

pub fn ctl_ioctl_constants_hold() -> bool {
    super::syscall::ctl_ioctl_constants_hold_for_test()
}

pub fn net_opt_normalization_rules_hold() -> bool {
    super::syscall::net_opt_normalization_rules_hold_for_test()
}

pub fn net_io_constants_hold() -> bool {
    super::syscall::net_io_constants_hold_for_test()
}

pub fn net_socket_constants_hold() -> bool {
    super::syscall::net_socket_constants_hold_for_test()
}