diff options
author | Andrew Scull <ascull@google.com> | 2022-05-30 10:00:12 +0000 |
---|---|---|
committer | Tom Rini <trini@konsulko.com> | 2022-06-23 12:58:19 -0400 |
commit | 0518e7a28fdbaf27cda7a43d1a52d457536e1d9b (patch) | |
tree | 2309dcfddb3c19b0cec341a504fceec6de487198 /drivers/fuzz/sandbox_fuzzing_engine.c | |
parent | d9962b12f200156238a4c825c0b540a203c72042 (diff) |
sandbox: Implement fuzzing engine driver
Add a fuzzing engine driver for the sandbox to take inputs from
libfuzzer and expose them to the fuzz tests.
Signed-off-by: Andrew Scull <ascull@google.com>
Diffstat (limited to 'drivers/fuzz/sandbox_fuzzing_engine.c')
-rw-r--r-- | drivers/fuzz/sandbox_fuzzing_engine.c | 35 |
1 files changed, 35 insertions, 0 deletions
diff --git a/drivers/fuzz/sandbox_fuzzing_engine.c b/drivers/fuzz/sandbox_fuzzing_engine.c new file mode 100644 index 0000000000..ebb938e5ba --- /dev/null +++ b/drivers/fuzz/sandbox_fuzzing_engine.c @@ -0,0 +1,35 @@ +/* SPDX-License-Identifier: GPL-2.0+ */ +/* + * Copyright (c) 2022 Google, Inc. + * Written by Andrew Scull <ascull@google.com> + */ + +#include <common.h> +#include <dm.h> +#include <fuzzing_engine.h> +#include <asm/fuzzing_engine.h> + +static int get_input(struct udevice *dev, + const uint8_t **data, + size_t *size) +{ + return sandbox_fuzzing_engine_get_input(data, size); +} + +static const struct dm_fuzzing_engine_ops sandbox_fuzzing_engine_ops = { + .get_input = get_input, +}; + +static const struct udevice_id sandbox_fuzzing_engine_match[] = { + { + .compatible = "sandbox,fuzzing-engine", + }, + {}, +}; + +U_BOOT_DRIVER(sandbox_fuzzing_engine) = { + .name = "sandbox-fuzzing-engine", + .id = UCLASS_FUZZING_ENGINE, + .of_match = sandbox_fuzzing_engine_match, + .ops = &sandbox_fuzzing_engine_ops, +}; |