[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Xen-devel] [PATCH 2/2] tools/fuzz: Add a cpu-policy fuzzing harness



>>> On 04.06.19 at 21:51, <andrew.cooper3@xxxxxxxxxx> wrote:
> There is now enough complexity that a fuzzing harness is a good idea, and
> enough supporting logic to implement one which AFL seems happy with.
> 
> Take the existing recalculate_synth() helper and export it as
> x86_cpuid_policy_recalc_synth(), as it is needed by the fuzzing harness.
> 
> Signed-off-by: Andrew Cooper <andrew.cooper3@xxxxxxxxxx>
> ---
> CC: Jan Beulich <JBeulich@xxxxxxxx>
> CC: Wei Liu <wl@xxxxxxx>
> CC: Roger Pau Monné <roger.pau@xxxxxxxxxx>
> CC: Sergey Dyasli <sergey.dyasli@xxxxxxxxxx>
> ---
>  tools/fuzz/cpu-policy/.gitignore          |   1 +
>  tools/fuzz/cpu-policy/Makefile            |  28 +++++
>  tools/fuzz/cpu-policy/afl-policy-fuzzer.c | 187 
> ++++++++++++++++++++++++++++++

Does this want to be accompanied by a ./MAINTAINERS update
to the X86 section?

>  xen/include/xen/lib/x86/cpuid.h           |   5 +
>  xen/lib/x86/cpuid.c                       |   7 +-
>  5 files changed, 224 insertions(+), 4 deletions(-)

Acked-by: Jan Beulich <jbeulich@xxxxxxxx>
with one further remark:

> +int main(int argc, char **argv)
> +{
> +    FILE *fp = NULL;
> +
> +    setbuf(stdin, NULL);
> +    setbuf(stdout, NULL);
> +
> +    while ( true )
> +    {
> +        static const struct option opts[] = {
> +            { "debug", no_argument, NULL, 'd' },
> +            { "help", no_argument, NULL, 'h' },
> +            {},
> +        };
> +        int c = getopt_long(argc, argv, "hd", opts, NULL);
> +
> +        if ( c == -1 )
> +            break;
> +
> +        switch ( c )
> +        {
> +        case 'd':
> +            printf("Enabling debug\n");
> +            debug = true;
> +            break;
> +
> +        default:
> +            printf("Bad option %d (%c)\n", c, c);
> +            exit(-1);
> +            break;

Wouldn't 'h' (wrongly) come into here? (The break statement also looks
to be unnecessary after exit().)

Jan


_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxxxxxxxxx
https://lists.xenproject.org/mailman/listinfo/xen-devel

 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.