Skip to content

Commit

Permalink
[DEBUG] NO MERGE add debug printks
Browse files Browse the repository at this point in the history
Signed-off-by: William Roberts <william.c.roberts@intel.com>
  • Loading branch information
William Roberts committed Apr 13, 2023
1 parent 00eea52 commit 0777c96
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 4 deletions.
11 changes: 8 additions & 3 deletions arch/x86/kernel/kafl-agent.c
Original file line number Diff line number Diff line change
Expand Up @@ -535,8 +535,9 @@ EXPORT_SYMBOL(tdx_fuzz);

void tdx_fuzz_virtio_cache_init(struct virtio_device *vdev)
{
u64 data = tdx_fuzz(0, (uintptr_t)&data, sizeof(data), TDX_FUZZ_VIRTIO);

u64 data;
printk("BILL updating cache.\n");
data = tdx_fuzz(0, (uintptr_t)&data, sizeof(data), TDX_FUZZ_VIRTIO);
atomic64_set(&vdev->tdx.fuzz_data, data);
}
EXPORT_SYMBOL(tdx_fuzz_virtio_cache_init);
Expand All @@ -545,14 +546,18 @@ u64 tdx_fuzz_virtio_cache_get_64(struct virtio_device *vdev, u64 orig_var)
{
/* orig_var needed for signature when fuzzing is disabled */
(void)orig_var;
printk("BILL getting cached u64.\n");
return atomic64_read(&vdev->tdx.fuzz_data);
}
EXPORT_SYMBOL(tdx_fuzz_virtio_cache_get_64);

void tdx_fuzz_virtio_cache_refresh(struct device *dev)
{
if (!is_virtio_device(dev))
if (!is_virtio_device(dev)) {
printk("BILL is NOT VIRTIO DEVICE REFRESH SKIPPING...\n");
return;
}
printk("BILL is VIRTIO DEVICE, REFRESHING!\n");

tdx_fuzz_virtio_cache_init(dev_to_virtio(dev));
}
Expand Down
3 changes: 3 additions & 0 deletions include/linux/virtio_byteorder.h
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ static inline bool virtio_legacy_is_little_endian(void)

static inline u16 __virtio16_to_cpu(bool little_endian, __virtio16 val)
{
printk("BILL __virtio16_to_cpu\n");
if (little_endian)
return le16_to_cpu((__force __le16)val);
else
Expand All @@ -31,6 +32,7 @@ static inline __virtio16 __cpu_to_virtio16(bool little_endian, u16 val)

static inline u32 __virtio32_to_cpu(bool little_endian, __virtio32 val)
{
printk("BILL __virtio32_to_cpu\n");
if (little_endian)
return le32_to_cpu((__force __le32)val);
else
Expand All @@ -47,6 +49,7 @@ static inline __virtio32 __cpu_to_virtio32(bool little_endian, u32 val)

static inline u64 __virtio64_to_cpu(bool little_endian, __virtio64 val)
{
printk("BILL __virtio64_to_cpu\n");
if (little_endian)
return le64_to_cpu((__force __le64)val);
else
Expand Down
2 changes: 1 addition & 1 deletion init/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -1677,7 +1677,7 @@ static int __ref kernel_init(void *unused)
rcu_end_inkernel_boot();

do_sysctl_args();

printk("BILL KERNEL INIT\n");
#if defined CONFIG_TDX_FUZZ_HARNESS_FULL_BOOT || defined CONFIG_TDX_FUZZ_HARNESS_REST_INIT
// End fuzzing before dropping to userspace
kafl_fuzz_event(KAFL_DONE);
Expand Down

0 comments on commit 0777c96

Please sign in to comment.