rust-lang / rust-bindgen

Automatically generates Rust FFI bindings to C (and some C++) libraries.
https://rust-lang.github.io/rust-bindgen/
BSD 3-Clause "New" or "Revised" License
4.48k stars 699 forks source link

Generated tests warn about undefined behaviour with Rust 1.53.0 #2069

Closed flxo closed 3 years ago

flxo commented 3 years ago

With an update to Rust 1.53.0, generated test for bindings to the Linux audit stuff warn about undefined behaviour. Tested on an Debian 9 on x86_64.

Input C/C++ Header

# 1 "__bindgen.c"
# 1 "<built-in>" 1
# 1 "<built-in>" 3
# 349 "<built-in>" 3
# 1 "<command line>" 1
# 1 "<built-in>" 2
# 1 "__bindgen.c" 2
# 0 "/home/felix/bindgen-warning/seccomp.h"
# 1 "/usr/include/linux/audit.h" 1 3 4
/* SPDX-License-Identifier: GPL-2.0+ WITH Linux-syscall-note */
/* audit.h -- Auditing support
 *
 * Copyright 2003-2004 Red Hat Inc., Durham, North Carolina.
 * All Rights Reserved.
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation; either version 2 of the License, or
 * (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program; if not, write to the Free Software
 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
 *
 * Written by Rickard E. (Rik) Faith <faith@redhat.com>
 *
 */

# 1 "/usr/include/linux/types.h" 1 3 4
/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */

# 1 "/usr/include/x86_64-linux-gnu/asm/types.h" 1 3 4
/* SPDX-License-Identifier: GPL-2.0 */

# 1 "/usr/include/asm-generic/types.h" 1 3 4
/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */

/*
 * int-ll64 is used everywhere now.
 */

# 1 "/usr/include/asm-generic/int-ll64.h" 1 3 4
/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */
/*
 * asm-generic/int-ll64.h
 *
 * Integer declarations for architectures which use "long long"
 * for 64-bit types.
 */

# 1 "/usr/include/x86_64-linux-gnu/asm/bitsperlong.h" 1 3 4
/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */
# 11 "/usr/include/x86_64-linux-gnu/asm/bitsperlong.h" 3 4
# 1 "/usr/include/asm-generic/bitsperlong.h" 1 3 4
/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */

/*
 * There seems to be no way of detecting this automatically from user
 * space, so 64 bit architectures should override this in their
 * bitsperlong.h. In particular, an architecture that supports
 * both 32 and 64 bit user space must not rely on CONFIG_64BIT
 * to decide it, but rather check a compiler provided macro.
 */
# 12 "/usr/include/x86_64-linux-gnu/asm/bitsperlong.h" 2 3 4
# 13 "/usr/include/asm-generic/int-ll64.h" 2 3 4

/*
 * __xx is ok: it doesn't pollute the POSIX namespace. Use these in the
 * header files exported to user space
 */

typedef __signed__ char __s8;
typedef unsigned char __u8;

typedef __signed__ short __s16;
typedef unsigned short __u16;

typedef __signed__ int __s32;
typedef unsigned int __u32;

__extension__ typedef __signed__ long long __s64;
__extension__ typedef unsigned long long __u64;
# 8 "/usr/include/asm-generic/types.h" 2 3 4
# 6 "/usr/include/x86_64-linux-gnu/asm/types.h" 2 3 4
# 6 "/usr/include/linux/types.h" 2 3 4

# 1 "/usr/include/linux/posix_types.h" 1 3 4
/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */

# 1 "/usr/include/linux/stddef.h" 1 3 4
/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */
# 6 "/usr/include/linux/posix_types.h" 2 3 4

/*
 * This allows for 1024 file descriptors: if NR_OPEN is ever grown
 * beyond that you'll have to change this too. But 1024 fd's seem to be
 * enough even for such "real" unices like OSF/1, so hopefully this is
 * one limit that doesn't have to be changed [again].
 *
 * Note that POSIX wants the FD_CLEAR(fd,fdsetp) defines to be in
 * <sys/time.h> (and thus <linux/time.h>) - but this is a more logical
 * place for them. Solved by having dummy defines in <sys/time.h>.
 */

/*
 * This macro may have been defined in <gnu/types.h>. But we always
 * use the one here.
 */

typedef struct {
 unsigned long fds_bits[1024 / (8 * sizeof(long))];
} __kernel_fd_set;

/* Type of a signal handler.  */
typedef void (*__kernel_sighandler_t)(int);

/* Type of a SYSV IPC key.  */
typedef int __kernel_key_t;
typedef int __kernel_mqd_t;

# 1 "/usr/include/x86_64-linux-gnu/asm/posix_types.h" 1 3 4
/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */

# 1 "/usr/include/x86_64-linux-gnu/asm/posix_types_64.h" 1 3 4
/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */

/*
 * This file is generally used by user-level software, so you need to
 * be a little careful about namespace pollution etc.  Also, we cannot
 * assume GCC is being used.
 */

typedef unsigned short __kernel_old_uid_t;
typedef unsigned short __kernel_old_gid_t;

typedef unsigned long __kernel_old_dev_t;

# 1 "/usr/include/asm-generic/posix_types.h" 1 3 4
/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */

/*
 * This file is generally used by user-level software, so you need to
 * be a little careful about namespace pollution etc.
 *
 * First the types that are often defined in different ways across
 * architectures, so that you can override them.
 */

typedef long __kernel_long_t;
typedef unsigned long __kernel_ulong_t;

typedef __kernel_ulong_t __kernel_ino_t;

typedef unsigned int __kernel_mode_t;

typedef int __kernel_pid_t;

typedef int __kernel_ipc_pid_t;

typedef unsigned int __kernel_uid_t;
typedef unsigned int __kernel_gid_t;

typedef __kernel_long_t __kernel_suseconds_t;

typedef int __kernel_daddr_t;

typedef unsigned int __kernel_uid32_t;
typedef unsigned int __kernel_gid32_t;
# 62 "/usr/include/asm-generic/posix_types.h" 3 4
/*
 * Most 32 bit architectures use "unsigned int" size_t,
 * and all 64 bit architectures use "unsigned long" size_t.
 */

typedef __kernel_ulong_t __kernel_size_t;
typedef __kernel_long_t __kernel_ssize_t;
typedef __kernel_long_t __kernel_ptrdiff_t;

typedef struct {
 int val[2];
} __kernel_fsid_t;

/*
 * anything below here should be completely generic
 */
typedef __kernel_long_t __kernel_off_t;
typedef long long __kernel_loff_t;
typedef __kernel_long_t __kernel_time_t;
typedef long long __kernel_time64_t;
typedef __kernel_long_t __kernel_clock_t;
typedef int __kernel_timer_t;
typedef int __kernel_clockid_t;
typedef char * __kernel_caddr_t;
typedef unsigned short __kernel_uid16_t;
typedef unsigned short __kernel_gid16_t;
# 19 "/usr/include/x86_64-linux-gnu/asm/posix_types_64.h" 2 3 4
# 8 "/usr/include/x86_64-linux-gnu/asm/posix_types.h" 2 3 4
# 37 "/usr/include/linux/posix_types.h" 2 3 4
# 10 "/usr/include/linux/types.h" 2 3 4

/*
 * Below are truly Linux-specific types that should never collide with
 * any application/library that wants linux/types.h.
 */
# 24 "/usr/include/linux/types.h" 3 4
typedef __u16 __le16;
typedef __u16 __be16;
typedef __u32 __le32;
typedef __u32 __be32;
typedef __u64 __le64;
typedef __u64 __be64;

typedef __u16 __sum16;
typedef __u32 __wsum;

/*
 * aligned_u64 should be used in defining kernel<->userspace ABIs to avoid
 * common 32/64-bit compat problems.
 * 64-bit values align to 4-byte boundaries on x86_32 (and possibly other
 * architectures) and to 8-byte boundaries on 64-bit architectures.  The new
 * aligned_64 type enforces 8-byte alignment so that structs containing
 * aligned_64 values have the same alignment on 32-bit and 64-bit architectures.
 * No conversions are necessary between 32-bit user-space and a 64-bit kernel.
 */

