Home
last modified time | relevance | path

Searched full:bytes (Results 1 – 25 of 97) sorted by relevance

1234

/cloud-hypervisor/fuzz/fuzz_targets/
H A Dmem.rs15 use vm_memory::{Bytes, GuestAddress, GuestMemoryAtomic};
57 // Virtio-queue size in bytes
60 fuzz_target!(|bytes: &[u8]| -> Corpus {
61 if bytes.len() < VIRTIO_MEM_DATA_SIZE + QUEUE_DATA_SIZE + QUEUE_BYTES_SIZE
62 || bytes.len() > (VIRTIO_MEM_DATA_SIZE + QUEUE_DATA_SIZE + QUEUE_BYTES_SIZE + MEM_SIZE)
67 let virtio_mem_data = &bytes[..VIRTIO_MEM_DATA_SIZE];
68 let queue_data = &bytes[VIRTIO_MEM_DATA_SIZE..VIRTIO_MEM_DATA_SIZE + QUEUE_DATA_SIZE];
69 let queue_bytes = &bytes[VIRTIO_MEM_DATA_SIZE + QUEUE_DATA_SIZE
71 let mem_bytes = &bytes[VIRTIO_MEM_DATA_SIZE + QUEUE_DATA_SIZE + QUEUE_BYTES_SIZE..];
73 // Create a virtio-mem device based on the input bytes;
[all …]
H A Dwatchdog.rs15 use vm_memory::{Bytes, GuestAddress, GuestMemoryAtomic};
30 // Guest physical address for used ring (requires to 4-bytes aligned)
33 fuzz_target!(|bytes: &[u8]| -> Corpus {
34 if bytes.len() < QUEUE_DATA_SIZE || bytes.len() > (QUEUE_DATA_SIZE + MEM_SIZE) {
47 let queue_data = &bytes[..QUEUE_DATA_SIZE];
48 let mem_bytes = &bytes[QUEUE_DATA_SIZE..];
50 // Setup the virt queue with the input bytes
53 // Setup the guest memory with the input bytes
88 fn setup_virt_queue(bytes: &[u8; QUEUE_DATA_SIZE]) -> Queue { in setup_virt_queue()
90 q.set_next_avail(bytes[0] as u16); // 'u8' is enough given the 'QUEUE_SIZE' is small
[all …]
H A Dcmos.rs12 fuzz_target!(|bytes: &[u8]| -> Corpus {
13 // Need at least 16 bytes for the test
14 if bytes.len() < 16 {
21 below_4g.copy_from_slice(&bytes[0..8]);
22 above_4g.copy_from_slice(&bytes[8..16]);
32 while i < bytes.len() {
33 let read = bytes.get(i).unwrap_or(&0) % 2 == 0;
37 let offset = (bytes.get(i).unwrap_or(&0) % 2) as u64;
42 let offset = (bytes.get(i).unwrap_or(&0) % 2) as u64;
44 let data = vec![*bytes.get(i).unwrap_or(&0)];
H A Drng.rs15 use vm_memory::{Bytes, GuestAddress, GuestMemoryAtomic};
52 // Virtio-queue size in bytes
55 fuzz_target!(|bytes: &[u8]| -> Corpus {
56 if bytes.len() < (QUEUE_DATA_SIZE + QUEUE_BYTES_SIZE)
57 || bytes.len() > (QUEUE_DATA_SIZE + QUEUE_BYTES_SIZE + MEM_SIZE)
72 let queue_data = &bytes[..QUEUE_DATA_SIZE];
73 let queue_bytes = &bytes[QUEUE_DATA_SIZE..QUEUE_DATA_SIZE + QUEUE_BYTES_SIZE];
74 let mem_bytes = &bytes[QUEUE_DATA_SIZE + QUEUE_BYTES_SIZE..];
76 // Setup the virt queue with the input bytes
79 // Setup the guest memory with the input bytes
[all …]
H A Diommu.rs15 use vm_memory::{Bytes, GuestAddress, GuestMemoryAtomic};
54 // Virtio-queue size in bytes
57 fuzz_target!(|bytes: &[u8]| -> Corpus {
58 if bytes.len() < (QUEUE_DATA_SIZE + QUEUE_BYTES_SIZE)
59 || bytes.len() > (QUEUE_DATA_SIZE + QUEUE_BYTES_SIZE + MEM_SIZE)
74 let queue_data = &bytes[..QUEUE_DATA_SIZE];
75 let queue_bytes = &bytes[QUEUE_DATA_SIZE..QUEUE_DATA_SIZE + QUEUE_BYTES_SIZE];
76 let mem_bytes = &bytes[QUEUE_DATA_SIZE + QUEUE_BYTES_SIZE..];
78 // Setup the request queue with the input bytes
85 // Setup the guest memory with the input bytes
[all …]
H A Dvsock.rs16 use vm_memory::{Bytes, GuestAddress, GuestMemoryAtomic};
54 // Virtio-queue size in bytes
57 fuzz_target!(|bytes: &[u8]| -> Corpus {
58 if bytes.len() < (QUEUE_DATA_SIZE + QUEUE_BYTES_SIZE)
59 || bytes.len() > (QUEUE_DATA_SIZE + QUEUE_BYTES_SIZE + MEM_SIZE)
64 let queue_data = &bytes[..QUEUE_DATA_SIZE];
65 let queue_bytes = &bytes[QUEUE_DATA_SIZE..QUEUE_DATA_SIZE + QUEUE_BYTES_SIZE];
66 let mem_bytes = &bytes[QUEUE_DATA_SIZE + QUEUE_BYTES_SIZE..];
75 // Setup the guest memory with the input bytes
132 fn setup_virt_queue(bytes: &[u8; QUEUE_DATA_SIZE]) -> Queue { in setup_virt_queue()
[all …]
H A Dblock.rs25 use vm_memory::{Bytes, GuestAddress, GuestMemoryAtomic};
40 // Guest physical address for used ring (requires to 4-bytes aligned)
43 fuzz_target!(|bytes: &[u8]| -> Corpus {
44 if bytes.len() < QUEUE_DATA_SIZE || bytes.len() > (QUEUE_DATA_SIZE + MEM_SIZE) {
48 let queue_data = &bytes[..QUEUE_DATA_SIZE];
49 let mem_bytes = &bytes[QUEUE_DATA_SIZE..];
73 // Setup the virt queue with the input bytes
76 // Setup the guest memory with the input bytes
121 fn setup_virt_queue(bytes: &[u8; QUEUE_DATA_SIZE]) -> Queue { in setup_virt_queue()
123 q.set_next_avail(bytes[0] as u16); // 'u8' is enough given the 'QUEUE_SIZE' is small
[all …]
H A Dpmem.rs19 use vm_memory::{Bytes, GuestAddress, GuestMemoryAtomic, MmapRegion};
35 // Guest physical address for used ring (requires to 4-bytes aligned)
38 fuzz_target!(|bytes: &[u8]| -> Corpus {
39 if bytes.len() < QUEUE_DATA_SIZE || bytes.len() > (QUEUE_DATA_SIZE + MEM_SIZE) {
44 let queue_data = &bytes[..QUEUE_DATA_SIZE];
45 let mem_bytes = &bytes[QUEUE_DATA_SIZE..];
47 // Setup the virt queue with the input bytes
50 // Setup the guest memory with the input bytes
138 fn setup_virt_queue(bytes: &[u8; QUEUE_DATA_SIZE]) -> Queue { in setup_virt_queue()
140 q.set_next_avail(bytes[0] as u16); // 'u8' is enough given the 'QUEUE_SIZE' is small
[all …]
H A Dconsole.rs17 use vm_memory::{Bytes, GuestAddress, GuestMemoryAtomic};
51 // Virtio-queue size in bytes
57 fuzz_target!(|bytes: &[u8]| -> Corpus {
58 if bytes.len() < (QUEUE_DATA_SIZE + QUEUE_BYTES_SIZE) * QUEUE_NUM + CONSOLE_INPUT_SIZE
59 || bytes.len()
84 let console_input_bytes = &bytes[..CONSOLE_INPUT_SIZE];
85 let queue_data = &bytes[CONSOLE_INPUT_SIZE..CONSOLE_INPUT_SIZE + QUEUE_DATA_SIZE * QUEUE_NUM];
86 let queue_bytes = &bytes[CONSOLE_INPUT_SIZE + QUEUE_DATA_SIZE * QUEUE_NUM
88 let mem_bytes = &bytes[CONSOLE_INPUT_SIZE + (QUEUE_DATA_SIZE + QUEUE_BYTES_SIZE) * QUEUE_NUM..];
90 // Setup the virt queues with the input bytes
[all …]
H A Dballoon.rs15 use vm_memory::{Bytes, GuestAddress, GuestMemoryAtomic};
40 fuzz_target!(|bytes: &[u8]| -> Corpus {
41 if bytes.len() < QUEUE_DATA_SIZE * QUEUE_NUM
42 || bytes.len() > (QUEUE_DATA_SIZE * QUEUE_NUM + MEM_SIZE)
58 let queue_data = &bytes[..QUEUE_DATA_SIZE * QUEUE_NUM];
59 let mem_bytes = &bytes[QUEUE_DATA_SIZE * QUEUE_NUM..];
61 // Setup the guest memory with the input bytes
68 // Setup the virt queues with the input bytes
129 fn setup_virt_queues(bytes: &[&[u8; QUEUE_DATA_SIZE]], base_addr: u64) -> Vec<Queue> { in setup_virt_queues()
132 for b in bytes {
H A Dserial.rs15 fuzz_target!(|bytes| {
23 while i < bytes.len() {
24 let choice = bytes.get(i).unwrap_or(&0) % 3;
29 let offset = (bytes.get(i).unwrap_or(&0) % 8) as u64;
35 let offset = (bytes.get(i).unwrap_or(&0) % 8) as u64;
37 let data = vec![*bytes.get(i).unwrap_or(&0)];
42 let data = vec![*bytes.get(i).unwrap_or(&0)];
H A Dnet.rs17 use vm_memory::{Bytes, GuestAddress, GuestMemoryAtomic};
52 // Virtio-queue size in bytes
58 fuzz_target!(|bytes: &[u8]| -> Corpus {
59 if bytes.len() < TAP_INPUT_SIZE + (QUEUE_DATA_SIZE + QUEUE_BYTES_SIZE) * QUEUE_NUM
60 || bytes.len()
87 let tap_input_bytes = &bytes[..TAP_INPUT_SIZE];
88 let queue_data = &bytes[TAP_INPUT_SIZE..TAP_INPUT_SIZE + QUEUE_DATA_SIZE * QUEUE_NUM];
89 let queue_bytes = &bytes[TAP_INPUT_SIZE + QUEUE_DATA_SIZE * QUEUE_NUM
91 let mem_bytes = &bytes[TAP_INPUT_SIZE + (QUEUE_DATA_SIZE + QUEUE_BYTES_SIZE) * QUEUE_NUM..];
93 // Setup the virt queues with the input bytes
[all …]
H A Dqcow.rs19 fuzz_target!(|bytes: &[u8]| -> Corpus {
20 if bytes.len() < 16 {
21 // Need an address and data, each are 8 bytes.
24 let mut disk_image = Cursor::new(bytes);
29 disk_file.write_all(&bytes[16..]).unwrap();
H A Dvhdx.rs19 fuzz_target!(|bytes: &[u8]| -> Corpus {
22 disk_file.write_all(&bytes[..]).unwrap();
35 while offset < bytes.len() {
46 while offset < bytes.len() {
H A Dx86emul.rs42 // The fuzzer already provides 16 bytes of data, we don't need to fetch anything in fetch()
47 fuzz_target!(|bytes: &[u8]| -> Corpus {
48 let (mut ctx, insn) = match generate_context_and_instruction(bytes) {
93 bytes: &[u8], in generate_context_and_instruction()
95 let mut u = arbitrary::Unstructured::new(bytes);
H A Dhttp_api.rs30 fuzz_target!(|bytes: &[u8]| -> Corpus {
31 if bytes.len() < 2 {
35 let route = ROUTES[bytes[0] as usize % ROUTES.len()];
36 if let Some(request) = generate_request(&bytes[1..]) {
60 fn generate_request(bytes: &[u8]) -> Option<Request> { in generate_request()
61 let req_method = match bytes[0] % 5 { in generate_request()
70 let req_body = &bytes[1..]; in generate_request()
/cloud-hypervisor/net_util/src/
H A Dmac.rs18 bytes: [u8; MAC_ADDR_LEN], field
27 let mut bytes = [0u8; MAC_ADDR_LEN]; in parse_str() localVariable
41 bytes[i] = u8::from_str_radix(v[i], 16).map_err(|e| { in parse_str()
50 Ok(MacAddr { bytes }) in parse_str()
58 let mut bytes = [0u8; MAC_ADDR_LEN]; in from_bytes_unchecked() localVariable
59 bytes[..].copy_from_slice(src); in from_bytes_unchecked()
61 MacAddr { bytes } in from_bytes_unchecked()
79 &self.bytes in get_bytes()
96 bytes: random_bytes, in local_random()
103 let b = &self.bytes; in fmt()
[all …]
/cloud-hypervisor/rate_limiter/src/
H A Dgroup.rs342 // rate limiter with limit of 1000 bytes/s and 1000 ops/s in test_rate_limiter_group_manual_replenish()
346 // consume 123 bytes in test_rate_limiter_group_manual_replenish()
347 assert!(h.consume(123, TokenType::Bytes)); in test_rate_limiter_group_manual_replenish()
348 h.manual_replenish(23, TokenType::Bytes); in test_rate_limiter_group_manual_replenish()
364 // rate limiter with limit of 1000 bytes/s in test_rate_limiter_group_bandwidth()
378 // do full 1000 bytes in test_rate_limiter_group_bandwidth()
379 assert!(h.consume(1000, TokenType::Bytes)); in test_rate_limiter_group_bandwidth()
381 assert!(!h.consume(100, TokenType::Bytes)); in test_rate_limiter_group_bandwidth()
394 // try and succeed on another 100 bytes this time in test_rate_limiter_group_bandwidth()
395 assert!(h.consume(100, TokenType::Bytes)); in test_rate_limiter_group_bandwidth()
[all …]
H A Dlib.rs252 Bytes, enumerator
269 /// Bandwidth (bytes/s) and ops/s limiting can be used at the same time or individually.
308 /// Creates a new Rate Limiter that can limit on both bytes/s and ops/s.
312 /// * `bytes_total_capacity` - the total capacity of the `TokenType::Bytes` token bucket.
315 /// * `bytes_complete_refill_time_ms` - number of milliseconds for the `TokenType::Bytes`
316 /// token bucket to go from zero Bytes to `bytes_total_capacity` Bytes.
323 /// If either bytes/ops *size* or *refill_time* are **zero**, the limiter
387 TokenType::Bytes => guard.bandwidth.as_mut(), in consume()
436 TokenType::Bytes => guard.bandwidth.as_mut(), in manual_replenish()
488 pub fn update_buckets(&mut self, bytes: BucketUpdate, ops: BucketUpdate) { in update_buckets()
[all …]
/cloud-hypervisor/vmm/src/
H A Dmigration.rs57 let mut bytes = Vec::new(); in recv_vm_config() localVariable
59 .read_to_end(&mut bytes) in recv_vm_config()
62 serde_json::from_slice(&bytes).map_err(|e| MigratableError::MigrateReceive(e.into())) in recv_vm_config()
73 let mut bytes = Vec::new(); in recv_vm_state() localVariable
75 .read_to_end(&mut bytes) in recv_vm_state()
78 serde_json::from_slice(&bytes).map_err(|e| MigratableError::MigrateReceive(e.into())) in recv_vm_state()
H A Dcoredump.rs78 // SAFETY: This is just a series of bytes
174 // SAFETY: This is just a series of bytes
240 let bytes: &[u8] = elf64_ehdr.as_slice(); in write_header() localVariable
242 .write(bytes) in write_header()
265 let bytes: &[u8] = elf64_phdr.as_slice(); in write_note() localVariable
267 .write(bytes) in write_note()
293 let bytes: &[u8] = elf64_load.as_slice(); in write_load() localVariable
295 .write(bytes) in write_load()
H A Dacpi.rs21 use vm_memory::{Address, Bytes, GuestAddress, GuestMemoryRegion};
185 let mut bytes = Vec::new(); in create_dsdt_table() localVariable
187 device_manager.lock().unwrap().to_aml_bytes(&mut bytes); in create_dsdt_table()
188 cpu_manager.lock().unwrap().to_aml_bytes(&mut bytes); in create_dsdt_table()
189 memory_manager.lock().unwrap().to_aml_bytes(&mut bytes); in create_dsdt_table()
190 dsdt.append_slice(&bytes); in create_dsdt_table()
198 // Revision 6 of the ACPI FADT table is 276 bytes long in create_facp_table()
256 // MCFG reserved 8 bytes in create_mcfg_table()
289 // SRAT reserved 12 bytes in create_srat_table()
362 // Number of System Localities on 8 bytes. in create_slit_table()
[all …]
/cloud-hypervisor/docs/
H A Dio_throttling.md9 Cloud Hypervisor allows to limit both the I/O bandwidth (e.g. bytes/s)
14 provides three user options, i.e., `bw_size` (bytes), `bw_one_time_burst`
15 (bytes), and `bw_refill_time` (ms). Both `bw_size` and `bw_refill_time`
18 (`bw_size` bytes), an initial burst size (`bw_one_time_burst`) and an
20 `bw_size` bytes per `bw_refill_time` ms, and it is the constant rate at
H A Dheap-profiling.md34 dhat: Total: 384,582 bytes in 3,512 blocks
35 dhat: At t-gmax: 133,885 bytes in 379 blocks
36 dhat: At t-end: 12,160 bytes in 20 blocks
/cloud-hypervisor/virtio-devices/src/vsock/csm/
H A Dtxbuf.rs24 /// Total buffer size, in bytes.
38 /// Get the used length of this buffer - number of bytes that have been pushed in, but not
77 // Either way, we've just pushed exactly `src.len()` bytes, so that's the amount by in push()
86 /// Return the number of bytes that have been transferred out of the ring-buffer and into
118 // Move the buffer tail ahead by the amount (of bytes) we were able to flush out. in flush_to()
133 // and return the number of bytes written in the first pass. in flush_to()

1234