fuzzing_engine: Add fuzzing engine uclass

This new class of device will provide fuzzing inputs from a fuzzing
engine.

Signed-off-by: Andrew Scull <ascull@google.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
This commit is contained in:
Andrew Scull
2022-05-30 10:00:08 +00:00
committed by Tom Rini
parent eabc4e2980
commit 3f807c6b81
7 changed files with 99 additions and 0 deletions

9
drivers/fuzz/Kconfig Normal file
View File

@@ -0,0 +1,9 @@
config DM_FUZZING_ENGINE
bool "Driver support for fuzzing engine devices"
depends on DM
help
Enable driver model for fuzzing engine devices. This interface is
used to get successive inputs from a fuzzing engine that aims to
explore different code paths in a fuzz test. The fuzzing engine may
be instrumenting the execution in order to more effectively generate
inputs that explore different code paths.

7
drivers/fuzz/Makefile Normal file
View File

@@ -0,0 +1,7 @@
# SPDX-License-Identifier: GPL-2.0+
#
# Copyright (c) 2022 Google, Inc.
# Written by Andrew Scull <ascull@google.com>
#
obj-$(CONFIG_DM_FUZZING_ENGINE) += fuzzing_engine-uclass.o

View File

@@ -0,0 +1,28 @@
/* SPDX-License-Identifier: GPL-2.0+ */
/*
* Copyright (c) 2022 Google, Inc.
* Written by Andrew Scull <ascull@google.com>
*/
#define LOG_CATEGORY UCLASS_FUZZING_ENGINE
#include <common.h>
#include <dm.h>
#include <fuzzing_engine.h>
int dm_fuzzing_engine_get_input(struct udevice *dev,
const uint8_t **data,
size_t *size)
{
const struct dm_fuzzing_engine_ops *ops = device_get_ops(dev);
if (!ops->get_input)
return -ENOSYS;
return ops->get_input(dev, data, size);
}
UCLASS_DRIVER(fuzzing_engine) = {
.name = "fuzzing_engine",
.id = UCLASS_FUZZING_ENGINE,
};