Re: [PATCH v3 1/5] KVM: stats: Support linear and logarithmic histogram statistics

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 02/08/21 18:56, Jing Zhang wrote:
+	index = array_index_nospec(index, size);
+	++data[index];

This would have to use

	index = min(index, size-1);
	index = array_index_nospec(index, size);

But thinking more about it there should be no way to do *two* consecutive accesses. Thus, it would be possible to bring an out of bounds element of data[] in the cache, but it would not be possible to deduce its value.

This might have to be taken into account when adding more statistics, but for now I've simply replaced array_index_nospec with the min() above.

Paolo




[Index of Archives]     [KVM Development]     [KVM ARM]     [KVM ia64]     [Linux Virtualization]     [Linux USB Devel]     [Linux Video]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [Big List of Linux Books]

  Powered by Linux