typedef unsigned __poll_t;
# 29 "/usr/include/linux/audit.h" 2 3 4
# 1 "/usr/include/linux/elf-em.h" 1 3 4
/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */

/* These constants define the various ELF target machines */
# 15 "/usr/include/linux/elf-em.h" 3 4
    /* Next two are historical and binaries and
                   modules of these types will be rejected by
                   Linux.  */
# 47 "/usr/include/linux/elf-em.h" 3 4
/*
 * This is an interim value that we will use until the committee comes
 * up with a final number.
 */

/* Bogus old m32r magic number, used by old tools. */

/* This is the old interim value for S/390 architecture */

/* Also Panasonic/MEI MN10300, AM33 */
# 30 "/usr/include/linux/audit.h" 2 3 4

/* The netlink messages for the audit system is divided into blocks:
 * 1000 - 1099 are for commanding the audit system
 * 1100 - 1199 user space trusted application messages
 * 1200 - 1299 messages internal to the audit daemon
 * 1300 - 1399 audit event messages
 * 1400 - 1499 SE Linux use
 * 1500 - 1599 kernel LSPP events
 * 1600 - 1699 kernel crypto events
 * 1700 - 1799 kernel anomaly records
 * 1800 - 1899 kernel integrity events
 * 1900 - 1999 future kernel use
 * 2000 is for otherwise unclassified kernel audit messages (legacy)
 * 2001 - 2099 unused (kernel)
 * 2100 - 2199 user space anomaly records
 * 2200 - 2299 user space actions taken in response to anomalies
 * 2300 - 2399 user space generated LSPP events
 * 2400 - 2499 user space crypto events
 * 2500 - 2999 future user space (maybe integrity labels and related events)
 *
 * Messages from 1000-1199 are bi-directional. 1200-1299 & 2100 - 2999 are
 * exclusively user space. 1300-2099 is kernel --> user space 
 * communication.
 */
# 88 "/usr/include/linux/audit.h" 3 4
/* #define AUDIT_FS_WATCH   1301     * Deprecated */
# 155 "/usr/include/linux/audit.h" 3 4
/* Rule flags */
# 169 "/usr/include/linux/audit.h" 3 4
/* Rule actions */

/* Rule structure sizes -- if these change, different AUDIT_ADD and
 * AUDIT_LIST commands must be implemented. */
# 194 "/usr/include/linux/audit.h" 3 4
/* This bitmask is used to validate user input.  It represents all bits that
 * are currently used in an audit field constant understood by the kernel.
 * If you are adding a new #define AUDIT_<whatever>, please ensure that
 * AUDIT_UNUSED_BITS is updated if need be. */

/* AUDIT_FIELD_COMPARE rule list */
# 235 "/usr/include/linux/audit.h" 3 4
/* Rule fields */
    /* These are useful when checking the
                 * task structure at task creation time
                 * (AUDIT_PER_TASK).  */
# 267 "/usr/include/linux/audit.h" 3 4
    /* These are ONLY useful when checking
                 * at syscall exit time (AUDIT_AT_EXIT). */
# 292 "/usr/include/linux/audit.h" 3 4
/* These are the supported operators.
 *  4  2  1  8
 *  =  >  <  ?
 *  ----------
 *  0  0  0  0  00  nonsense
 *  0  0  0  1  08  &  bit mask
 *  0  0  1  0  10  <
 *  0  1  0  0  20  >
 *  0  1  1  0  30  !=
 *  1  0  0  0  40  =
 *  1  0  0  1  48  &=  bit test
 *  1  0  1  0  50  <=
 *  1  1  0  0  60  >=
 *  1  1  1  1  78  all operators
 */
# 317 "/usr/include/linux/audit.h" 3 4
enum {
 Audit_equal,
 Audit_not_equal,
 Audit_bitmask,
 Audit_bittest,
 Audit_lt,
 Audit_gt,
 Audit_le,
 Audit_ge,
 Audit_bad
};

/* Status symbols */
    /* Mask values */
# 355 "/usr/include/linux/audit.h" 3 4
/* deprecated: AUDIT_VERSION_* */

    /* Failure-to-log actions */

/*
 * These bits disambiguate different calling conventions that share an
 * ELF machine type, bitness, and endianness
 */

/* distinguish syscall tables */
# 399 "/usr/include/linux/audit.h" 3 4
/* do not define AUDIT_ARCH_PPCLE since it is not supported by audit */
# 420 "/usr/include/linux/audit.h" 3 4
/* MAX_AUDIT_MESSAGE_LENGTH is set in audit:lib/libaudit.h as:
 * 8970 // PATH_MAX*2+CONTEXT_SIZE*2+11+256+1
 * max header+body+tailer: 44 + 29 + 32 + 262 + 7 + pad
 */

/* Multicast Netlink socket groups (default up to 32) */
enum audit_nlgrps {
 AUDIT_NLGRP_NONE, /* Group 0 not used */
 AUDIT_NLGRP_READLOG, /* "best effort" read only socket */
 __AUDIT_NLGRP_MAX
};

struct audit_status {
 __u32 mask; /* Bit mask for valid entries */
 __u32 enabled; /* 1 = enabled, 0 = disabled */
 __u32 failure; /* Failure-to-log action */
 __u32 pid; /* pid of auditd process */
 __u32 rate_limit; /* messages rate limit (per second) */
 __u32 backlog_limit; /* waiting messages limit */
 __u32 lost; /* messages lost */
 __u32 backlog; /* messages waiting in queue */
 union {
  __u32 version; /* deprecated: audit api version num */
  __u32 feature_bitmap; /* bitmap of kernel audit features */
 };
 __u32 backlog_wait_time;/* message queue wait timeout */
};

struct audit_features {

 __u32 vers;
 __u32 mask; /* which bits we are dealing with */
 __u32 features; /* which feature to enable/disable */
 __u32 lock; /* which features to lock */
};
# 465 "/usr/include/linux/audit.h" 3 4
struct audit_tty_status {
 __u32 enabled; /* 1 = enabled, 0 = disabled */
 __u32 log_passwd; /* 1 = enabled, 0 = disabled */
};

/* audit_rule_data supports filter rules with both integer and string
 * fields.  It corresponds with AUDIT_ADD_RULE, AUDIT_DEL_RULE and
 * AUDIT_LIST_RULES requests.
 */
struct audit_rule_data {
 __u32 flags; /* AUDIT_PER_{TASK,CALL}, AUDIT_PREPEND */
 __u32 action; /* AUDIT_NEVER, AUDIT_POSSIBLE, AUDIT_ALWAYS */
 __u32 field_count;
 __u32 mask[64]; /* syscall(s) affected */
 __u32 fields[64];
 __u32 values[64];
 __u32 fieldflags[64];
 __u32 buflen; /* total length of string fields */
 char buf[0]; /* string fields buffer */
};
# 0 "/home/felix/bindgen-warning/seccomp.h" 2

Bindgen Invocation

    bindgen::Builder::default()
        .header_contents("seccomp.h", "#include <linux/audit.h>")
        .generate()
        .unwrap()

Actual Results

cargo test
    Blocking waiting for file lock on build directory
   Compiling bindgen-warning v0.1.0 (/home/felix/bindgen-warning)
warning: dereferencing a null pointer
   --> /home/felix/bindgen-warning/target/debug/build/bindgen-warning-869c68c8e4db5e89/out/seccomp_bindings.rs:372:19
    |
372 |         unsafe { &(*(::std::ptr::null::<__kernel_fd_set>())).fds_bits as *const _ as usize },
    |                   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ this code causes undefined behavior when executed
    |
    = note: `#[warn(deref_nullptr)]` on by default

warning: dereferencing a null pointer
   --> /home/felix/bindgen-warning/target/debug/build/bindgen-warning-869c68c8e4db5e89/out/seccomp_bindings.rs:422:19
    |
422 |         unsafe { &(*(::std::ptr::null::<__kernel_fsid_t>())).val as *const _ as usize },
    |                   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ this code causes undefined behavior when executed

