Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Qnx optee #147

Open
wants to merge 51 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
51 commits
Select commit Hold shift + click to select a range
1b07af0
Support userdata partition fast erase
GangSecurity Aug 5, 2022
cf300c8
Add interaction UI to installer application
GangSecurity Sep 6, 2022
f1692ab
Kernelflinger: Disalbe UI display function
GangSecurity Oct 13, 2021
060581c
Added Github Workflows
xshahbazintel Apr 25, 2023
49ff735
Added Github Workflows
xshahbazintel Jun 2, 2023
e9fff93
Added Github Workflows
xshahbazintel Jun 2, 2023
dedb049
Solve no enough memory for string copy issue
GangSecurity Jun 15, 2023
0dd202a
fastboot: Erase stored rollback slots when status changes.
Jun 15, 2023
f24981b
Add SBL support for kernelflinger
GangSecurity May 29, 2023
ab3447e
Revert "fastboot: Erase stored rollback slots when status changes."
qizhangz Jun 27, 2023
ffdde26
Add prebuilt kernelflinger and installer efi application for SBL
GangSecurity Jul 4, 2023
c087204
Enable TPM driver for SBL
GangSecurity Jun 24, 2023
e7f03fe
Force kernelflinger to enter into fastboot mode
GangSecurity Jul 18, 2023
21a624b
fastboot: Erase stored rollback slots when status changes.
Jul 19, 2023
fbfc111
Perform a normal flash for bootloader or bootloader_a/b partition
GangSecurity Aug 14, 2023
59d6336
Suppress logs output for user build
GangSecurity Aug 15, 2023
89107d1
Support TPM for prebuilt kernelflinger.efi and installer.efi
GangSecurity Aug 28, 2023
308faa7
Solve uefi based kernelflinger boots slow issue
GangSecurity Sep 6, 2023
2d22c65
Use get_bootdev_diskbus instead of get_diskbus
GangSecurity Sep 11, 2023
4c643ef
Add IVSHMEM support
jingdlu Oct 7, 2023
e092d7e
Update the installer and kernelflinger EFI binary
ceiba1985 Oct 11, 2023
70f59df
Support share_data fast erase and modify slot_label behavior
ceiba1985 Oct 25, 2023
72b984e
Fix installer compiling error in ivshmem
jingdlu Oct 26, 2023
7444488
Pass bootreason from SBL to kernel command line
jiaxuan-guo Oct 26, 2023
d421e5c
Support booting from device not on PCI bridge
jiaqingz-intel Oct 31, 2023
8c6b589
Let installer support 'format:f2fs'
ceiba1985 Nov 14, 2023
9087b18
Add delay back to tpm
ceiba1985 Nov 16, 2023
e44eb1d
Disable print for the prebuilt kernelflinger.efi
ceiba1985 Nov 20, 2023
a0d28ff
pass ACRN cmdline parameter from sbl to os
jiaxuan-guo Nov 23, 2023
c914c8e
Add interrupt trigger for security info passing
jingdlu Nov 9, 2023
0f4872b
Add prebuilt kernelflinger and installer images for blizzard_ivi
GangSecurity Nov 16, 2023
098e520
Fix size mismatch in snprintf for serialno, add a missing bit
jiaxuan-guo Nov 28, 2023
efd4391
OP-TEE: send root of trust via ivshmem driver to optee
syan10 Nov 28, 2023
fea4bf7
Rebase installer.efi to latest for blizzard
GangSecurity Dec 1, 2023
d92331b
Forward TPM requests to TEE via ivshmem
yang8621 Dec 5, 2023
4e7cb25
Remove bootloader partition hash calculation for SBL
GangSecurity Dec 11, 2023
ed42a73
Increase TPM pause value
GangSecurity Dec 11, 2023
8127f51
KF: update attribute for tpm index
syan10 Dec 20, 2023
a7176a0
Add a memdump function without check for NULL source to pull whole ram
jiaxuan-guo Jun 7, 2023
9600fc0
Revert "KF: update attribute for tpm index"
syan10 Dec 21, 2023
de9d15f
Forward lock-tpm2-owner cmd to TEE
yang8621 Dec 27, 2023
9a98ac1
Put diskbus to BDF convertion in a separate function
jiaqingz-intel Jan 12, 2024
07d9954
Add "secondary_diskbus" option in SBL build
jiaqingz-intel Jan 12, 2024
89973b3
Dynamically support "secondary_diskbus"
jiaqingz-intel Feb 18, 2024
d7a7776
Remove battery and charger mode check
GangSecurity Apr 10, 2024
6147946
Define interface between firmware and kernelflinger
GangSecurity Apr 12, 2024
cb36d55
Fix static scan issues for kernelflinger
xianju6x Mar 20, 2024
9dd0ac5
Pass firmware parameters to OS
GangSecurity Apr 15, 2024
a79367a
put SBL parameters to the head of commandline
Francesca0901 May 9, 2024
7a06049
Solve the 32-bit Integer Multiplication Overflow Issue
GangSecurity Jun 14, 2024
c3a0af8
Add QNX ivshmem support
ceiba1985 Jun 25, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 0 additions & 17 deletions .github/workflows/Runchecks.yaml

