Re: [PATCH] libselinux/fuzz: readjust load_mmap() update

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

 



On Thu, Dec 19, 2024 at 12:04 PM Christian Göttsche
<cgoettsche@xxxxxxxxxxxxx> wrote:
>
> From: Christian Göttsche <cgzones@xxxxxxxxxxxxxx>
>
> Update the fuzzers for the input number parameter addition.
>
> Signed-off-by: Christian Göttsche <cgzones@xxxxxxxxxxxxxx>

Acked-by: James Carter <jwcart2@xxxxxxxxx>

> ---
>  libselinux/fuzz/selabel_file_compiled-fuzzer.c | 6 +++---
>  libselinux/fuzz/selabel_file_text-fuzzer.c     | 2 +-
>  libselinux/src/label_file.h                    | 2 +-
>  3 files changed, 5 insertions(+), 5 deletions(-)
>
> diff --git a/libselinux/fuzz/selabel_file_compiled-fuzzer.c b/libselinux/fuzz/selabel_file_compiled-fuzzer.c
> index d1249a76..09fbddd1 100644
> --- a/libselinux/fuzz/selabel_file_compiled-fuzzer.c
> +++ b/libselinux/fuzz/selabel_file_compiled-fuzzer.c
> @@ -195,7 +195,7 @@ int LLVMFuzzerTestOneInput(const uint8_t *data, size_t size)
>                 goto cleanup;
>
>         errno = 0;
> -       rc = load_mmap(fp, fcontext_data1_len, &rec, MEMFD_FILE_NAME);
> +       rc = load_mmap(fp, fcontext_data1_len, &rec, MEMFD_FILE_NAME, 0);
>         if (rc) {
>                 assert(errno != 0);
>                 goto cleanup;
> @@ -208,7 +208,7 @@ int LLVMFuzzerTestOneInput(const uint8_t *data, size_t size)
>                 goto cleanup;
>
>         errno = 0;
> -       rc = load_mmap(fp, fcontext_data2_len, &rec, MEMFD_FILE_NAME);
> +       rc = load_mmap(fp, fcontext_data2_len, &rec, MEMFD_FILE_NAME, 1);
>         if (rc) {
>                 assert(errno != 0);
>                 goto cleanup;
> @@ -221,7 +221,7 @@ int LLVMFuzzerTestOneInput(const uint8_t *data, size_t size)
>                 goto cleanup;
>
>         errno = 0;
> -       rc = load_mmap(fp, fcontext_data3_len, &rec, MEMFD_FILE_NAME);
> +       rc = load_mmap(fp, fcontext_data3_len, &rec, MEMFD_FILE_NAME, 2);
>         if (rc) {
>                 assert(errno != 0);
>                 goto cleanup;
> diff --git a/libselinux/fuzz/selabel_file_text-fuzzer.c b/libselinux/fuzz/selabel_file_text-fuzzer.c
> index ed67ea25..1f8942dd 100644
> --- a/libselinux/fuzz/selabel_file_text-fuzzer.c
> +++ b/libselinux/fuzz/selabel_file_text-fuzzer.c
> @@ -167,7 +167,7 @@ int LLVMFuzzerTestOneInput(const uint8_t *data, size_t size)
>                 goto cleanup;
>
>         errno = 0;
> -       rc = process_text_file(fp, /*prefix=*/ NULL, &rec, MEMFD_FILE_NAME);
> +       rc = process_text_file(fp, /*prefix=*/ NULL, &rec, MEMFD_FILE_NAME, 0);
>         if (rc) {
>                 assert(errno != 0);
>                 goto cleanup;
> diff --git a/libselinux/src/label_file.h b/libselinux/src/label_file.h
> index 597b756e..60ebbb47 100644
> --- a/libselinux/src/label_file.h
> +++ b/libselinux/src/label_file.h
> @@ -60,7 +60,7 @@ struct lookup_result {
>         struct lookup_result *next;
>  };
>  #ifdef FUZZING_BUILD_MODE_UNSAFE_FOR_PRODUCTION
> -extern int load_mmap(FILE *fp, const size_t len, struct selabel_handle *rec, const char *path);
> +extern int load_mmap(FILE *fp, const size_t len, struct selabel_handle *rec, const char *path, uint8_t inputno);
>  extern int process_text_file(FILE *fp, const char *prefix, struct selabel_handle *rec, const char *path, uint8_t inputno);
>  extern void free_lookup_result(struct lookup_result *result);
>  extern struct lookup_result *lookup_all(struct selabel_handle *rec, const char *key, int type, bool partial, bool find_all, struct lookup_result *buf);
> --
> 2.45.2
>
>





[Index of Archives]     [Selinux Refpolicy]     [Linux SGX]     [Fedora Users]     [Fedora Desktop]     [Yosemite Photos]     [Yosemite Camping]     [Yosemite Campsites]     [KDE Users]     [Gnome Users]

  Powered by Linux