[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH v4] hw/i386: pass RNG seed via setup_data entry
From: |
Jason A. Donenfeld |
Subject: |
Re: [PATCH v4] hw/i386: pass RNG seed via setup_data entry |
Date: |
Thu, 21 Jul 2022 12:42:27 +0200 |
Hi Michael,
Thanks for the feedback.
On Thu, Jul 21, 2022 at 06:35:41AM -0400, Michael S. Tsirkin wrote:
> > - setup_data->next = 0;
> > + setup_data->next = last_setup_data_offset;
>
> does this make any difference? if the idea is that we'll add more stuff
> down the road, then see below ...
It doesn't; it's just for completeness, in case somebody decides to add
something prior, and then less code has to change and there's less
chance of an error. The compiler generates the same code either way.
>
> > setup_data->type = cpu_to_le32(SETUP_DTB);
> > setup_data->len = cpu_to_le32(dtb_size);
> >
> > load_image_size(dtb_filename, setup_data->data, dtb_size);
> > +
> > + last_setup_data_offset = prot_addr + setup_data_offset;
>
>
> if the idea is that we'll add more stuff down the road, then
> it should be += here.
It's just poorly named actually. It should be called
"prev_setup_data_prot_addr" or something. I'll find a better name for
v+1.
>
> > }
> >
> > + setup_data_offset = QEMU_ALIGN_UP(kernel_size, 16);
> > + kernel_size = setup_data_offset + sizeof(struct setup_data) + 32;
> > + kernel = g_realloc(kernel, kernel_size);
> > + setup_data = (struct setup_data *)(kernel + setup_data_offset);
> > + setup_data->next = last_setup_data_offset;
>
> Likely broken on LE.
Nice catch, thanks.
>
> > + setup_data->type = cpu_to_le32(SETUP_RNG_SEED);
> > + setup_data->len = cpu_to_le32(32);
> > + qemu_guest_getrandom_nofail(setup_data->data, 32);
> > +
> > + last_setup_data_offset = prot_addr + setup_data_offset;
>
>
> where does this 32 come from? maybe make it a macro.
Will do.
>
> > +
> > + stq_p(header + 0x250, last_setup_data_offset);
>
> add a comment while we are at it?
Ack.
Jason
- [PATCH v3] hw/i386: pass RNG seed via setup_data entry, Jason A. Donenfeld, 2022/07/11
- [PATCH resend v3] hw/i386: pass RNG seed via setup_data entry, Jason A. Donenfeld, 2022/07/19
- Re: [PATCH resend v3] hw/i386: pass RNG seed via setup_data entry, Jason A. Donenfeld, 2022/07/20
- Re: [PATCH resend v3] hw/i386: pass RNG seed via setup_data entry, Paolo Bonzini, 2022/07/21
- Re: [PATCH resend v3] hw/i386: pass RNG seed via setup_data entry, Jason A. Donenfeld, 2022/07/21
- Re: [PATCH resend v3] hw/i386: pass RNG seed via setup_data entry, Jason A. Donenfeld, 2022/07/21
- [PATCH v4] hw/i386: pass RNG seed via setup_data entry, Jason A. Donenfeld, 2022/07/21
- Re: [PATCH v4] hw/i386: pass RNG seed via setup_data entry, Michael S. Tsirkin, 2022/07/21
- Re: [PATCH v4] hw/i386: pass RNG seed via setup_data entry,
Jason A. Donenfeld <=
- [PATCH v5] hw/i386: pass RNG seed via setup_data entry, Jason A. Donenfeld, 2022/07/21
- [PATCH v6] hw/i386: pass RNG seed via setup_data entry, Jason A. Donenfeld, 2022/07/21
- Re: [PATCH v6] hw/i386: pass RNG seed via setup_data entry, Michael S. Tsirkin, 2022/07/21
- Re: [PATCH v6] hw/i386: pass RNG seed via setup_data entry, Jason A. Donenfeld, 2022/07/21
- Re: [PATCH v6] hw/i386: pass RNG seed via setup_data entry, Paolo Bonzini, 2022/07/21
- Re: [PATCH v6] hw/i386: pass RNG seed via setup_data entry, Jason A. Donenfeld, 2022/07/21
- Re: [PATCH v6] hw/i386: pass RNG seed via setup_data entry, Daniel P . Berrangé, 2022/07/21
- Re: [PATCH v6] hw/i386: pass RNG seed via setup_data entry, Paolo Bonzini, 2022/07/21
- Re: [PATCH v6] hw/i386: pass RNG seed via setup_data entry, Jason A. Donenfeld, 2022/07/21
- [PATCH v7] hw/i386: pass RNG seed via setup_data entry, Jason A. Donenfeld, 2022/07/21