This file was deleted.

15 changes: 15 additions & 0 deletions .github/workflows/run_ci_checks.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
---
name: Run CI checks

on:
pull_request:
types: "**"
branches: "**"
pull_request_review:
types: "**"
branches: "**"
jobs:
TriggerWorkfows:
uses: projectceladon/celadonworkflows/.github/workflows/[email protected]
with:
EVENT: ${{ toJSON(github.event) }}
55 changes: 37 additions & 18 deletions Android.mk
Original file line number Diff line number Diff line change
Expand Up @@ -26,10 +26,18 @@ ifeq ($(TARGET_UEFI_ARCH),x86_64)
KERNELFLINGER_CFLAGS += -DARCH_X86_64=1
endif

ifeq ($(TARGET_USE_SBL),true)
KERNELFLINGER_CFLAGS += -DUSE_SBL
endif

ifeq ($(TARGET_USE_TRUSTY),true)
KERNELFLINGER_CFLAGS += -DUSE_TRUSTY
endif

ifeq ($(TARGET_USE_IVSHMEM),true)
KERNELFLINGER_CFLAGS += -DUSE_IVSHMEM
endif

ifeq ($(TARGET_USE_MULTIBOOT),true)
KERNELFLINGER_CFLAGS += -DUSE_MULTIBOOT
endif
Expand Down Expand Up @@ -90,7 +98,6 @@ ifneq ($(TARGET_BUILD_VARIANT),user)
endif

ifneq ($(strip $(KERNELFLINGER_USE_UI)),false)
KERNELFLINGER_CFLAGS += -DUSE_UI
endif

ifeq ($(KERNELFLINGER_OS_SECURE_BOOT),true)
Expand Down Expand Up @@ -281,6 +288,7 @@ LOCAL_STATIC_LIBRARIES := \
libfastboot-for-installer-$(TARGET_BUILD_VARIANT) \
libxbc-$(TARGET_BUILD_VARIANT)


ifeq ($(TARGET_USE_TPM),true)
SHARED_STATIC_LIBRARIES += libedk2_tpm
endif
Expand Down Expand Up @@ -330,7 +338,9 @@ LOCAL_GENERATED_SOURCES += $(KFINS_AVB_PK_OBJ)
LOCAL_C_INCLUDES += $(addprefix $(LOCAL_PATH)/,avb)
LOCAL_STATIC_LIBRARIES += libavb_kernelflinger-$(TARGET_BUILD_VARIANT)

ifneq ($(TARGET_USE_SBL),true)
include $(BUILD_EFI_EXECUTABLE) # For installer-$(TARGET_BUILD_VARIANT)
endif

ifeq ($(BOOTLOADER_SLOT), true)
ifeq ($(BOARD_SLOT_AB_ENABLE),true)
Expand All @@ -355,13 +365,11 @@ include $(BUILD_EFI_EXECUTABLE) # For installer-$(TARGET_BUILD_VARIANT)
endif # BOARD_SLOT_AB_ENABLE
endif # BOOTLOADER_SLOT



ifeq ($(KERNELFLINGER_SUPPORT_NON_EFI_BOOT),true)

include $(CLEAR_VARS)
LOCAL_MODULE := kf4abl-$(TARGET_BUILD_VARIANT)
LOCAL_MODULE_STEM := kf4abl
LOCAL_MODULE := kf4sbl-$(TARGET_BUILD_VARIANT)
LOCAL_MODULE_STEM := kf4sbl
LOCAL_CFLAGS := $(SHARED_CFLAGS)

ifeq ($(KERNELFLINGER_DISABLE_DEBUG_PRINT),true)
Expand All @@ -379,7 +387,8 @@ LOCAL_STATIC_LIBRARIES += \
libefiwrapper-$(TARGET_BUILD_VARIANT) \
libefiwrapper_drivers-$(TARGET_BUILD_VARIANT) \
efiwrapper-$(TARGET_BUILD_VARIANT) \
libelfloader-$(TARGET_BUILD_VARIANT)
libelfloader-$(TARGET_BUILD_VARIANT) \
libxbc-$(TARGET_BUILD_VARIANT)

