On Wed, Apr 29, 2026 at 01:29:18PM -0600, Gustavo A. R. Silva wrote:

> +     /*
> +      * Intel LBR bits
> +      */
> +     int                             lbr_users;
> +     int                             lbr_pebs_users;
> +     union {
> +             struct er_account               *lbr_sel;
> +             struct er_account               *lbr_ctl;
> +     };
> +     u64                             br_sel;
> +     void                            *last_task_ctx;
> +     int                             last_log_id;
> +     int                             lbr_select;
> +     void                            *lbr_xsave;
> +
> +     /* Must be last as it ends in a flexible-array member. */
> +     TRAILING_OVERLAP(struct perf_branch_stack, lbr_stack, entries,
> +             struct perf_branch_entry        lbr_entries[MAX_LBR_ENTRIES];
> +             u64                             lbr_counters[MAX_LBR_ENTRIES]; 
> /* branch stack extra */
> +     );

FWIW, this thing is horrible crap. Per construction this thing does not
need to be last at all, you can have multiple such constructs in a
single structure and things would be perfectly fine.

Also, your TRAILING_OVERLAP() thing should probably have
__no_randomize_layout in ATTRS, rather than empty (and I'm assuming
__packed implies __no_randomized_layout, otherwise 'fun' things can
happen).

>  };

Reply via email to