warning: dereferencing a null pointer
   --> /home/felix/bindgen-warning/target/debug/build/bindgen-warning-869c68c8e4db5e89/out/seccomp_bindings.rs:499:14
    |
499 |             &(*(::std::ptr::null::<audit_status__bindgen_ty_1>())).version as *const _ as usize
    |              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ this code causes undefined behavior when executed

warning: dereferencing a null pointer
   --> /home/felix/bindgen-warning/target/debug/build/bindgen-warning-869c68c8e4db5e89/out/seccomp_bindings.rs:511:14
    |
511 |             &(*(::std::ptr::null::<audit_status__bindgen_ty_1>())).feature_bitmap as *const _
    |              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ this code causes undefined behavior when executed

warning: dereferencing a null pointer
   --> /home/felix/bindgen-warning/target/debug/build/bindgen-warning-869c68c8e4db5e89/out/seccomp_bindings.rs:536:19
    |
536 |         unsafe { &(*(::std::ptr::null::<audit_status>())).mask as *const _ as usize },
    |                   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ this code causes undefined behavior when executed

warning: dereferencing a null pointer
   --> /home/felix/bindgen-warning/target/debug/build/bindgen-warning-869c68c8e4db5e89/out/seccomp_bindings.rs:546:19
    |
546 |         unsafe { &(*(::std::ptr::null::<audit_status>())).enabled as *const _ as usize },
    |                   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ this code causes undefined behavior when executed

warning: dereferencing a null pointer
   --> /home/felix/bindgen-warning/target/debug/build/bindgen-warning-869c68c8e4db5e89/out/seccomp_bindings.rs:556:19
    |
556 |         unsafe { &(*(::std::ptr::null::<audit_status>())).failure as *const _ as usize },
    |                   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ this code causes undefined behavior when executed

warning: dereferencing a null pointer
   --> /home/felix/bindgen-warning/target/debug/build/bindgen-warning-869c68c8e4db5e89/out/seccomp_bindings.rs:566:19
    |
566 |         unsafe { &(*(::std::ptr::null::<audit_status>())).pid as *const _ as usize },
    |                   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ this code causes undefined behavior when executed

warning: dereferencing a null pointer
   --> /home/felix/bindgen-warning/target/debug/build/bindgen-warning-869c68c8e4db5e89/out/seccomp_bindings.rs:576:19
    |
576 |         unsafe { &(*(::std::ptr::null::<audit_status>())).rate_limit as *const _ as usize },
    |                   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ this code causes undefined behavior when executed

warning: dereferencing a null pointer
   --> /home/felix/bindgen-warning/target/debug/build/bindgen-warning-869c68c8e4db5e89/out/seccomp_bindings.rs:586:19
    |
586 |         unsafe { &(*(::std::ptr::null::<audit_status>())).backlog_limit as *const _ as usize },
    |                   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ this code causes undefined behavior when executed

warning: dereferencing a null pointer
   --> /home/felix/bindgen-warning/target/debug/build/bindgen-warning-869c68c8e4db5e89/out/seccomp_bindings.rs:596:19
    |
596 |         unsafe { &(*(::std::ptr::null::<audit_status>())).lost as *const _ as usize },
    |                   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ this code causes undefined behavior when executed

warning: dereferencing a null pointer
   --> /home/felix/bindgen-warning/target/debug/build/bindgen-warning-869c68c8e4db5e89/out/seccomp_bindings.rs:606:19
    |
606 |         unsafe { &(*(::std::ptr::null::<audit_status>())).backlog as *const _ as usize },
    |                   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ this code causes undefined behavior when executed

warning: dereferencing a null pointer
   --> /home/felix/bindgen-warning/target/debug/build/bindgen-warning-869c68c8e4db5e89/out/seccomp_bindings.rs:616:19
    |
616 |         unsafe { &(*(::std::ptr::null::<audit_status>())).backlog_wait_time as *const _ as usize },
    |                   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ this code causes undefined behavior when executed

warning: dereferencing a null pointer
   --> /home/felix/bindgen-warning/target/debug/build/bindgen-warning-869c68c8e4db5e89/out/seccomp_bindings.rs:647:19
    |
647 |         unsafe { &(*(::std::ptr::null::<audit_features>())).vers as *const _ as usize },
    |                   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ this code causes undefined behavior when executed

warning: dereferencing a null pointer
   --> /home/felix/bindgen-warning/target/debug/build/bindgen-warning-869c68c8e4db5e89/out/seccomp_bindings.rs:657:19
    |
657 |         unsafe { &(*(::std::ptr::null::<audit_features>())).mask as *const _ as usize },
    |                   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ this code causes undefined behavior when executed

warning: dereferencing a null pointer
   --> /home/felix/bindgen-warning/target/debug/build/bindgen-warning-869c68c8e4db5e89/out/seccomp_bindings.rs:667:19
    |
667 |         unsafe { &(*(::std::ptr::null::<audit_features>())).features as *const _ as usize },
    |                   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ this code causes undefined behavior when executed

warning: dereferencing a null pointer
   --> /home/felix/bindgen-warning/target/debug/build/bindgen-warning-869c68c8e4db5e89/out/seccomp_bindings.rs:677:19
    |
677 |         unsafe { &(*(::std::ptr::null::<audit_features>())).lock as *const _ as usize },
    |                   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ this code causes undefined behavior when executed

warning: dereferencing a null pointer
   --> /home/felix/bindgen-warning/target/debug/build/bindgen-warning-869c68c8e4db5e89/out/seccomp_bindings.rs:706:19
    |
706 |         unsafe { &(*(::std::ptr::null::<audit_tty_status>())).enabled as *const _ as usize },
    |                   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ this code causes undefined behavior when executed

warning: dereferencing a null pointer
   --> /home/felix/bindgen-warning/target/debug/build/bindgen-warning-869c68c8e4db5e89/out/seccomp_bindings.rs:716:19
    |
716 |         unsafe { &(*(::std::ptr::null::<audit_tty_status>())).log_passwd as *const _ as usize },
    |                   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ this code causes undefined behavior when executed

warning: dereferencing a null pointer
   --> /home/felix/bindgen-warning/target/debug/build/bindgen-warning-869c68c8e4db5e89/out/seccomp_bindings.rs:751:19
    |
751 |         unsafe { &(*(::std::ptr::null::<audit_rule_data>())).flags as *const _ as usize },
    |                   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ this code causes undefined behavior when executed

warning: dereferencing a null pointer
   --> /home/felix/bindgen-warning/target/debug/build/bindgen-warning-869c68c8e4db5e89/out/seccomp_bindings.rs:761:19
    |
761 |         unsafe { &(*(::std::ptr::null::<audit_rule_data>())).action as *const _ as usize },
    |                   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ this code causes undefined behavior when executed

warning: dereferencing a null pointer
   --> /home/felix/bindgen-warning/target/debug/build/bindgen-warning-869c68c8e4db5e89/out/seccomp_bindings.rs:771:19
    |
771 |         unsafe { &(*(::std::ptr::null::<audit_rule_data>())).field_count as *const _ as usize },
    |                   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ this code causes undefined behavior when executed

warning: dereferencing a null pointer
   --> /home/felix/bindgen-warning/target/debug/build/bindgen-warning-869c68c8e4db5e89/out/seccomp_bindings.rs:781:19
    |
781 |         unsafe { &(*(::std::ptr::null::<audit_rule_data>())).mask as *const _ as usize },
    |                   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ this code causes undefined behavior when executed

warning: dereferencing a null pointer
   --> /home/felix/bindgen-warning/target/debug/build/bindgen-warning-869c68c8e4db5e89/out/seccomp_bindings.rs:791:19
    |
791 |         unsafe { &(*(::std::ptr::null::<audit_rule_data>())).fields as *const _ as usize },
    |                   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ this code causes undefined behavior when executed

warning: dereferencing a null pointer
   --> /home/felix/bindgen-warning/target/debug/build/bindgen-warning-869c68c8e4db5e89/out/seccomp_bindings.rs:801:19
    |
