diff options
| author | Nguyễn Gia Phong <cnx@loang.net> | 2025-01-14 17:12:42 +0900 |
|---|---|---|
| committer | Nguyễn Gia Phong <cnx@loang.net> | 2025-01-14 23:32:35 +0900 |
| commit | 910d416135b15a56e01209c87be4b03f16c1e77c (patch) | |
| tree | 4cf7d80a8af3db92888c475e49bedf23a849d2e9 | |
| parent | d533ad582e38aaf4fe6f50e864f4e6999ec943a5 (diff) | |
| download | loftix-910d416135b15a56e01209c87be4b03f16c1e77c.tar.gz | |
Update E9Patch
| -rw-r--r-- | loftix/patching.scm | 6 | ||||
| -rw-r--r-- | patches/e9patch-check-mov-imm.patch | 16 | ||||
| -rw-r--r-- | patches/e9patch-check-rflags.patch | 32 | ||||
| -rw-r--r-- | patches/e9patch-check.patch | 28 |
4 files changed, 28 insertions, 54 deletions
diff --git a/loftix/patching.scm b/loftix/patching.scm index db3a18c..ba46c82 100644 --- a/loftix/patching.scm +++ b/loftix/patching.scm @@ -30,7 +30,7 @@ #:use-module (guix packages)) (define-public e9patch - (let ((commit "e888f387a1f4650970607d20a1fae5f41940a2c8") + (let ((commit "061f8dd6d48c3a6441d8300e697696bf415683a4") (revision "0")) (package (name "e9patch") @@ -42,7 +42,7 @@ (commit commit))) (sha256 (base32 - "0071m238xxdqrc2apq19k0kk7ibzd30b814ih7y26ykqbs2xgqp2")) + "0l4bzkdfxhsdsjh2gk2pas4kkw8y5yrsl7hx1hlnhx2q0vp60kv6")) (file-name (git-file-name name version)) (patches (search-patches ;; https://github.com/GJDuck/e9patch/pull/94 @@ -53,8 +53,6 @@ "patches/e9patch-check-intel-format.patch" ;; https://github.com/GJDuck/e9patch/pull/93 "patches/e9patch-check-mov-imm.patch" - ;; https://github.com/GJDuck/e9patch/issues/96 - "patches/e9patch-check-rflags.patch" ;; https://github.com/GJDuck/e9patch/pull/97 "patches/e9patch-check-same_op_2.patch")))) (build-system gnu-build-system) diff --git a/patches/e9patch-check-mov-imm.patch b/patches/e9patch-check-mov-imm.patch index 697aa0f..1bf1f45 100644 --- a/patches/e9patch-check-mov-imm.patch +++ b/patches/e9patch-check-mov-imm.patch @@ -50,7 +50,8 @@ References: https://github.com/zyantific/zydis/discussions/538 test/regtest/types.exp | 2 +- test/regtest/zero_flags.exp | 2 +- test/regtest/zero_flags_2.exp | 2 +- - 42 files changed, 42 insertions(+), 43 deletions(-) + test/regtest/zero_rflags.exp | 2 +- + 43 files changed, 43 insertions(+), 44 deletions(-) diff --git a/test/regtest/after.exp b/test/regtest/after.exp index 9c64090..5b3b067 100644 @@ -573,3 +574,16 @@ index 6ea2c37..ac678cc 100644 cmp %rax, %rbx # ZERO FLAGS -Z-P- jz 0xa000122 # ZERO FLAGS ----- Illegal instruction +diff --git a/test/regtest/zero_rflags.exp b/test/regtest/zero_rflags.exp +index 6ea2c37..ac678cc 100644 +--- a/test/regtest/zero_rflags.exp ++++ b/test/regtest/zero_rflags.exp +@@ -2,7 +2,7 @@ jnz 0xa0002ae # ZERO FLAGS -Z-P- + push %r15 # ZERO FLAGS ----- + js 0xa000106 # ZERO FLAGS ----- + movq 0x5e(%rip), %rax # ZERO FLAGS ----- +-mov $0x8877665544332211, %rbx # ZERO FLAGS ----- ++mov $-0x778899aabbccddef, %rbx # ZERO FLAGS ----- + cmp %rax, %rbx # ZERO FLAGS -Z-P- + jz 0xa000122 # ZERO FLAGS ----- + Illegal instruction diff --git a/patches/e9patch-check-rflags.patch b/patches/e9patch-check-rflags.patch deleted file mode 100644 index 596a90f..0000000 --- a/patches/e9patch-check-rflags.patch +++ /dev/null @@ -1,32 +0,0 @@ -commit 856abec11039046d60f13609887894c730bef4a7 -Author: Nguyễn Gia Phong <cnx@loang.net> -Date: 2024-12-05 16:00:06 +0900 - - Disable flaky tests involving rflags - -diff --git a/test/regtest/Makefile b/test/regtest/Makefile -index 34bc81bb1da8..cf3618ea4bed 100644 ---- a/test/regtest/Makefile -+++ b/test/regtest/Makefile -@@ -1,4 +1,4 @@ --.PHONY: check clean-check -+.PHONY: check check-flaky clean-check - - E9TOOL ?= ../../e9tool - E9COMPILE ?= ../../e9compile.sh -@@ -12,8 +12,14 @@ BASE ::= test test.pie bugs test.libc libtest.so test_c test_c.debug example.so - TRAMPOLINE ::= inst patch dl init fini - IN ::= $(wildcard *.in) - EXE ::= $(IN:.in=.exe) -+# Some instructions leave certain rflags undefined: -+# https://github.com/GJDuck/e9patch/issues/96 -+FLAKY ::= after example_12 rip_rsp_rflags xmm - --check: regtest $(EXE) -+check: regtest $(filter-out $(FLAKY:%=%.exe), $(EXE)) -+ ./$^ -+ -+check-flaky: regtest $(filter $(FLAKY:%=%.exe), $(EXE)) - ./$^ - - %.exe: in=$(shell head -1 $<) diff --git a/patches/e9patch-check.patch b/patches/e9patch-check.patch index 8fb08f6..d060c9f 100644 --- a/patches/e9patch-check.patch +++ b/patches/e9patch-check.patch @@ -13,10 +13,10 @@ index 754f5210b004..272e7bb4866f 100644 @@ -1,4 +1,4 @@ -.PHONY: all clean install dev release debug sanitize +.PHONY: all clean install check dev release debug sanitize check-debug - .SECONDEXPANSION: ######################################################################### -@@ -67,6 +67,7 @@ clean: + # BUILD COMMON +@@ -66,6 +66,7 @@ clean: $(MAKE) -C contrib/zydis clean rm -rf $(E9PATCH_OBJS) $(E9TOOL_OBJS) e9patch e9tool \ src/e9patch/e9loader_*.c e9loader_*.o e9loader_*.bin @@ -24,7 +24,7 @@ index 754f5210b004..272e7bb4866f 100644 src/e9patch/e9loader_elf.c: src/e9patch/e9loader_elf.cpp $(CXX) -std=c++11 -Wall -fno-stack-protector -Wno-unused-function -fPIC \ -@@ -83,6 +84,9 @@ src/e9patch/e9loader_pe.c: src/e9patch/e9loader_pe.cpp +@@ -82,6 +83,9 @@ src/e9patch/e9loader_pe.c: src/e9patch/e9loader_pe.cpp src/e9patch/e9elf.o: src/e9patch/e9loader_elf.c src/e9patch/e9pe.o: src/e9patch/e9loader_pe.c @@ -34,7 +34,7 @@ index 754f5210b004..272e7bb4866f 100644 install: all install -d "$(DESTDIR)$(PREFIX)/bin" install -m 755 e9patch "$(DESTDIR)$(PREFIX)/bin/e9patch" -@@ -165,3 +169,6 @@ debug: dev +@@ -164,3 +168,6 @@ debug: dev sanitize: CXXFLAGS += -O0 -g -fsanitize=address sanitize: dev @@ -159,10 +159,10 @@ index d2d56823ff80..8dab0986da87 +LD_PRELOAD=./init_dso.exe ./test.pie a b c 1 2 3 diff --git a/test/regtest/regtest b/test/regtest/regtest new file mode 100755 -index 000000000000..f1d7e67c218f +index 000000000000..d22009e99b72 --- /dev/null +++ b/test/regtest/regtest -@@ -0,0 +1,32 @@ +@@ -0,0 +1,25 @@ +#!/bin/sh +fails=() +for exe in $* @@ -173,16 +173,9 @@ index 000000000000..f1d7e67c218f + exp=$tst.exp + + if test -f $cmd -+ then ./$cmd 1>$out 2>&1 -+ else ./$exe 1>$out 2>&1 -+ fi 2>/dev/null -+ case $? in -+ "132") echo Illegal instruction;; -+ "133") echo Trace/breakpoint trap;; -+ "134") echo Aborted;; -+ "138") echo User defined signal 1;; -+ "139") echo Segmentation fault;; -+ esac >>$out ++ then ./exec.sh ./$cmd 1>$out 2>&1 ++ else ./exec.sh ./$exe 1>$out 2>&1 ++ fi + + diff -u $out $exp + if test $? -ne 0 @@ -200,7 +193,7 @@ deleted file mode 100644 index e86e0af03228..000000000000 --- a/test/regtest/regtest.cpp +++ /dev/null -@@ -1,269 +0,0 @@ +@@ -1,270 +0,0 @@ -/* - * Copyright (C) 2022 National University of Singapore - * @@ -315,6 +308,7 @@ index e86e0af03228..000000000000 - // Step (2): execute the EXE - FILE *CMD = fopen(cmd.c_str(), "r"); - command.clear(); +- command += "./exec.sh "; - if (CMD != NULL) - { - for (int i = 0; (c = getc(CMD)) != '\n' && isprint(c) && i < 1024; i++) |