ifeq ($(TARGET_USE_TRUSTY),true)
LOCAL_STATIC_LIBRARIES += libqltipc-$(TARGET_BUILD_VARIANT)
Expand All @@ -390,8 +399,13 @@ LOCAL_STATIC_LIBRARIES += libavb_kernelflinger-$(TARGET_BUILD_VARIANT)
ifneq ($(TARGET_BUILD_VARIANT),user)
LOCAL_STATIC_LIBRARIES += libadb-$(TARGET_BUILD_VARIANT)
endif
#Replace kf4sbl.c by kernelflinger.c
LOCAL_SRC_FILES := \
kf4abl.c
kernelflinger.c

ifneq ($(TARGET_BUILD_VARIANT),user)
LOCAL_SRC_FILES += unittest.c
endif

ifneq ($(strip $(KERNELFLINGER_USE_UI)),false)
LOCAL_SRC_FILES += \
Expand Down Expand Up @@ -463,16 +477,15 @@ $(ABL_AVB_PK_OBJ): $(ABL_PADDED_AVB_PK)
LOCAL_GENERATED_SOURCES += $(ABL_AVB_PK_OBJ)
LOCAL_C_INCLUDES := \
$(addprefix $(LOCAL_PATH)/,avb)

LOCAL_C_INCLUDES := \
LOCAL_C_INCLUDES += \
$(addprefix $(LOCAL_PATH)/,libkernelflinger)
LOCAL_C_INCLUDES := \
LOCAL_C_INCLUDES += \
$(addprefix $(LOCAL_PATH)/,libsslsupport)
include $(BUILD_ABL_EXECUTABLE)
include $(BUILD_SBL_EXECUTABLE)

include $(CLEAR_VARS)
LOCAL_MODULE := fb4abl-$(TARGET_BUILD_VARIANT)
LOCAL_MODULE_STEM := fb4abl
LOCAL_MODULE := fb4sbl-$(TARGET_BUILD_VARIANT)
LOCAL_MODULE_STEM := fb4sbl
LOCAL_CFLAGS := $(SHARED_CFLAGS)

LOCAL_CFLAGS += -D__FORCE_FASTBOOT
Expand All @@ -488,7 +501,8 @@ LOCAL_STATIC_LIBRARIES += \
libefiwrapper-$(TARGET_BUILD_VARIANT) \
libefiwrapper_drivers-$(TARGET_BUILD_VARIANT) \
efiwrapper-$(TARGET_BUILD_VARIANT) \
libelfloader-$(TARGET_BUILD_VARIANT)
libelfloader-$(TARGET_BUILD_VARIANT) \
libxbc-$(TARGET_BUILD_VARIANT)

ifeq ($(TARGET_USE_TRUSTY),true)
LOCAL_STATIC_LIBRARIES += libqltipc-$(TARGET_BUILD_VARIANT)
Expand All @@ -498,26 +512,31 @@ ifneq ($(TARGET_BUILD_VARIANT),user)
LOCAL_STATIC_LIBRARIES += libadb-$(TARGET_BUILD_VARIANT)
endif
LOCAL_STATIC_LIBRARIES += libavb_kernelflinger-$(TARGET_BUILD_VARIANT)
#reuse kernelflinger.c
LOCAL_SRC_FILES := \
kf4abl.c
kernelflinger.c

ifneq ($(strip $(KERNELFLINGER_USE_UI)),false)
LOCAL_SRC_FILES += \
ux.c
endif

ifneq ($(TARGET_BUILD_VARIANT),user)
LOCAL_SRC_FILES += unittest.c
endif

ifeq ($(PRODUCT_SUPPORTS_VERITY),true)
LOCAL_GENERATED_SOURCES := $(ABL_OEMCERT_OBJ)
endif

LOCAL_GENERATED_SOURCES += $(ABL_AVB_PK_OBJ)
LOCAL_C_INCLUDES := \
$(addprefix $(LOCAL_PATH)/,avb)
LOCAL_C_INCLUDES := \
LOCAL_C_INCLUDES += \
$(addprefix $(LOCAL_PATH)/,libkernelflinger)
LOCAL_C_INCLUDES := \
LOCAL_C_INCLUDES += \
$(addprefix $(LOCAL_PATH)/,libsslsupport)
include $(BUILD_ABL_EXECUTABLE)
include $(BUILD_SBL_EXECUTABLE)

endif #KERNELFLINGER_SUPPORT_NON_EFI_BOOT