801 |         unsafe { &(*(::std::ptr::null::<audit_rule_data>())).values as *const _ as usize },
    |                   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ this code causes undefined behavior when executed

warning: dereferencing a null pointer
   --> /home/felix/bindgen-warning/target/debug/build/bindgen-warning-869c68c8e4db5e89/out/seccomp_bindings.rs:811:19
    |
811 |         unsafe { &(*(::std::ptr::null::<audit_rule_data>())).fieldflags as *const _ as usize },
    |                   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ this code causes undefined behavior when executed

warning: dereferencing a null pointer
   --> /home/felix/bindgen-warning/target/debug/build/bindgen-warning-869c68c8e4db5e89/out/seccomp_bindings.rs:821:19
    |
821 |         unsafe { &(*(::std::ptr::null::<audit_rule_data>())).buflen as *const _ as usize },
    |                   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ this code causes undefined behavior when executed

warning: dereferencing a null pointer
   --> /home/felix/bindgen-warning/target/debug/build/bindgen-warning-869c68c8e4db5e89/out/seccomp_bindings.rs:831:19
    |
831 |         unsafe { &(*(::std::ptr::null::<audit_rule_data>())).buf as *const _ as usize },
    |                   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ this code causes undefined behavior when executed

warning: 28 warnings emitted

Generated Rust code:

/* automatically generated by rust-bindgen 0.58.1 */

