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

Test ImageAddress() #579

Merged
merged 6 commits into from
Jun 23, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
8 changes: 0 additions & 8 deletions .github/workflows/pullrequest.yml
Original file line number Diff line number Diff line change
Expand Up @@ -135,10 +135,6 @@ jobs:
efiarch: x64
makearch: x86_64
distro: centos8
- arch: amd64
efiarch: x64
makearch: x86_64
distro: centos7
- arch: amd64
efiarch: ia32
makearch: ia32
Expand All @@ -155,10 +151,6 @@ jobs:
efiarch: ia32
makearch: ia32
distro: centos8
- arch: amd64
efiarch: ia32
makearch: ia32
distro: centos7

steps:
- name: Checkout
Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ Make.local
/.cache/
/certdb/
/compile_commands.json
/compile_commands.events.json
/cov-int/
/post-process-pe
/random.bin
Expand Down
10 changes: 7 additions & 3 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -38,9 +38,9 @@ CFLAGS += -DENABLE_SHIM_CERT
else
TARGETS += $(MMNAME) $(FBNAME)
endif
OBJS = shim.o globals.o mok.o netboot.o cert.o replacements.o tpm.o version.o errlog.o sbat.o sbat_data.o sbat_var.o pe.o httpboot.o csv.o load-options.o
OBJS = shim.o globals.o mok.o netboot.o cert.o replacements.o tpm.o version.o errlog.o sbat.o sbat_data.o sbat_var.o pe.o pe-relocate.o httpboot.o csv.o load-options.o
KEYS = shim_cert.h ocsp.* ca.* shim.crt shim.csr shim.p12 shim.pem shim.key shim.cer
ORIG_SOURCES = shim.c globals.c mok.c netboot.c replacements.c tpm.c errlog.c sbat.c pe.c httpboot.c shim.h version.h $(wildcard include/*.h) cert.S sbat_var.S
ORIG_SOURCES = shim.c globals.c mok.c netboot.c replacements.c tpm.c errlog.c sbat.c pe.c pe-relocate.c httpboot.c shim.h version.h $(wildcard include/*.h) cert.S sbat_var.S
MOK_OBJS = MokManager.o PasswordCrypt.o crypt_blowfish.o errlog.o sbat_data.o globals.o
ORIG_MOK_SOURCES = MokManager.c PasswordCrypt.c crypt_blowfish.c shim.h $(wildcard include/*.h)
FALLBACK_OBJS = fallback.o tpm.o errlog.o sbat_data.o globals.o
Expand Down Expand Up @@ -76,6 +76,10 @@ ifneq ($(origin EFI_PATH),undefined)
$(error EFI_PATH is no longer supported, you must build using the supplied copy of gnu-efi)
endif

compile_commands.json : Makefile Make.rules Make.defaults
make clean
bear -- make COMPILER=clang test all

update :
git submodule update --init --recursive

Expand Down Expand Up @@ -322,7 +326,7 @@ clean-lib-objs:

clean-shim-objs:
@rm -rvf $(TARGET) *.o $(SHIM_OBJS) $(MOK_OBJS) $(FALLBACK_OBJS) $(KEYS) certdb $(BOOTCSVNAME)
@rm -vf *.debug *.so *.efi *.efi.* *.tar.* version.c buildid post-process-pe
@rm -vf *.debug *.so *.efi *.efi.* *.tar.* version.c buildid post-process-pe compile_commands.json
@rm -vf Cryptlib/*.[oa] Cryptlib/*/*.[oa]
@if [ -d .git ] ; then git clean -f -d -e 'Cryptlib/OpenSSL/*'; fi

Expand Down
1 change: 1 addition & 0 deletions cert.S
Original file line number Diff line number Diff line change
Expand Up @@ -52,3 +52,4 @@ vendor_deauthorized:
#endif
.Lvendor_deauthorized_end:
.Lcert_table_end:
.section .note.GNU-stack,"a"
4 changes: 2 additions & 2 deletions include/console.h
Original file line number Diff line number Diff line change
Expand Up @@ -106,8 +106,8 @@ extern UINT32 verbose;
dprint_(L"%a:%d:%a() " fmt, __FILE__, __LINE__ - 1, __func__, \
##__VA_ARGS__)
#else
#define dprint_(...)
#define dprint(fmt, ...)
#define dprint_(...) ({ ; })
#define dprint(fmt, ...) ({ ; })
#endif

extern EFI_STATUS EFIAPI vdprint_(const CHAR16 *fmt, const char *file, int line,
Expand Down
14 changes: 14 additions & 0 deletions include/pe.h
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,20 @@ EFI_STATUS verify_image(void *data, unsigned int datasize,
EFI_STATUS
verify_sbat_section(char *SBATBase, size_t SBATSize);

EFI_STATUS
get_section_vma (UINTN section_num,
char *buffer, size_t bufsz UNUSED,
PE_COFF_LOADER_IMAGE_CONTEXT *context,
char **basep, size_t *sizep,
EFI_IMAGE_SECTION_HEADER **sectionp);

EFI_STATUS
get_section_vma_by_name (char *name, size_t namesz,
char *buffer, size_t bufsz,
PE_COFF_LOADER_IMAGE_CONTEXT *context,
char **basep, size_t *sizep,
EFI_IMAGE_SECTION_HEADER **sectionp);

EFI_STATUS
handle_image (void *data, unsigned int datasize,
EFI_LOADED_IMAGE *li,
Expand Down
3 changes: 3 additions & 0 deletions include/test.mk
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,9 @@ test-mok-mirror: CFLAGS+=-DHAVE_START_IMAGE -DHAVE_SHIM_LOCK_GUID
test-sbat_FILES = csv.c lib/variables.c lib/guid.c sbat_var.S mock-variables.c
test-sbat :: CFLAGS+=-DHAVE_GET_VARIABLE -DHAVE_GET_VARIABLE_ATTR -DHAVE_SHIM_LOCK_GUID

test-pe-relocate_FILES = globals.c
test-pe-relocate :: CFLAGS+=-DHAVE_SHIM_LOCK_GUID

test-str_FILES = lib/string.c

tests := $(patsubst %.c,%,$(wildcard test-*.c))
Expand Down
Loading