Re: [PATCH v2 01/12] xen/trace: Don't over-read trace objects

2021-12-03 Thread Andrew Cooper
On 30/09/2021 09:07, Dario Faggioli wrote: > On Mon, 2021-09-27 at 09:51 +0200, Jan Beulich wrote: >> On 24.09.2021 16:51, Dario Faggioli wrote: >>> On Mon, 2021-09-20 at 18:25 +0100, Andrew Cooper wrote: >>> There is one buggy race record, TRC_RTDS_BUDGET_BURN.  As it must remain __

Re: [PATCH v2 01/12] xen/trace: Don't over-read trace objects

2021-09-30 Thread Dario Faggioli
On Mon, 2021-09-27 at 09:51 +0200, Jan Beulich wrote: > On 24.09.2021 16:51, Dario Faggioli wrote: > > On Mon, 2021-09-20 at 18:25 +0100, Andrew Cooper wrote: > > > > > There is one buggy race record, TRC_RTDS_BUDGET_BURN.  As it must > > > remain > > > __packed (as cur_budget is misaligned), chan

Re: [PATCH v2 01/12] xen/trace: Don't over-read trace objects

2021-09-27 Thread Jan Beulich
On 24.09.2021 16:51, Dario Faggioli wrote: > On Mon, 2021-09-20 at 18:25 +0100, Andrew Cooper wrote: > >> There is one buggy race record, TRC_RTDS_BUDGET_BURN.  As it must >> remain >> __packed (as cur_budget is misaligned), change bool has_extratime to >> uint32_t >> to compensate. >> > Mmm... ma

Re: [PATCH v2 01/12] xen/trace: Don't over-read trace objects

2021-09-24 Thread Dario Faggioli
On Mon, 2021-09-20 at 18:25 +0100, Andrew Cooper wrote: > There is one buggy race record, TRC_RTDS_BUDGET_BURN.  As it must > remain > __packed (as cur_budget is misaligned), change bool has_extratime to > uint32_t > to compensate. > Mmm... maybe my understanding of data alignment inside structs

Re: [PATCH v2 01/12] xen/trace: Don't over-read trace objects

2021-09-24 Thread Dario Faggioli
On Wed, 2021-09-22 at 13:58 +0100, Andrew Cooper wrote: > On 22/09/2021 08:01, Jan Beulich wrote: > > > > > Agreed. Whether the truncation is an issue in practice is > > questionable, > > as I wouldn't expect budget to be consumed in multiple-second > > individual > > steps. But I didn't check wh

Re: [PATCH v2 01/12] xen/trace: Don't over-read trace objects

2021-09-22 Thread Jan Beulich
On 22.09.2021 14:58, Andrew Cooper wrote: > On 22/09/2021 08:01, Jan Beulich wrote: >> On 21.09.2021 19:51, Andrew Cooper wrote: >>> On 21/09/2021 07:53, Jan Beulich wrote: On 20.09.2021 19:25, Andrew Cooper wrote: > --- a/xen/arch/x86/hvm/hvm.c > +++ b/xen/arch/x86/hvm/hvm.c > @@

Re: [PATCH v2 01/12] xen/trace: Don't over-read trace objects

2021-09-22 Thread Andrew Cooper
On 22/09/2021 08:01, Jan Beulich wrote: > On 21.09.2021 19:51, Andrew Cooper wrote: >> On 21/09/2021 07:53, Jan Beulich wrote: >>> On 20.09.2021 19:25, Andrew Cooper wrote: --- a/xen/arch/x86/hvm/hvm.c +++ b/xen/arch/x86/hvm/hvm.c @@ -5063,8 +5063,9 @@ long do_hvm_op(unsigned long op

Re: [PATCH v2 01/12] xen/trace: Don't over-read trace objects

2021-09-22 Thread Jan Beulich
On 21.09.2021 19:51, Andrew Cooper wrote: > On 21/09/2021 07:53, Jan Beulich wrote: >> On 20.09.2021 19:25, Andrew Cooper wrote: >>> --- a/xen/arch/x86/hvm/hvm.c >>> +++ b/xen/arch/x86/hvm/hvm.c >>> @@ -5063,8 +5063,9 @@ long do_hvm_op(unsigned long op, >>> XEN_GUEST_HANDLE_PARAM(void) arg) >>>

Re: [PATCH v2 01/12] xen/trace: Don't over-read trace objects

2021-09-21 Thread Andrew Cooper
On 21/09/2021 07:53, Jan Beulich wrote: > On 20.09.2021 19:25, Andrew Cooper wrote: >> In the case that 'extra' isn't a multiple of uint32_t, the calculation rounds >> the number of bytes up, causing later logic to read unrelated bytes beyond >> the >> end of the object. >> >> Also, asserting that

Re: [PATCH v2 01/12] xen/trace: Don't over-read trace objects

2021-09-20 Thread Jan Beulich
On 20.09.2021 19:25, Andrew Cooper wrote: > In the case that 'extra' isn't a multiple of uint32_t, the calculation rounds > the number of bytes up, causing later logic to read unrelated bytes beyond the > end of the object. > > Also, asserting that the object is within TRACE_EXTRA_MAX, but truncat

[PATCH v2 01/12] xen/trace: Don't over-read trace objects

2021-09-20 Thread Andrew Cooper
In the case that 'extra' isn't a multiple of uint32_t, the calculation rounds the number of bytes up, causing later logic to read unrelated bytes beyond the end of the object. Also, asserting that the object is within TRACE_EXTRA_MAX, but truncating it in release builds is rude. Instead, reject a