#[repr(C)]
#[derive(Default)]
pub struct __IncompleteArrayField<T>(::std::marker::PhantomData<T>, [T; 0]);
impl<T> __IncompleteArrayField<T> {
    #[inline]
    pub const fn new() -> Self {
        __IncompleteArrayField(::std::marker::PhantomData, [])
    }
    #[inline]
    pub fn as_ptr(&self) -> *const T {
        self as *const _ as *const T
    }
    #[inline]
    pub fn as_mut_ptr(&mut self) -> *mut T {
        self as *mut _ as *mut T
    }
    #[inline]
    pub unsafe fn as_slice(&self, len: usize) -> &[T] {
        ::std::slice::from_raw_parts(self.as_ptr(), len)
    }
    #[inline]
    pub unsafe fn as_mut_slice(&mut self, len: usize) -> &mut [T] {
        ::std::slice::from_raw_parts_mut(self.as_mut_ptr(), len)
    }
}
impl<T> ::std::fmt::Debug for __IncompleteArrayField<T> {
    fn fmt(&self, fmt: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
        fmt.write_str("__IncompleteArrayField")
    }
}
pub const __BITS_PER_LONG: u32 = 64;
pub const __FD_SETSIZE: u32 = 1024;
pub const EM_NONE: u32 = 0;
pub const EM_M32: u32 = 1;
pub const EM_SPARC: u32 = 2;
pub const EM_386: u32 = 3;
pub const EM_68K: u32 = 4;
pub const EM_88K: u32 = 5;
pub const EM_486: u32 = 6;
pub const EM_860: u32 = 7;
pub const EM_MIPS: u32 = 8;
pub const EM_MIPS_RS3_LE: u32 = 10;
pub const EM_MIPS_RS4_BE: u32 = 10;
pub const EM_PARISC: u32 = 15;
pub const EM_SPARC32PLUS: u32 = 18;
pub const EM_PPC: u32 = 20;
pub const EM_PPC64: u32 = 21;
pub const EM_SPU: u32 = 23;
pub const EM_ARM: u32 = 40;
pub const EM_SH: u32 = 42;
pub const EM_SPARCV9: u32 = 43;
pub const EM_H8_300: u32 = 46;
pub const EM_IA_64: u32 = 50;
pub const EM_X86_64: u32 = 62;
pub const EM_S390: u32 = 22;
pub const EM_CRIS: u32 = 76;
pub const EM_M32R: u32 = 88;
pub const EM_MN10300: u32 = 89;
pub const EM_OPENRISC: u32 = 92;
pub const EM_BLACKFIN: u32 = 106;
pub const EM_ALTERA_NIOS2: u32 = 113;
pub const EM_TI_C6000: u32 = 140;
pub const EM_AARCH64: u32 = 183;
pub const EM_TILEPRO: u32 = 188;
pub const EM_MICROBLAZE: u32 = 189;
pub const EM_TILEGX: u32 = 191;
pub const EM_BPF: u32 = 247;
pub const EM_FRV: u32 = 21569;
pub const EM_ALPHA: u32 = 36902;
pub const EM_CYGNUS_M32R: u32 = 36929;
pub const EM_S390_OLD: u32 = 41872;
pub const EM_CYGNUS_MN10300: u32 = 48879;
pub const AUDIT_GET: u32 = 1000;
pub const AUDIT_SET: u32 = 1001;
pub const AUDIT_LIST: u32 = 1002;
pub const AUDIT_ADD: u32 = 1003;
pub const AUDIT_DEL: u32 = 1004;
pub const AUDIT_USER: u32 = 1005;
pub const AUDIT_LOGIN: u32 = 1006;
pub const AUDIT_WATCH_INS: u32 = 1007;
pub const AUDIT_WATCH_REM: u32 = 1008;
pub const AUDIT_WATCH_LIST: u32 = 1009;
pub const AUDIT_SIGNAL_INFO: u32 = 1010;
pub const AUDIT_ADD_RULE: u32 = 1011;
pub const AUDIT_DEL_RULE: u32 = 1012;
pub const AUDIT_LIST_RULES: u32 = 1013;
pub const AUDIT_TRIM: u32 = 1014;
pub const AUDIT_MAKE_EQUIV: u32 = 1015;
pub const AUDIT_TTY_GET: u32 = 1016;
pub const AUDIT_TTY_SET: u32 = 1017;
pub const AUDIT_SET_FEATURE: u32 = 1018;
pub const AUDIT_GET_FEATURE: u32 = 1019;
pub const AUDIT_FIRST_USER_MSG: u32 = 1100;
pub const AUDIT_USER_AVC: u32 = 1107;
pub const AUDIT_USER_TTY: u32 = 1124;
pub const AUDIT_LAST_USER_MSG: u32 = 1199;
pub const AUDIT_FIRST_USER_MSG2: u32 = 2100;
pub const AUDIT_LAST_USER_MSG2: u32 = 2999;
pub const AUDIT_DAEMON_START: u32 = 1200;
pub const AUDIT_DAEMON_END: u32 = 1201;
pub const AUDIT_DAEMON_ABORT: u32 = 1202;
pub const AUDIT_DAEMON_CONFIG: u32 = 1203;
pub const AUDIT_SYSCALL: u32 = 1300;
pub const AUDIT_PATH: u32 = 1302;
pub const AUDIT_IPC: u32 = 1303;
pub const AUDIT_SOCKETCALL: u32 = 1304;
pub const AUDIT_CONFIG_CHANGE: u32 = 1305;
pub const AUDIT_SOCKADDR: u32 = 1306;
pub const AUDIT_CWD: u32 = 1307;
pub const AUDIT_EXECVE: u32 = 1309;
pub const AUDIT_IPC_SET_PERM: u32 = 1311;
pub const AUDIT_MQ_OPEN: u32 = 1312;
pub const AUDIT_MQ_SENDRECV: u32 = 1313;
pub const AUDIT_MQ_NOTIFY: u32 = 1314;
pub const AUDIT_MQ_GETSETATTR: u32 = 1315;
pub const AUDIT_KERNEL_OTHER: u32 = 1316;
pub const AUDIT_FD_PAIR: u32 = 1317;
pub const AUDIT_OBJ_PID: u32 = 1318;
pub const AUDIT_TTY: u32 = 1319;
pub const AUDIT_EOE: u32 = 1320;
pub const AUDIT_BPRM_FCAPS: u32 = 1321;
pub const AUDIT_CAPSET: u32 = 1322;
pub const AUDIT_MMAP: u32 = 1323;
pub const AUDIT_NETFILTER_PKT: u32 = 1324;
pub const AUDIT_NETFILTER_CFG: u32 = 1325;
pub const AUDIT_SECCOMP: u32 = 1326;
pub const AUDIT_PROCTITLE: u32 = 1327;
pub const AUDIT_FEATURE_CHANGE: u32 = 1328;
pub const AUDIT_REPLACE: u32 = 1329;
pub const AUDIT_KERN_MODULE: u32 = 1330;
pub const AUDIT_FANOTIFY: u32 = 1331;
pub const AUDIT_AVC: u32 = 1400;
pub const AUDIT_SELINUX_ERR: u32 = 1401;
pub const AUDIT_AVC_PATH: u32 = 1402;
pub const AUDIT_MAC_POLICY_LOAD: u32 = 1403;
pub const AUDIT_MAC_STATUS: u32 = 1404;
pub const AUDIT_MAC_CONFIG_CHANGE: u32 = 1405;
pub const AUDIT_MAC_UNLBL_ALLOW: u32 = 1406;
pub const AUDIT_MAC_CIPSOV4_ADD: u32 = 1407;
pub const AUDIT_MAC_CIPSOV4_DEL: u32 = 1408;
pub const AUDIT_MAC_MAP_ADD: u32 = 1409;
pub const AUDIT_MAC_MAP_DEL: u32 = 1410;
pub const AUDIT_MAC_IPSEC_ADDSA: u32 = 1411;
pub const AUDIT_MAC_IPSEC_DELSA: u32 = 1412;
pub const AUDIT_MAC_IPSEC_ADDSPD: u32 = 1413;
pub const AUDIT_MAC_IPSEC_DELSPD: u32 = 1414;
pub const AUDIT_MAC_IPSEC_EVENT: u32 = 1415;
pub const AUDIT_MAC_UNLBL_STCADD: u32 = 1416;
pub const AUDIT_MAC_UNLBL_STCDEL: u32 = 1417;
pub const AUDIT_MAC_CALIPSO_ADD: u32 = 1418;
pub const AUDIT_MAC_CALIPSO_DEL: u32 = 1419;
pub const AUDIT_FIRST_KERN_ANOM_MSG: u32 = 1700;
pub const AUDIT_LAST_KERN_ANOM_MSG: u32 = 1799;
pub const AUDIT_ANOM_PROMISCUOUS: u32 = 1700;
pub const AUDIT_ANOM_ABEND: u32 = 1701;
pub const AUDIT_ANOM_LINK: u32 = 1702;
pub const AUDIT_INTEGRITY_DATA: u32 = 1800;
pub const AUDIT_INTEGRITY_METADATA: u32 = 1801;
pub const AUDIT_INTEGRITY_STATUS: u32 = 1802;
pub const AUDIT_INTEGRITY_HASH: u32 = 1803;
pub const AUDIT_INTEGRITY_PCR: u32 = 1804;
pub const AUDIT_INTEGRITY_RULE: u32 = 1805;
pub const AUDIT_INTEGRITY_EVM_XATTR: u32 = 1806;
pub const AUDIT_INTEGRITY_POLICY_RULE: u32 = 1807;
pub const AUDIT_KERNEL: u32 = 2000;
pub const AUDIT_FILTER_USER: u32 = 0;
pub const AUDIT_FILTER_TASK: u32 = 1;
pub const AUDIT_FILTER_ENTRY: u32 = 2;
pub const AUDIT_FILTER_WATCH: u32 = 3;
pub const AUDIT_FILTER_EXIT: u32 = 4;
pub const AUDIT_FILTER_EXCLUDE: u32 = 5;
pub const AUDIT_FILTER_TYPE: u32 = 5;
pub const AUDIT_FILTER_FS: u32 = 6;
pub const AUDIT_NR_FILTERS: u32 = 7;
pub const AUDIT_FILTER_PREPEND: u32 = 16;
pub const AUDIT_NEVER: u32 = 0;
pub const AUDIT_POSSIBLE: u32 = 1;
pub const AUDIT_ALWAYS: u32 = 2;
pub const AUDIT_MAX_FIELDS: u32 = 64;
pub const AUDIT_MAX_KEY_LEN: u32 = 256;
pub const AUDIT_BITMASK_SIZE: u32 = 64;
pub const AUDIT_SYSCALL_CLASSES: u32 = 16;
pub const AUDIT_CLASS_DIR_WRITE: u32 = 0;
pub const AUDIT_CLASS_DIR_WRITE_32: u32 = 1;
pub const AUDIT_CLASS_CHATTR: u32 = 2;
pub const AUDIT_CLASS_CHATTR_32: u32 = 3;
pub const AUDIT_CLASS_READ: u32 = 4;
pub const AUDIT_CLASS_READ_32: u32 = 5;
pub const AUDIT_CLASS_WRITE: u32 = 6;
pub const AUDIT_CLASS_WRITE_32: u32 = 7;
pub const AUDIT_CLASS_SIGNAL: u32 = 8;
pub const AUDIT_CLASS_SIGNAL_32: u32 = 9;
pub const AUDIT_UNUSED_BITS: u32 = 134216704;
pub const AUDIT_COMPARE_UID_TO_OBJ_UID: u32 = 1;
pub const AUDIT_COMPARE_GID_TO_OBJ_GID: u32 = 2;
pub const AUDIT_COMPARE_EUID_TO_OBJ_UID: u32 = 3;
pub const AUDIT_COMPARE_EGID_TO_OBJ_GID: u32 = 4;
pub const AUDIT_COMPARE_AUID_TO_OBJ_UID: u32 = 5;
pub const AUDIT_COMPARE_SUID_TO_OBJ_UID: u32 = 6;
pub const AUDIT_COMPARE_SGID_TO_OBJ_GID: u32 = 7;
pub const AUDIT_COMPARE_FSUID_TO_OBJ_UID: u32 = 8;
pub const AUDIT_COMPARE_FSGID_TO_OBJ_GID: u32 = 9;
pub const AUDIT_COMPARE_UID_TO_AUID: u32 = 10;
pub const AUDIT_COMPARE_UID_TO_EUID: u32 = 11;
pub const AUDIT_COMPARE_UID_TO_FSUID: u32 = 12;
pub const AUDIT_COMPARE_UID_TO_SUID: u32 = 13;
pub const AUDIT_COMPARE_AUID_TO_FSUID: u32 = 14;
pub const AUDIT_COMPARE_AUID_TO_SUID: u32 = 15;
pub const AUDIT_COMPARE_AUID_TO_EUID: u32 = 16;
pub const AUDIT_COMPARE_EUID_TO_SUID: u32 = 17;
pub const AUDIT_COMPARE_EUID_TO_FSUID: u32 = 18;
pub const AUDIT_COMPARE_SUID_TO_FSUID: u32 = 19;
pub const AUDIT_COMPARE_GID_TO_EGID: u32 = 20;
pub const AUDIT_COMPARE_GID_TO_FSGID: u32 = 21;
pub const AUDIT_COMPARE_GID_TO_SGID: u32 = 22;
pub const AUDIT_COMPARE_EGID_TO_FSGID: u32 = 23;
pub const AUDIT_COMPARE_EGID_TO_SGID: u32 = 24;
pub const AUDIT_COMPARE_SGID_TO_FSGID: u32 = 25;
pub const AUDIT_MAX_FIELD_COMPARE: u32 = 25;
pub const AUDIT_PID: u32 = 0;
pub const AUDIT_UID: u32 = 1;
pub const AUDIT_EUID: u32 = 2;
pub const AUDIT_SUID: u32 = 3;
pub const AUDIT_FSUID: u32 = 4;
pub const AUDIT_GID: u32 = 5;
pub const AUDIT_EGID: u32 = 6;
pub const AUDIT_SGID: u32 = 7;
pub const AUDIT_FSGID: u32 = 8;
pub const AUDIT_LOGINUID: u32 = 9;
pub const AUDIT_PERS: u32 = 10;
pub const AUDIT_ARCH: u32 = 11;
pub const AUDIT_MSGTYPE: u32 = 12;
pub const AUDIT_SUBJ_USER: u32 = 13;
pub const AUDIT_SUBJ_ROLE: u32 = 14;
pub const AUDIT_SUBJ_TYPE: u32 = 15;
pub const AUDIT_SUBJ_SEN: u32 = 16;
pub const AUDIT_SUBJ_CLR: u32 = 17;
pub const AUDIT_PPID: u32 = 18;
pub const AUDIT_OBJ_USER: u32 = 19;
pub const AUDIT_OBJ_ROLE: u32 = 20;
pub const AUDIT_OBJ_TYPE: u32 = 21;
pub const AUDIT_OBJ_LEV_LOW: u32 = 22;
pub const AUDIT_OBJ_LEV_HIGH: u32 = 23;
pub const AUDIT_LOGINUID_SET: u32 = 24;
pub const AUDIT_SESSIONID: u32 = 25;
pub const AUDIT_FSTYPE: u32 = 26;
pub const AUDIT_DEVMAJOR: u32 = 100;
pub const AUDIT_DEVMINOR: u32 = 101;
pub const AUDIT_INODE: u32 = 102;
pub const AUDIT_EXIT: u32 = 103;
pub const AUDIT_SUCCESS: u32 = 104;
pub const AUDIT_WATCH: u32 = 105;
pub const AUDIT_PERM: u32 = 106;
pub const AUDIT_DIR: u32 = 107;
pub const AUDIT_FILETYPE: u32 = 108;
pub const AUDIT_OBJ_UID: u32 = 109;
pub const AUDIT_OBJ_GID: u32 = 110;
pub const AUDIT_FIELD_COMPARE: u32 = 111;
pub const AUDIT_EXE: u32 = 112;
pub const AUDIT_ARG0: u32 = 200;
pub const AUDIT_ARG1: u32 = 201;
pub const AUDIT_ARG2: u32 = 202;
pub const AUDIT_ARG3: u32 = 203;
pub const AUDIT_FILTERKEY: u32 = 210;
pub const AUDIT_NEGATE: u32 = 2147483648;
pub const AUDIT_BIT_MASK: u32 = 134217728;
pub const AUDIT_LESS_THAN: u32 = 268435456;
pub const AUDIT_GREATER_THAN: u32 = 536870912;
pub const AUDIT_NOT_EQUAL: u32 = 805306368;
pub const AUDIT_EQUAL: u32 = 1073741824;
pub const AUDIT_BIT_TEST: u32 = 1207959552;
pub const AUDIT_LESS_THAN_OR_EQUAL: u32 = 1342177280;
pub const AUDIT_GREATER_THAN_OR_EQUAL: u32 = 1610612736;
pub const AUDIT_OPERATORS: u32 = 2013265920;
pub const AUDIT_STATUS_ENABLED: u32 = 1;
pub const AUDIT_STATUS_FAILURE: u32 = 2;
pub const AUDIT_STATUS_PID: u32 = 4;
pub const AUDIT_STATUS_RATE_LIMIT: u32 = 8;
pub const AUDIT_STATUS_BACKLOG_LIMIT: u32 = 16;
pub const AUDIT_STATUS_BACKLOG_WAIT_TIME: u32 = 32;
pub const AUDIT_STATUS_LOST: u32 = 64;
pub const AUDIT_FEATURE_BITMAP_BACKLOG_LIMIT: u32 = 1;
pub const AUDIT_FEATURE_BITMAP_BACKLOG_WAIT_TIME: u32 = 2;
pub const AUDIT_FEATURE_BITMAP_EXECUTABLE_PATH: u32 = 4;
pub const AUDIT_FEATURE_BITMAP_EXCLUDE_EXTEND: u32 = 8;
pub const AUDIT_FEATURE_BITMAP_SESSIONID_FILTER: u32 = 16;
pub const AUDIT_FEATURE_BITMAP_LOST_RESET: u32 = 32;
pub const AUDIT_FEATURE_BITMAP_FILTER_FS: u32 = 64;
pub const AUDIT_FEATURE_BITMAP_ALL: u32 = 127;
pub const AUDIT_VERSION_LATEST: u32 = 127;
pub const AUDIT_VERSION_BACKLOG_LIMIT: u32 = 1;
pub const AUDIT_VERSION_BACKLOG_WAIT_TIME: u32 = 2;
pub const AUDIT_FAIL_SILENT: u32 = 0;
pub const AUDIT_FAIL_PRINTK: u32 = 1;
pub const AUDIT_FAIL_PANIC: u32 = 2;
pub const __AUDIT_ARCH_CONVENTION_MASK: u32 = 805306368;
pub const __AUDIT_ARCH_CONVENTION_MIPS64_N32: u32 = 536870912;
pub const __AUDIT_ARCH_64BIT: u32 = 2147483648;
pub const __AUDIT_ARCH_LE: u32 = 1073741824;
pub const AUDIT_ARCH_AARCH64: u32 = 3221225655;
pub const AUDIT_ARCH_ALPHA: u32 = 3221262374;
pub const AUDIT_ARCH_ARM: u32 = 1073741864;
pub const AUDIT_ARCH_ARMEB: u32 = 40;
pub const AUDIT_ARCH_CRIS: u32 = 1073741900;
pub const AUDIT_ARCH_FRV: u32 = 21569;
pub const AUDIT_ARCH_I386: u32 = 1073741827;
pub const AUDIT_ARCH_IA64: u32 = 3221225522;
pub const AUDIT_ARCH_M32R: u32 = 88;
pub const AUDIT_ARCH_M68K: u32 = 4;
pub const AUDIT_ARCH_MICROBLAZE: u32 = 189;
pub const AUDIT_ARCH_MIPS: u32 = 8;
pub const AUDIT_ARCH_MIPSEL: u32 = 1073741832;
pub const AUDIT_ARCH_MIPS64: u32 = 2147483656;
pub const AUDIT_ARCH_MIPS64N32: u32 = 2684354568;
pub const AUDIT_ARCH_MIPSEL64: u32 = 3221225480;
pub const AUDIT_ARCH_MIPSEL64N32: u32 = 3758096392;
pub const AUDIT_ARCH_OPENRISC: u32 = 92;
pub const AUDIT_ARCH_PARISC: u32 = 15;
pub const AUDIT_ARCH_PARISC64: u32 = 2147483663;
pub const AUDIT_ARCH_PPC: u32 = 20;
pub const AUDIT_ARCH_PPC64: u32 = 2147483669;
pub const AUDIT_ARCH_PPC64LE: u32 = 3221225493;
pub const AUDIT_ARCH_S390: u32 = 22;
pub const AUDIT_ARCH_S390X: u32 = 2147483670;
pub const AUDIT_ARCH_SH: u32 = 42;
pub const AUDIT_ARCH_SHEL: u32 = 1073741866;
pub const AUDIT_ARCH_SH64: u32 = 2147483690;
pub const AUDIT_ARCH_SHEL64: u32 = 3221225514;
pub const AUDIT_ARCH_SPARC: u32 = 2;
pub const AUDIT_ARCH_SPARC64: u32 = 2147483691;
pub const AUDIT_ARCH_TILEGX: u32 = 3221225663;
pub const AUDIT_ARCH_TILEGX32: u32 = 1073742015;
pub const AUDIT_ARCH_TILEPRO: u32 = 1073742012;
pub const AUDIT_ARCH_X86_64: u32 = 3221225534;
pub const AUDIT_PERM_EXEC: u32 = 1;
pub const AUDIT_PERM_WRITE: u32 = 2;
pub const AUDIT_PERM_READ: u32 = 4;
pub const AUDIT_PERM_ATTR: u32 = 8;
pub const AUDIT_MESSAGE_TEXT_MAX: u32 = 8560;
pub const AUDIT_FEATURE_VERSION: u32 = 1;
pub const AUDIT_FEATURE_ONLY_UNSET_LOGINUID: u32 = 0;
pub const AUDIT_FEATURE_LOGINUID_IMMUTABLE: u32 = 1;
pub const AUDIT_LAST_FEATURE: u32 = 1;
pub type __s8 = ::std::os::raw::c_schar;
pub type __u8 = ::std::os::raw::c_uchar;
pub type __s16 = ::std::os::raw::c_short;
pub type __u16 = ::std::os::raw::c_ushort;
pub type __s32 = ::std::os::raw::c_int;
pub type __u32 = ::std::os::raw::c_uint;
pub type __s64 = ::std::os::raw::c_longlong;
pub type __u64 = ::std::os::raw::c_ulonglong;
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct __kernel_fd_set {
    pub fds_bits: [::std::os::raw::c_ulong; 16usize],
}
#[test]
fn bindgen_test_layout___kernel_fd_set() {
    assert_eq!(
        ::std::mem::size_of::<__kernel_fd_set>(),
        128usize,
        concat!("Size of: ", stringify!(__kernel_fd_set))
    );
    assert_eq!(
        ::std::mem::align_of::<__kernel_fd_set>(),
        8usize,
        concat!("Alignment of ", stringify!(__kernel_fd_set))
    );
    assert_eq!(
        unsafe { &(*(::std::ptr::null::<__kernel_fd_set>())).fds_bits as *const _ as usize },
        0usize,
        concat!(
            "Offset of field: ",
            stringify!(__kernel_fd_set),
            "::",
            stringify!(fds_bits)
        )
    );
}
pub type __kernel_sighandler_t =
    ::std::option::Option<unsafe extern "C" fn(arg1: ::std::os::raw::c_int)>;
