[PATCH v2 1/1] x86/elf: Add a new .note section containing Xfeatures information to x86 core files

Balasubrmanian, Vignesh vigbalas at amd.com
Tue Jul 9 15:12:19 AEST 2024


Apologies for the delay. I am sending the new version patch with below 
changes.

On 5/31/2024 4:28 PM, Borislav Petkov wrote:
> p type, size, offset and flag values for every xfeature that is present.
> + */
> +static int dump_xsave_layout_desc(struct coredump_params *cprm)
> +{
> +       int num_records = 0;
> +       int i;
> +
> +       for_each_extended_xfeature(i, fpu_kernel_cfg.max_features) {

Modifying "fpu_kernel_cfg.max_features" to "fpu_user_cfg.max_features"

Supervisor bits also set in "fpu_kernel_cfg.max_features"

(https://github.com/torvalds/linux/blob/master/arch/x86/kernel/fpu/xstate.c#L777)

> +               struct xfeat_component xc = {
> +                       .type   = i,
> +                       .size   = xstate_sizes[i],
> +                       .offset = xstate_offsets[i],
> +                       /* reserved for future use */
> +                       .flags  = 0,
> +               };
> +
> +               if (!dump_emit(cprm, &xc, sizeof(xc)))
> +                       return 0;
> +
> +               num_records++;
> +       }
> +       return num_records;
> +}
> +
> +static int get_xsave_desc_size(void)
> +{
> +       int cnt = 0;
> +       int i;
> +
changing "int" to "u32" as per review comment.
> +       for_each_extended_xfeature(i, fpu_kernel_cfg.max_features)
> +               cnt++;
> +
> +       return cnt * (sizeof(struct xfeat_component));
> +}
> +
>
> +
> +int elf_coredump_extra_notes_size(void)
> +{
> +       int size;

Adding below check, same as in "elf_coredump_extra_notes_write"

if (!fpu_user_cfg.max_features)

return 0;


thanks,
vigneshbalu.

> +       /* .note header */
> +       size  = sizeof(struct elf_note);
> +       /* name + align */
> +       size += roundup(sizeof(owner_name), 4);
> +       size += get_xsave_desc_size();
> +
>
>   #define NT_S390_TIMER  0x301           /* s390 timer register */
>   #define NT_S390_TODCMP 0x302           /* s390 TOD clock comparator register */
> --
> 2.43.0
>
>
> --
> Regards/Gruss,
>      Boris.
>
> https://people.kernel.org/tglx/notes-about-netiquette


More information about the Linuxppc-dev mailing list