Go to file
Tianjia Zhang 440a707701 selftests/sgx: Fix Q1 and Q2 calculation in sigstruct.c
commit 567c39047d upstream.

Q1 and Q2 are numbers with *maximum* length of 384 bytes. If the
calculated length of Q1 and Q2 is less than 384 bytes, things will
go wrong.

E.g. if Q2 is 383 bytes, then

1. The bytes of q2 are copied to sigstruct->q2 in calc_q1q2().
2. The entire sigstruct->q2 is reversed, which results it being
   256 * Q2, given that the last byte of sigstruct->q2 is added
   to before the bytes given by calc_q1q2().

Either change in key or measurement can trigger the bug. E.g. an
unmeasured heap could cause a devastating change in Q1 or Q2.

Reverse exactly the bytes of Q1 and Q2 in calc_q1q2() before returning
to the caller.

Intel-SIG: commit 567c39047d selftests/sgx: Fix Q1 and Q2 calculation
in sigstruct.c
Backport for SGX virtualization support on Intel Xeon platform.

Fixes: 2adcba79e6 ("selftests/x86: Add a selftest for SGX")
Link: https://lore.kernel.org/linux-sgx/20210301051836.30738-1-tianjia.zhang@linux.alibaba.com/
Signed-off-by: Tianjia Zhang <tianjia.zhang@linux.alibaba.com>
Signed-off-by: Jarkko Sakkinen <jarkko@kernel.org>
Signed-off-by: Shuah Khan <skhan@linuxfoundation.org>
[ Zhiquan Li: amend commit log ]
Signed-off-by: Zhiquan Li <zhiquan1.li@intel.com>
2024-06-11 21:23:47 +08:00
Documentation kselftest: add fixture variants 2024-06-11 21:23:40 +08:00
LICENSES LICENSES: Rename other to deprecated 2019-05-03 06:34:32 -06:00
arch x86/sgx: Expose SGX architectural definitions to the kernel 2024-06-11 21:23:44 +08:00
block ock: sync codes to ock 5.4.119-20.0009.21 2024-06-11 20:27:38 +08:00
certs ock: sync codes to ock 5.4.119-20.0009.21 2024-06-11 20:27:38 +08:00
crypto ock: sync codes to ock 5.4.119-20.0009.21 2024-06-11 20:27:38 +08:00
dist dist: remove leds from filter out directory 2024-06-11 21:23:35 +08:00
drivers ACPI: NUMA: Up-level "map to online node" functionality 2024-06-11 21:23:37 +08:00
fs mm, memcg: rework remote charging API to support nesting 2024-06-11 21:23:42 +08:00
include mm, memcg: rework remote charging API to support nesting 2024-06-11 21:23:42 +08:00
init irqlatency: add irq latency monitor support 2024-06-11 21:18:47 +08:00
ipc ock: sync codes to ock 5.4.119-20.0009.21 2024-06-11 20:27:38 +08:00
kernel irqlatency: add irq latency monitor support 2024-06-11 21:18:47 +08:00
lib lib: Uplevel the pmem "region" ida to a global allocator 2024-06-11 21:18:38 +08:00
mm x86/mm: Introduce CONFIG_NUMA_KEEP_MEMINFO 2024-06-11 21:23:38 +08:00
net ock: sync codes to ock 5.4.119-20.0009.21 2024-06-11 20:27:38 +08:00
package iommu/vt-d: Retain PASID entry if guest switched remapping mode 2024-06-11 21:18:02 +08:00
samples vfio/mbochs: Fix close when multiple device FDs are open 2024-06-11 21:15:41 +08:00
scripts PCI / VFIO: Add 'override_only' support for VFIO PCI sub system 2024-06-11 21:15:47 +08:00
security ock: sync codes to ock 5.4.119-20.0009.21 2024-06-11 20:27:38 +08:00
sound I2S driver support for Phytium CPUs 2024-06-11 21:23:34 +08:00
tools selftests/sgx: Fix Q1 and Q2 calculation in sigstruct.c 2024-06-11 21:23:47 +08:00
usr tkernel: add base tlinux kernel interfaces 2024-06-11 20:09:33 +08:00
virt kvm: rename KVM_MAX_VCPU_ID to KVM_MAX_VCPU_IDS 2024-06-11 21:17:35 +08:00
.clang-format clang-format: Update with the latest for_each macro list 2019-08-31 10:00:51 +02:00
.cocciconfig
.get_maintainer.ignore Opt out of scripts/get_maintainer.pl 2019-05-16 10:53:40 -07:00
.gitattributes ock: sync codes to ock 5.4.119-20.0009.21 2024-06-11 20:27:38 +08:00
.gitignore ock: sync codes to ock 5.4.119-20.0009.21 2024-06-11 20:27:38 +08:00
COPYING COPYING: use the new text with points to the license files 2018-03-23 12:41:45 -06:00
CREDITS MAINTAINERS: Remove Simon as Renesas SoC Co-Maintainer 2019-10-10 08:12:51 -07:00
Kbuild kbuild: do not descend to ./Kbuild when cleaning 2019-08-21 21:03:58 +09:00
Kconfig docs: kbuild: convert docs to ReST and rename to *.rst 2019-06-14 14:21:21 -06:00
MAINTAINERS x86/sgx: Expose SGX architectural definitions to the kernel 2024-06-11 21:23:44 +08:00
Makefile ock: sync codes to ock 5.4.119-20.0009.21 2024-06-11 20:27:38 +08:00
README Drop all 00-INDEX files from Documentation/ 2018-09-09 15:08:58 -06:00
README.md tkernel: add base tlinux kernel interfaces 2024-06-11 20:09:33 +08:00
backport_remove_lists.txt tkernel: add base tlinux kernel interfaces 2024-06-11 20:09:33 +08:00
tools_key.pub tkernel: add base tlinux kernel interfaces 2024-06-11 20:09:33 +08:00

README.md

Tencent Linux Kernel 4.0