pub type __kernel_key_t = ::std::os::raw::c_int;
pub type __kernel_mqd_t = ::std::os::raw::c_int;
pub type __kernel_old_uid_t = ::std::os::raw::c_ushort;
pub type __kernel_old_gid_t = ::std::os::raw::c_ushort;
pub type __kernel_old_dev_t = ::std::os::raw::c_ulong;
pub type __kernel_long_t = ::std::os::raw::c_long;
pub type __kernel_ulong_t = ::std::os::raw::c_ulong;
pub type __kernel_ino_t = __kernel_ulong_t;
pub type __kernel_mode_t = ::std::os::raw::c_uint;
pub type __kernel_pid_t = ::std::os::raw::c_int;
pub type __kernel_ipc_pid_t = ::std::os::raw::c_int;
pub type __kernel_uid_t = ::std::os::raw::c_uint;
pub type __kernel_gid_t = ::std::os::raw::c_uint;
pub type __kernel_suseconds_t = __kernel_long_t;
pub type __kernel_daddr_t = ::std::os::raw::c_int;
pub type __kernel_uid32_t = ::std::os::raw::c_uint;
pub type __kernel_gid32_t = ::std::os::raw::c_uint;
pub type __kernel_size_t = __kernel_ulong_t;
pub type __kernel_ssize_t = __kernel_long_t;
pub type __kernel_ptrdiff_t = __kernel_long_t;
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct __kernel_fsid_t {
    pub val: [::std::os::raw::c_int; 2usize],
}
#[test]
fn bindgen_test_layout___kernel_fsid_t() {
    assert_eq!(
        ::std::mem::size_of::<__kernel_fsid_t>(),
        8usize,
        concat!("Size of: ", stringify!(__kernel_fsid_t))
    );
    assert_eq!(
        ::std::mem::align_of::<__kernel_fsid_t>(),
        4usize,
        concat!("Alignment of ", stringify!(__kernel_fsid_t))
    );
    assert_eq!(
        unsafe { &(*(::std::ptr::null::<__kernel_fsid_t>())).val as *const _ as usize },
        0usize,
        concat!(
            "Offset of field: ",
            stringify!(__kernel_fsid_t),
            "::",
            stringify!(val)
        )
    );
}
pub type __kernel_off_t = __kernel_long_t;
pub type __kernel_loff_t = ::std::os::raw::c_longlong;
pub type __kernel_time_t = __kernel_long_t;
pub type __kernel_time64_t = ::std::os::raw::c_longlong;
pub type __kernel_clock_t = __kernel_long_t;
pub type __kernel_timer_t = ::std::os::raw::c_int;
pub type __kernel_clockid_t = ::std::os::raw::c_int;
pub type __kernel_caddr_t = *mut ::std::os::raw::c_char;
pub type __kernel_uid16_t = ::std::os::raw::c_ushort;
pub type __kernel_gid16_t = ::std::os::raw::c_ushort;
pub type __le16 = __u16;
pub type __be16 = __u16;
pub type __le32 = __u32;
pub type __be32 = __u32;
pub type __le64 = __u64;
pub type __be64 = __u64;
pub type __sum16 = __u16;
pub type __wsum = __u32;
pub type __poll_t = ::std::os::raw::c_uint;
pub const Audit_equal: ::std::os::raw::c_uint = 0;
pub const Audit_not_equal: ::std::os::raw::c_uint = 1;
pub const Audit_bitmask: ::std::os::raw::c_uint = 2;
pub const Audit_bittest: ::std::os::raw::c_uint = 3;
pub const Audit_lt: ::std::os::raw::c_uint = 4;
pub const Audit_gt: ::std::os::raw::c_uint = 5;
pub const Audit_le: ::std::os::raw::c_uint = 6;
pub const Audit_ge: ::std::os::raw::c_uint = 7;
pub const Audit_bad: ::std::os::raw::c_uint = 8;
pub type _bindgen_ty_1 = ::std::os::raw::c_uint;
pub const audit_nlgrps_AUDIT_NLGRP_NONE: audit_nlgrps = 0;
pub const audit_nlgrps_AUDIT_NLGRP_READLOG: audit_nlgrps = 1;
pub const audit_nlgrps___AUDIT_NLGRP_MAX: audit_nlgrps = 2;
pub type audit_nlgrps = ::std::os::raw::c_uint;
#[repr(C)]
#[derive(Copy, Clone)]
pub struct audit_status {
    pub mask: __u32,
    pub enabled: __u32,
    pub failure: __u32,
    pub pid: __u32,
    pub rate_limit: __u32,
    pub backlog_limit: __u32,
    pub lost: __u32,
    pub backlog: __u32,
    pub __bindgen_anon_1: audit_status__bindgen_ty_1,
    pub backlog_wait_time: __u32,
}
#[repr(C)]
#[derive(Copy, Clone)]
pub union audit_status__bindgen_ty_1 {
    pub version: __u32,
    pub feature_bitmap: __u32,
}
#[test]
fn bindgen_test_layout_audit_status__bindgen_ty_1() {
    assert_eq!(
        ::std::mem::size_of::<audit_status__bindgen_ty_1>(),
        4usize,
        concat!("Size of: ", stringify!(audit_status__bindgen_ty_1))
    );
    assert_eq!(
        ::std::mem::align_of::<audit_status__bindgen_ty_1>(),
        4usize,
        concat!("Alignment of ", stringify!(audit_status__bindgen_ty_1))
    );
    assert_eq!(
        unsafe {
            &(*(::std::ptr::null::<audit_status__bindgen_ty_1>())).version as *const _ as usize
        },
        0usize,
        concat!(
            "Offset of field: ",
            stringify!(audit_status__bindgen_ty_1),
            "::",
            stringify!(version)
        )
    );
    assert_eq!(
        unsafe {
            &(*(::std::ptr::null::<audit_status__bindgen_ty_1>())).feature_bitmap as *const _
                as usize
        },
        0usize,
        concat!(
            "Offset of field: ",
            stringify!(audit_status__bindgen_ty_1),
            "::",
            stringify!(feature_bitmap)
        )
    );
}
#[test]
fn bindgen_test_layout_audit_status() {
    assert_eq!(
        ::std::mem::size_of::<audit_status>(),
        40usize,
        concat!("Size of: ", stringify!(audit_status))
    );
    assert_eq!(
        ::std::mem::align_of::<audit_status>(),
        4usize,
        concat!("Alignment of ", stringify!(audit_status))
    );
    assert_eq!(
        unsafe { &(*(::std::ptr::null::<audit_status>())).mask as *const _ as usize },
        0usize,
        concat!(
            "Offset of field: ",
            stringify!(audit_status),
            "::",
            stringify!(mask)
        )
    );
    assert_eq!(
        unsafe { &(*(::std::ptr::null::<audit_status>())).enabled as *const _ as usize },
        4usize,
        concat!(
            "Offset of field: ",
            stringify!(audit_status),
            "::",
            stringify!(enabled)
        )
    );
    assert_eq!(
        unsafe { &(*(::std::ptr::null::<audit_status>())).failure as *const _ as usize },
        8usize,
        concat!(
            "Offset of field: ",
            stringify!(audit_status),
            "::",
            stringify!(failure)
        )
    );
    assert_eq!(
        unsafe { &(*(::std::ptr::null::<audit_status>())).pid as *const _ as usize },
        12usize,
        concat!(
            "Offset of field: ",
            stringify!(audit_status),
            "::",
            stringify!(pid)
        )
    );
    assert_eq!(
        unsafe { &(*(::std::ptr::null::<audit_status>())).rate_limit as *const _ as usize },
        16usize,
        concat!(
            "Offset of field: ",
            stringify!(audit_status),
            "::",
            stringify!(rate_limit)
        )
    );
    assert_eq!(
        unsafe { &(*(::std::ptr::null::<audit_status>())).backlog_limit as *const _ as usize },
        20usize,
        concat!(
            "Offset of field: ",
            stringify!(audit_status),
            "::",
            stringify!(backlog_limit)
        )
    );
    assert_eq!(
        unsafe { &(*(::std::ptr::null::<audit_status>())).lost as *const _ as usize },
        24usize,
        concat!(
            "Offset of field: ",
            stringify!(audit_status),
            "::",
            stringify!(lost)
        )
    );
    assert_eq!(
        unsafe { &(*(::std::ptr::null::<audit_status>())).backlog as *const _ as usize },
        28usize,
        concat!(
            "Offset of field: ",
            stringify!(audit_status),
            "::",
            stringify!(backlog)
        )
    );
    assert_eq!(
        unsafe { &(*(::std::ptr::null::<audit_status>())).backlog_wait_time as *const _ as usize },
        36usize,
        concat!(
            "Offset of field: ",
            stringify!(audit_status),
            "::",
            stringify!(backlog_wait_time)
        )
    );
}
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct audit_features {
    pub vers: __u32,
    pub mask: __u32,
    pub features: __u32,
    pub lock: __u32,
}
#[test]
fn bindgen_test_layout_audit_features() {
    assert_eq!(
        ::std::mem::size_of::<audit_features>(),
        16usize,
        concat!("Size of: ", stringify!(audit_features))
    );
    assert_eq!(
        ::std::mem::align_of::<audit_features>(),
        4usize,
        concat!("Alignment of ", stringify!(audit_features))
    );
    assert_eq!(
        unsafe { &(*(::std::ptr::null::<audit_features>())).vers as *const _ as usize },
        0usize,
        concat!(
            "Offset of field: ",
            stringify!(audit_features),
            "::",
            stringify!(vers)
        )
    );
    assert_eq!(
        unsafe { &(*(::std::ptr::null::<audit_features>())).mask as *const _ as usize },
        4usize,
        concat!(
            "Offset of field: ",
            stringify!(audit_features),
            "::",
            stringify!(mask)
        )
    );
    assert_eq!(
        unsafe { &(*(::std::ptr::null::<audit_features>())).features as *const _ as usize },
        8usize,
        concat!(
            "Offset of field: ",
            stringify!(audit_features),
            "::",
            stringify!(features)
        )
    );
    assert_eq!(
        unsafe { &(*(::std::ptr::null::<audit_features>())).lock as *const _ as usize },
        12usize,
        concat!(
            "Offset of field: ",
            stringify!(audit_features),
            "::",
            stringify!(lock)
        )
    );
}
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct audit_tty_status {
    pub enabled: __u32,
    pub log_passwd: __u32,
}
#[test]
fn bindgen_test_layout_audit_tty_status() {
    assert_eq!(
        ::std::mem::size_of::<audit_tty_status>(),
        8usize,
        concat!("Size of: ", stringify!(audit_tty_status))
    );
    assert_eq!(
        ::std::mem::align_of::<audit_tty_status>(),
        4usize,
        concat!("Alignment of ", stringify!(audit_tty_status))
    );
    assert_eq!(
        unsafe { &(*(::std::ptr::null::<audit_tty_status>())).enabled as *const _ as usize },
        0usize,
        concat!(
            "Offset of field: ",
            stringify!(audit_tty_status),
            "::",
            stringify!(enabled)
        )
    );
    assert_eq!(
        unsafe { &(*(::std::ptr::null::<audit_tty_status>())).log_passwd as *const _ as usize },
        4usize,
        concat!(
            "Offset of field: ",
            stringify!(audit_tty_status),
            "::",
            stringify!(log_passwd)
        )
    );
}
#[repr(C)]
pub struct audit_rule_data {
    pub flags: __u32,
    pub action: __u32,
    pub field_count: __u32,
    pub mask: [__u32; 64usize],
    pub fields: [__u32; 64usize],
    pub values: [__u32; 64usize],
    pub fieldflags: [__u32; 64usize],
    pub buflen: __u32,
    pub buf: __IncompleteArrayField<::std::os::raw::c_char>,
}
#[test]
fn bindgen_test_layout_audit_rule_data() {
    assert_eq!(
        ::std::mem::size_of::<audit_rule_data>(),
        1040usize,
        concat!("Size of: ", stringify!(audit_rule_data))
    );
    assert_eq!(
        ::std::mem::align_of::<audit_rule_data>(),
        4usize,
        concat!("Alignment of ", stringify!(audit_rule_data))
    );
    assert_eq!(
        unsafe { &(*(::std::ptr::null::<audit_rule_data>())).flags as *const _ as usize },
        0usize,
        concat!(
            "Offset of field: ",
            stringify!(audit_rule_data),
            "::",
            stringify!(flags)
        )
    );
    assert_eq!(
        unsafe { &(*(::std::ptr::null::<audit_rule_data>())).action as *const _ as usize },
        4usize,
        concat!(
            "Offset of field: ",
            stringify!(audit_rule_data),
            "::",
            stringify!(action)
        )
    );
    assert_eq!(
        unsafe { &(*(::std::ptr::null::<audit_rule_data>())).field_count as *const _ as usize },
        8usize,
        concat!(
            "Offset of field: ",
            stringify!(audit_rule_data),
            "::",
            stringify!(field_count)
        )
    );
    assert_eq!(
        unsafe { &(*(::std::ptr::null::<audit_rule_data>())).mask as *const _ as usize },
        12usize,
        concat!(
            "Offset of field: ",
            stringify!(audit_rule_data),
            "::",
            stringify!(mask)
        )
    );
    assert_eq!(
        unsafe { &(*(::std::ptr::null::<audit_rule_data>())).fields as *const _ as usize },
        268usize,
        concat!(
            "Offset of field: ",
            stringify!(audit_rule_data),
            "::",
            stringify!(fields)
        )
    );
    assert_eq!(
        unsafe { &(*(::std::ptr::null::<audit_rule_data>())).values as *const _ as usize },
        524usize,
        concat!(
            "Offset of field: ",
            stringify!(audit_rule_data),
            "::",
            stringify!(values)
        )
    );
    assert_eq!(
        unsafe { &(*(::std::ptr::null::<audit_rule_data>())).fieldflags as *const _ as usize },
        780usize,
        concat!(
            "Offset of field: ",
            stringify!(audit_rule_data),
            "::",
            stringify!(fieldflags)
        )
    );
    assert_eq!(
        unsafe { &(*(::std::ptr::null::<audit_rule_data>())).buflen as *const _ as usize },
        1036usize,
        concat!(
            "Offset of field: ",
            stringify!(audit_rule_data),
            "::",
            stringify!(buflen)
        )
    );
    assert_eq!(
        unsafe { &(*(::std::ptr::null::<audit_rule_data>())).buf as *const _ as usize },
        1040usize,
        concat!(
            "Offset of field: ",
            stringify!(audit_rule_data),
            "::",
            stringify!(buf)
        )
    );
}

Expected Results

No warnings upon test build.

emilio commented 3 years ago

Dupe of #1651, see there why this is tricky.