Expand Down
5 changes: 3 additions & 2 deletions avb/Android.mk
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,9 @@ LOCAL_EXPORT_C_INCLUDE_DIRS := $(KERNELFLINGER_LOCAL_PATH)/include
LOCAL_CFLAGS := $(avb_common_cflags) -DAVB_COMPILATION -Wno-error -DAVB_AB_I_UNDERSTAND_LIBAVB_AB_IS_DEPRECATED

ifneq ($(KERNELFLINGER_DISABLE_DEBUG_PRINT),true)
LOCAL_CFLAGS += -DAVB_ENABLE_DEBUG
ifeq ($(TARGET_BUILD_VARIANT),userdebug)
LOCAL_CFLAGS += -DAVB_ENABLE_DEBUG
endif
endif

ifeq ($(TARGET_USE_TPM),true)
Expand All @@ -68,7 +70,6 @@ LOCAL_STATIC_LIBRARIES := \
libkernelflinger-$(TARGET_BUILD_VARIANT)

ifneq ($(strip $(KERNELFLINGER_USE_UI)),false)
LOCAL_CFLAGS += -DUSE_UI
endif

LOCAL_SRC_FILES := \
Expand Down
4 changes: 4 additions & 0 deletions avb/libavb/avb_slot_verify.c
Original file line number Diff line number Diff line change
Expand Up @@ -905,6 +905,10 @@ static AvbSlotVerifyResult load_and_verify_vbmeta(
*/
descriptors =
avb_descriptor_get_all(vbmeta_buf, vbmeta_num_read, &num_descriptors);
if (!descriptors) {
ret = AVB_SLOT_VERIFY_RESULT_ERROR_OOM;
goto out;
}
for (n = 0; n < num_descriptors; n++) {
AvbDescriptor desc;

Expand Down
5 changes: 5 additions & 0 deletions avb/libavb/avb_util.h
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,7 @@ extern "C" {
/* Prints out a message. This is typically used if a runtime-error
* occurs.
*/
#ifdef AVB_ENABLE_DEBUG
#define avb_error(message) \
do { \
avb_printv(avb_basename(__FILE__), \
Expand All @@ -126,6 +127,10 @@ extern "C" {
avb_printv_ui(message, \
##__VA_ARGS__); \
} while (0)
#else
#define avb_error(message)
#define avb_errorv(message, ...)
#endif

/* Prints out a message and calls avb_abort().
*/
Expand Down
51 changes: 39 additions & 12 deletions avb/libavb_user/uefi_avb_ops.c
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ static AvbIOResult read_from_partition(__attribute__((unused)) AvbOps* ops,
size_t num_bytes,
void* buf,
size_t* out_num_read) {
AvbIOResult ret;
EFI_STATUS efi_ret;
struct gpt_partition_interface gpart;
int64_t partition_size;
Expand All @@ -65,7 +66,8 @@ static AvbIOResult read_from_partition(__attribute__((unused)) AvbOps* ops,
efi_ret = gpt_get_partition_by_label(label, &gpart, LOGICAL_UNIT_USER);
if (EFI_ERROR(efi_ret)) {
error(L"Partition %s not found", label);
return AVB_IO_RESULT_ERROR_NO_SUCH_PARTITION;
ret = AVB_IO_RESULT_ERROR_NO_SUCH_PARTITION;
goto failed;
}

partition_size =
Expand All @@ -75,7 +77,8 @@ static AvbIOResult read_from_partition(__attribute__((unused)) AvbOps* ops,
if (offset_from_partition < 0) {
if ((-offset_from_partition) > partition_size) {
avb_error("Offset outside range.\n");
return AVB_IO_RESULT_ERROR_RANGE_OUTSIDE_PARTITION;
ret = AVB_IO_RESULT_ERROR_RANGE_OUTSIDE_PARTITION;
goto failed;
}
offset_from_partition = partition_size - (-offset_from_partition);
}
Expand All @@ -100,17 +103,23 @@ static AvbIOResult read_from_partition(__attribute__((unused)) AvbOps* ops,
if (EFI_ERROR(efi_ret)) {
avb_error("Could not read from Disk.\n");
*out_num_read = 0;
return AVB_IO_RESULT_ERROR_IO;
ret = AVB_IO_RESULT_ERROR_IO;
goto failed;
}

FreePool((VOID *)label);
return AVB_IO_RESULT_OK;

failed:
FreePool((VOID *)label);
return ret;
}

static AvbIOResult write_to_partition(__attribute__((unused)) AvbOps* ops,
const char* partition_name,
int64_t offset_from_partition,
size_t num_bytes,
const void* buf) {
AvbIOResult ret;
EFI_STATUS efi_ret;
struct gpt_partition_interface gpart;
uint64_t partition_size;
Expand All @@ -128,7 +137,8 @@ static AvbIOResult write_to_partition(__attribute__((unused)) AvbOps* ops,
efi_ret = gpt_get_partition_by_label(label, &gpart, LOGICAL_UNIT_USER);
if (EFI_ERROR(efi_ret)) {
error(L"Partition %s not found", label);
return AVB_IO_RESULT_ERROR_NO_SUCH_PARTITION;
ret = AVB_IO_RESULT_ERROR_NO_SUCH_PARTITION;
goto failed;
}

partition_size =
Expand All @@ -138,7 +148,8 @@ static AvbIOResult write_to_partition(__attribute__((unused)) AvbOps* ops,
if (offset_from_partition < 0) {
if ((-offset_from_partition) > (int)partition_size) {
avb_error("Offset outside range.\n");
return AVB_IO_RESULT_ERROR_RANGE_OUTSIDE_PARTITION;
ret = AVB_IO_RESULT_ERROR_RANGE_OUTSIDE_PARTITION;
goto failed;
}
offset_from_partition = partition_size - (-offset_from_partition);
}
Expand All @@ -148,7 +159,8 @@ static AvbIOResult write_to_partition(__attribute__((unused)) AvbOps* ops,
*/
if (num_bytes > partition_size - offset_from_partition) {
avb_error("Cannot write beyond partition boundary.\n");
return AVB_IO_RESULT_ERROR_RANGE_OUTSIDE_PARTITION;
ret = AVB_IO_RESULT_ERROR_RANGE_OUTSIDE_PARTITION;
goto failed;
}

efi_ret = uefi_call_wrapper(
Expand All @@ -163,10 +175,15 @@ static AvbIOResult write_to_partition(__attribute__((unused)) AvbOps* ops,

if (EFI_ERROR(efi_ret)) {
avb_error("Could not write to Disk.\n");
return AVB_IO_RESULT_ERROR_IO;
ret = AVB_IO_RESULT_ERROR_IO;
goto failed;
}

FreePool((VOID *)label);
return AVB_IO_RESULT_OK;

failed:
FreePool((VOID *)label);
return ret;
}

static AvbIOResult get_size_of_partition(__attribute__((unused)) AvbOps* ops,
Expand All @@ -188,6 +205,7 @@ static AvbIOResult get_size_of_partition(__attribute__((unused)) AvbOps* ops,
efi_ret = gpt_get_partition_by_label(label, &gpart, LOGICAL_UNIT_USER);
if (EFI_ERROR(efi_ret)) {
error(L"Partition %s not found", label);
FreePool((VOID *)label);
return AVB_IO_RESULT_ERROR_NO_SUCH_PARTITION;
}

Expand All @@ -198,7 +216,7 @@ static AvbIOResult get_size_of_partition(__attribute__((unused)) AvbOps* ops,
if (out_size != NULL) {
*out_size = partition_size;
}

FreePool((VOID *)label);
return AVB_IO_RESULT_OK;
}

Expand Down Expand Up @@ -299,6 +317,7 @@ static AvbIOResult get_unique_guid_for_partition(__attribute__((unused)) AvbOps*
const char* partition,
char* guid_buf,
size_t guid_buf_size) {
AvbIOResult ret;
EFI_STATUS efi_ret;
struct gpt_partition_interface gpart;
uint8_t * unique_guid;
Expand All @@ -318,12 +337,14 @@ static AvbIOResult get_unique_guid_for_partition(__attribute__((unused)) AvbOps*
efi_ret = gpt_get_partition_by_label(label, &gpart, LOGICAL_UNIT_USER);
if (EFI_ERROR(efi_ret)) {
error(L"Partition %s not found", label);
return AVB_IO_RESULT_ERROR_IO;
ret = AVB_IO_RESULT_ERROR_IO;
goto failed;
}

if (guid_buf_size < 37) {
avb_error("GUID buffer size too small.\n");
return AVB_IO_RESULT_ERROR_IO;
ret = AVB_IO_RESULT_ERROR_IO;
goto failed;
}

unique_guid =(uint8_t *)&(gpart.part.unique);
Expand Down Expand Up @@ -351,7 +372,13 @@ static AvbIOResult get_unique_guid_for_partition(__attribute__((unused)) AvbOps*
set_hex(guid_buf + 32, unique_guid[14]);
set_hex(guid_buf + 34, unique_guid[15]);
guid_buf[36] = '\0';

FreePool((VOID *)label);
return AVB_IO_RESULT_OK;

failed:
FreePool((VOID *)label);
return ret;
}

AvbOps* uefi_avb_ops_new(void) {
Expand Down
Loading
Loading