mips memfd_create() and syscall error handling

https://github.com/upx/upx/issues/895
	modified:   ../misc/testsuite/upx_testsuite_1-expected_sha256sums.sh
	modified:   stub/src/mipsel.r3000-linux.elf-entry.S
	modified:   stub/src/mipsel.r3000-linux.elf-fold.S
           plus generated .h .dump .map
This commit is contained in:
John Reiser
2025-03-13 08:07:26 -07:00
parent c2da21ba4e
commit 6f650ca16f
11 changed files with 2283 additions and 2325 deletions
+68 -76
View File
@@ -1,5 +1,5 @@
/* mips.r3000-linux.elf-entry.h
created from mips.r3000-linux.elf-entry.bin, 2032 (0x7f0) bytes
created from mips.r3000-linux.elf-entry.bin, 1897 (0x769) bytes
This file is part of the UPX executable compressor.
@@ -32,11 +32,11 @@
/* clang-format off */
#define STUB_MIPS_R3000_LINUX_ELF_ENTRY_SIZE 2032
#define STUB_MIPS_R3000_LINUX_ELF_ENTRY_ADLER32 0x8eb893aa
#define STUB_MIPS_R3000_LINUX_ELF_ENTRY_CRC32 0x9db95a15
#define STUB_MIPS_R3000_LINUX_ELF_ENTRY_SIZE 1897
#define STUB_MIPS_R3000_LINUX_ELF_ENTRY_ADLER32 0x3a347ddd
#define STUB_MIPS_R3000_LINUX_ELF_ENTRY_CRC32 0xddfc99bb
unsigned char stub_mips_r3000_linux_elf_entry[2032] = {
unsigned char stub_mips_r3000_linux_elf_entry[1897] = {
/* 0x0000 */ 127, 69, 76, 70, 1, 2, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0,
/* 0x0010 */ 0, 1, 0, 8, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0,
/* 0x0020 */ 0, 0, 3, 60, 0, 0, 0, 1, 0, 52, 0, 0, 0, 0, 0, 40,
@@ -64,22 +64,22 @@ unsigned char stub_mips_r3000_linux_elf_entry[2032] = {
/* 0x0180 */ 175,184, 0, 0, 0, 96, 32, 33, 0,195, 40, 35,172,229, 0, 0,
/* 0x0190 */ 36, 6, 0, 3, 36, 2, 16, 51, 0, 0, 0, 12,143,162, 0, 0,
/* 0x01a0 */ 3,224, 0, 8, 39,189, 0, 4, 39,189,255,224,175,188, 0, 16,
/* 0x01b0 */ 143,209,255,244, 39,213,255,244, 2,177,168, 34, 4, 17, 0, 2,
/* 0x01c0 */ 3,224, 32, 33,117,112,120, 0, 0, 0, 40, 33, 36, 2, 17, 2,
/* 0x01d0 */ 0, 0, 0, 12, 0, 64,184, 33,142,147, 0, 0, 3,160,240, 33,
/* 0x01e0 */ 175,179, 0, 28, 36, 1,255,248, 3,179,232, 35, 3,161,232, 36,
/* 0x01f0 */ 142,144,255,252, 36, 1,255,252, 2, 1,128, 36,130,136, 0, 8,
/* 0x0200 */ 175,211, 0, 24, 39,199, 0, 24, 3,160, 48, 33,142,133, 0, 4,
/* 0x0210 */ 4, 17, 0, 1, 38,132, 0, 12,175,188, 0, 0,147,161, 0, 0,
/* 0x0220 */ 143,163, 0, 36, 16, 32, 0, 3,143,161, 0, 28,175,163, 0, 24,
/* 0x0230 */ 175,161, 0, 16, 2, 96, 48, 33, 3,160, 40, 33, 2,224, 32, 33,
/* 0x0240 */ 36, 2, 15,164, 0, 0, 0, 12, 3,192,232, 33, 39,189,255,232,
/* 0x0250 */ 175,160, 0, 20,175,183, 0, 16, 36, 7, 0, 1, 36, 6, 0, 5,
/* 0x0260 */ 142,133, 0, 0, 0, 0, 32, 33, 36, 2, 15,250, 0, 0, 0, 12,
/* 0x0270 */ 39,189, 0, 24,175,162, 0, 24, 36, 95, 0, 8, 2,224, 32, 33,
/* 0x0280 */ 36, 2, 15,166, 0, 0, 0, 12, 3,224, 0, 8, 2,176,128, 33,
/* 0x0290 */ 36, 2, 17, 2, 0, 0, 0, 12, 3,224, 0, 8, 0, 0, 0, 0,
/* 0x02a0 */ 36, 2, 15,253, 0, 0, 0, 12, 3,224, 0, 8, 0, 0, 0, 0,
/* 0x01b0 */ 143,209,255,244, 39,213,255,244, 2,177,168, 34, 36, 5, 0, 16,
/* 0x01c0 */ 4, 17, 0, 2, 3,224, 32, 33,117,112,120, 0, 36, 2, 17, 2,
/* 0x01d0 */ 0, 0, 0, 12, 16,224, 0, 6, 0, 64,184, 33, 16,160, 0, 3,
/* 0x01e0 */ 36, 69,255,234, 16,160,255,246, 0, 0, 0, 0, 0, 0, 0, 13,
/* 0x01f0 */ 142,147, 0, 0, 3,160,240, 33,175,179, 0, 28, 36, 1,255,248,
/* 0x0200 */ 3,179,232, 35, 3,161,232, 36,142,144,255,252, 36, 1,255,252,
/* 0x0210 */ 2, 1,128, 36,130,136, 0, 8,175,211, 0, 24, 39,199, 0, 24,
/* 0x0220 */ 3,160, 48, 33,142,133, 0, 4, 4, 17, 0, 1, 38,132, 0, 12,
/* 0x0230 */ 175,188, 0, 0,147,161, 0, 0,143,163, 0, 36, 16, 32, 0, 3,
/* 0x0240 */ 143,161, 0, 28,175,163, 0, 24,175,161, 0, 16, 2, 96, 48, 33,
/* 0x0250 */ 3,160, 40, 33, 2,224, 32, 33, 36, 2, 15,164, 0, 0, 0, 12,
/* 0x0260 */ 20,224,255,226, 3,192,232, 33, 39,189,255,232,175,160, 0, 20,
/* 0x0270 */ 175,183, 0, 16, 36, 7, 0, 1, 36, 6, 0, 5,142,133, 0, 0,
/* 0x0280 */ 0, 0, 32, 33, 36, 2, 15,250, 0, 0, 0, 12, 20,224,255,215,
/* 0x0290 */ 39,189, 0, 24,175,162, 0, 24, 36, 95, 0, 8, 2,224, 32, 33,
/* 0x02a0 */ 36, 2, 15,166, 0, 0, 0, 12, 3,224, 0, 8, 2,176,128, 33,
/* 0x02b0 */ 140,131, 0, 0, 36,132, 0, 4, 20, 96,255,253, 0,128,176, 33,
/* 0x02c0 */ 3,224, 0, 8, 36, 8, 0, 6, 4, 17,255,249, 39,164, 0, 4,
/* 0x02d0 */ 4, 17,255,247, 2,192, 32, 33,140,131, 0, 0, 36,132, 0, 8,
@@ -94,74 +94,66 @@ unsigned char stub_mips_r3000_linux_elf_entry[2032] = {
/* 0x0360 */ 0, 0, 0, 0, 0, 0, 0, 31, 0, 0, 0, 1, 0, 0, 0, 6,
/* 0x0370 */ 0, 0, 0, 0, 0, 0, 0, 52, 0, 0, 1,116, 0, 0, 0, 0,
/* 0x0380 */ 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 27,
/* 0x0390 */ 0, 0, 0, 9, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 5, 40,
/* 0x0390 */ 0, 0, 0, 9, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 4,240,
/* 0x03a0 */ 0, 0, 0, 8, 0, 0, 0, 6, 0, 0, 0, 1, 0, 0, 0, 4,
/* 0x03b0 */ 0, 0, 0, 8, 0, 0, 0, 44, 0, 0, 0, 1, 0, 0, 0, 6,
/* 0x03c0 */ 0, 0, 0, 0, 0, 0, 1,168, 0, 0, 1, 92, 0, 0, 0, 0,
/* 0x03d0 */ 0, 0, 0, 0, 0, 0, 0, 4, 0, 0, 0, 0, 0, 0, 0, 40,
/* 0x03e0 */ 0, 0, 0, 9, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 5, 48,
/* 0x03e0 */ 0, 0, 0, 9, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 4,248,
/* 0x03f0 */ 0, 0, 0, 16, 0, 0, 0, 6, 0, 0, 0, 3, 0, 0, 0, 4,
/* 0x0400 */ 0, 0, 0, 8, 0, 0, 0, 17, 0, 0, 0, 3, 0, 0, 0, 0,
/* 0x0410 */ 0, 0, 0, 0, 0, 0, 3, 4, 0, 0, 0, 53, 0, 0, 0, 0,
/* 0x0420 */ 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 1,
/* 0x0430 */ 0, 0, 0, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 4,124,
/* 0x0440 */ 0, 0, 0,112, 0, 0, 0, 7, 0, 0, 0, 3, 0, 0, 0, 4,
/* 0x0440 */ 0, 0, 0, 80, 0, 0, 0, 7, 0, 0, 0, 3, 0, 0, 0, 4,
/* 0x0450 */ 0, 0, 0, 16, 0, 0, 0, 9, 0, 0, 0, 3, 0, 0, 0, 0,
/* 0x0460 */ 0, 0, 0, 0, 0, 0, 4,236, 0, 0, 0, 57, 0, 0, 0, 0,
/* 0x0460 */ 0, 0, 0, 0, 0, 0, 4,204, 0, 0, 0, 34, 0, 0, 0, 0,
/* 0x0470 */ 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0,
/* 0x0480 */ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1,
/* 0x0490 */ 0, 0, 0, 0, 0, 0, 0, 0, 3, 0, 0, 1, 0, 0, 0, 10,
/* 0x04a0 */ 0, 0, 0, 0, 0, 0, 0, 0, 3, 0, 0, 3, 0, 0, 0, 19,
/* 0x04b0 */ 0, 0, 0, 0, 0, 0, 0, 0, 17, 0, 0, 1, 0, 0, 0, 26,
/* 0x04c0 */ 0, 0, 0,232, 0, 0, 0, 0, 17, 0, 0, 3, 0, 0, 0, 39,
/* 0x04d0 */ 0, 0, 0,248, 0, 0, 0, 0, 17, 0, 0, 3, 0, 0, 0, 49,
/* 0x04e0 */ 0, 0, 0, 0, 0, 0, 0, 0, 16, 0, 0, 0, 0, 69, 76, 70,
/* 0x04f0 */ 77, 65, 73, 78, 88, 0, 69, 76, 70, 77, 65, 73, 78, 90, 0, 95,
/* 0x0500 */ 115,116, 97,114,116, 0,109,101,109,102,100, 95, 99,114,101, 97,
/* 0x0510 */ 116,101, 0,102,116,114,117,110, 99, 97,116,101, 0, 79, 95, 66,
/* 0x0520 */ 73, 78, 70, 79, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 10,
/* 0x0530 */ 0, 0, 0,104, 0, 0, 1, 10, 0, 0, 1, 88, 0, 0, 6, 2,
/* 0x0540 */ 102,105,108,101, 32,102,111,114,109, 97,116, 32,101,108,102, 51,
/* 0x0550 */ 50, 45, 98,105,103,109,105,112,115, 10, 10, 83,101, 99,116,105,
/* 0x0560 */ 111,110,115, 58, 10, 73,100,120, 32, 78, 97,109,101, 32, 32, 32,
/* 0x0570 */ 32, 32, 32, 32, 32, 32, 32, 83,105,122,101, 32, 32, 32, 32, 32,
/* 0x0580 */ 32, 86, 77, 65, 32, 32, 32, 32, 32, 32, 32, 76, 77, 65, 32, 32,
/* 0x0590 */ 32, 32, 32, 32, 32, 70,105,108,101, 32,111,102,102, 32, 32, 65,
/* 0x05a0 */ 108,103,110, 32, 32, 70,108, 97,103,115, 10, 32, 32, 48, 32, 69,
/* 0x05b0 */ 76, 70, 77, 65, 73, 78, 88, 32, 32, 32, 32, 32, 32, 48, 49, 55,
/* 0x05c0 */ 52, 32, 32, 48, 32, 32, 48, 32, 32, 48, 51, 52, 32, 32, 50, 42,
/* 0x05d0 */ 42, 48, 32, 32, 67, 79, 78, 84, 69, 78, 84, 83, 10, 32, 32, 49,
/* 0x05e0 */ 32, 69, 76, 70, 77, 65, 73, 78, 90, 32, 32, 32, 32, 32, 32, 48,
/* 0x05f0 */ 49, 53, 99, 32, 32, 48, 32, 32, 48, 32, 32, 48, 49, 97, 56, 32,
/* 0x0600 */ 32, 50, 42, 42, 50, 32, 32, 67, 79, 78, 84, 69, 78, 84, 83, 10,
/* 0x0610 */ 83, 89, 77, 66, 79, 76, 32, 84, 65, 66, 76, 69, 58, 10, 48, 48,
/* 0x0620 */ 48, 48, 48, 48, 48, 48, 32,108, 32, 32, 32, 32,100, 32, 32, 69,
/* 0x0630 */ 76, 70, 77, 65, 73, 78, 88, 32, 48, 32, 69, 76, 70, 77, 65, 73,
/* 0x0640 */ 78, 88, 10, 48, 48, 48, 48, 48, 48, 48, 48, 32,108, 32, 32, 32,
/* 0x0650 */ 32,100, 32, 32, 69, 76, 70, 77, 65, 73, 78, 90, 32, 48, 32, 69,
/* 0x0660 */ 76, 70, 77, 65, 73, 78, 90, 10, 48, 48, 48, 48, 48, 48, 48, 48,
/* 0x0670 */ 32,103, 32, 32, 32, 32, 32, 79, 32, 69, 76, 70, 77, 65, 73, 78,
/* 0x0680 */ 88, 32, 48, 32, 95,115,116, 97,114,116, 10, 48, 48, 48, 48, 48,
/* 0x0690 */ 48,101, 56, 32,103, 32, 32, 32, 32, 32, 79, 32, 69, 76, 70, 77,
/* 0x06a0 */ 65, 73, 78, 90, 32, 48, 32,109,101,109,102,100, 95, 99,114,101,
/* 0x06b0 */ 97,116,101, 10, 48, 48, 48, 48, 48, 48,102, 56, 32,103, 32, 32,
/* 0x06c0 */ 32, 32, 32, 79, 32, 69, 76, 70, 77, 65, 73, 78, 90, 32, 48, 32,
/* 0x06d0 */ 102,116,114,117,110, 99, 97,116,101, 10, 48, 48, 48, 48, 48, 48,
/* 0x06e0 */ 48, 48, 32, 32, 32, 32, 32, 32, 32, 32, 32, 42, 85, 78, 68, 42,
/* 0x06f0 */ 32, 48, 32, 79, 95, 66, 73, 78, 70, 79, 10, 10, 82, 69, 76, 79,
/* 0x0700 */ 67, 65, 84, 73, 79, 78, 32, 82, 69, 67, 79, 82, 68, 83, 32, 70,
/* 0x0710 */ 79, 82, 32, 91, 69, 76, 70, 77, 65, 73, 78, 88, 93, 58, 10, 79,
/* 0x0720 */ 70, 70, 83, 69, 84, 32, 32, 32, 84, 89, 80, 69, 32, 32, 32, 32,
/* 0x0730 */ 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 86, 65, 76, 85, 69, 10,
/* 0x0740 */ 48, 48, 48, 48, 48, 48, 48, 48, 32, 82, 95, 77, 73, 80, 83, 95,
/* 0x0750 */ 80, 67, 49, 54, 32, 32, 32, 32, 32, 32, 32, 69, 76, 70, 77, 65,
/* 0x0760 */ 73, 78, 90, 10, 10, 82, 69, 76, 79, 67, 65, 84, 73, 79, 78, 32,
/* 0x0770 */ 82, 69, 67, 79, 82, 68, 83, 32, 70, 79, 82, 32, 91, 69, 76, 70,
/* 0x0780 */ 77, 65, 73, 78, 90, 93, 58, 10, 79, 70, 70, 83, 69, 84, 32, 32,
/* 0x0790 */ 32, 84, 89, 80, 69, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,
/* 0x07a0 */ 32, 32, 32, 86, 65, 76, 85, 69, 10, 48, 48, 48, 48, 48, 48, 54,
/* 0x07b0 */ 56, 32, 82, 95, 77, 73, 80, 83, 95, 80, 67, 49, 54, 32, 32, 32,
/* 0x07c0 */ 32, 32, 32, 32, 69, 76, 70, 77, 65, 73, 78, 88, 10, 48, 48, 48,
/* 0x07d0 */ 48, 48, 49, 53, 56, 32, 82, 95, 77, 73, 80, 83, 95, 51, 50, 32,
/* 0x07e0 */ 32, 32, 32, 32, 32, 32, 32, 32, 79, 95, 66, 73, 78, 70, 79, 10
/* 0x04c0 */ 0, 0, 0, 0, 0, 0, 0, 0, 16, 0, 0, 0, 0, 69, 76, 70,
/* 0x04d0 */ 77, 65, 73, 78, 88, 0, 69, 76, 70, 77, 65, 73, 78, 90, 0, 95,
/* 0x04e0 */ 115,116, 97,114,116, 0, 79, 95, 66, 73, 78, 70, 79, 0, 0, 0,
/* 0x04f0 */ 0, 0, 0, 0, 0, 0, 2, 10, 0, 0, 0,128, 0, 0, 1, 10,
/* 0x0500 */ 0, 0, 1, 88, 0, 0, 4, 2,102,105,108,101, 32,102,111,114,
/* 0x0510 */ 109, 97,116, 32,101,108,102, 51, 50, 45, 98,105,103,109,105,112,
/* 0x0520 */ 115, 10, 10, 83,101, 99,116,105,111,110,115, 58, 10, 73,100,120,
/* 0x0530 */ 32, 78, 97,109,101, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 83,
/* 0x0540 */ 105,122,101, 32, 32, 32, 32, 32, 32, 86, 77, 65, 32, 32, 32, 32,
/* 0x0550 */ 32, 32, 32, 76, 77, 65, 32, 32, 32, 32, 32, 32, 32, 70,105,108,
/* 0x0560 */ 101, 32,111,102,102, 32, 32, 65,108,103,110, 32, 32, 70,108, 97,
/* 0x0570 */ 103,115, 10, 32, 32, 48, 32, 69, 76, 70, 77, 65, 73, 78, 88, 32,
/* 0x0580 */ 32, 32, 32, 32, 32, 48, 49, 55, 52, 32, 32, 48, 32, 32, 48, 32,
/* 0x0590 */ 32, 48, 51, 52, 32, 32, 50, 42, 42, 48, 32, 32, 67, 79, 78, 84,
/* 0x05a0 */ 69, 78, 84, 83, 10, 32, 32, 49, 32, 69, 76, 70, 77, 65, 73, 78,
/* 0x05b0 */ 90, 32, 32, 32, 32, 32, 32, 48, 49, 53, 99, 32, 32, 48, 32, 32,
/* 0x05c0 */ 48, 32, 32, 48, 49, 97, 56, 32, 32, 50, 42, 42, 50, 32, 32, 67,
/* 0x05d0 */ 79, 78, 84, 69, 78, 84, 83, 10, 83, 89, 77, 66, 79, 76, 32, 84,
/* 0x05e0 */ 65, 66, 76, 69, 58, 10, 48, 48, 48, 48, 48, 48, 48, 48, 32,108,
/* 0x05f0 */ 32, 32, 32, 32,100, 32, 32, 69, 76, 70, 77, 65, 73, 78, 88, 32,
/* 0x0600 */ 48, 32, 69, 76, 70, 77, 65, 73, 78, 88, 10, 48, 48, 48, 48, 48,
/* 0x0610 */ 48, 48, 48, 32,108, 32, 32, 32, 32,100, 32, 32, 69, 76, 70, 77,
/* 0x0620 */ 65, 73, 78, 90, 32, 48, 32, 69, 76, 70, 77, 65, 73, 78, 90, 10,
/* 0x0630 */ 48, 48, 48, 48, 48, 48, 48, 48, 32,103, 32, 32, 32, 32, 32, 79,
/* 0x0640 */ 32, 69, 76, 70, 77, 65, 73, 78, 88, 32, 48, 32, 95,115,116, 97,
/* 0x0650 */ 114,116, 10, 48, 48, 48, 48, 48, 48, 48, 48, 32, 32, 32, 32, 32,
/* 0x0660 */ 32, 32, 32, 32, 42, 85, 78, 68, 42, 32, 48, 32, 79, 95, 66, 73,
/* 0x0670 */ 78, 70, 79, 10, 10, 82, 69, 76, 79, 67, 65, 84, 73, 79, 78, 32,
/* 0x0680 */ 82, 69, 67, 79, 82, 68, 83, 32, 70, 79, 82, 32, 91, 69, 76, 70,
/* 0x0690 */ 77, 65, 73, 78, 88, 93, 58, 10, 79, 70, 70, 83, 69, 84, 32, 32,
/* 0x06a0 */ 32, 84, 89, 80, 69, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,
/* 0x06b0 */ 32, 32, 32, 86, 65, 76, 85, 69, 10, 48, 48, 48, 48, 48, 48, 48,
/* 0x06c0 */ 48, 32, 82, 95, 77, 73, 80, 83, 95, 80, 67, 49, 54, 32, 32, 32,
/* 0x06d0 */ 32, 32, 32, 32, 69, 76, 70, 77, 65, 73, 78, 90, 10, 10, 82, 69,
/* 0x06e0 */ 76, 79, 67, 65, 84, 73, 79, 78, 32, 82, 69, 67, 79, 82, 68, 83,
/* 0x06f0 */ 32, 70, 79, 82, 32, 91, 69, 76, 70, 77, 65, 73, 78, 90, 93, 58,
/* 0x0700 */ 10, 79, 70, 70, 83, 69, 84, 32, 32, 32, 84, 89, 80, 69, 32, 32,
/* 0x0710 */ 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 86, 65, 76, 85,
/* 0x0720 */ 69, 10, 48, 48, 48, 48, 48, 48, 56, 48, 32, 82, 95, 77, 73, 80,
/* 0x0730 */ 83, 95, 80, 67, 49, 54, 32, 32, 32, 32, 32, 32, 32, 69, 76, 70,
/* 0x0740 */ 77, 65, 73, 78, 88, 10, 48, 48, 48, 48, 48, 49, 53, 56, 32, 82,
/* 0x0750 */ 95, 77, 73, 80, 83, 95, 51, 50, 32, 32, 32, 32, 32, 32, 32, 32,
/* 0x0760 */ 32, 79, 95, 66, 73, 78, 70, 79, 10
};
+1030 -1039
View File
File diff suppressed because it is too large Load Diff
+70 -78
View File
@@ -1,5 +1,5 @@
/* mipsel.r3000-linux.elf-entry.h
created from mipsel.r3000-linux.elf-entry.bin, 1995 (0x7cb) bytes
created from mipsel.r3000-linux.elf-entry.bin, 1860 (0x744) bytes
This file is part of the UPX executable compressor.
@@ -32,11 +32,11 @@
/* clang-format off */
#define STUB_MIPSEL_R3000_LINUX_ELF_ENTRY_SIZE 1995
#define STUB_MIPSEL_R3000_LINUX_ELF_ENTRY_ADLER32 0xbfb88d29
#define STUB_MIPSEL_R3000_LINUX_ELF_ENTRY_CRC32 0x0a3be21c
#define STUB_MIPSEL_R3000_LINUX_ELF_ENTRY_SIZE 1860
#define STUB_MIPSEL_R3000_LINUX_ELF_ENTRY_ADLER32 0x26f5775c
#define STUB_MIPSEL_R3000_LINUX_ELF_ENTRY_CRC32 0x15b536db
unsigned char stub_mipsel_r3000_linux_elf_entry[1995] = {
unsigned char stub_mipsel_r3000_linux_elf_entry[1860] = {
/* 0x0000 */ 127, 69, 76, 70, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0,
/* 0x0010 */ 1, 0, 8, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
/* 0x0020 */ 20, 3, 0, 0, 1, 0, 0, 0, 52, 0, 0, 0, 0, 0, 40, 0,
@@ -62,22 +62,22 @@ unsigned char stub_mipsel_r3000_linux_elf_entry[1995] = {
/* 0x0160 */ 35, 40,195, 0, 0, 0,229,172, 3, 0, 6, 36, 51, 16, 2, 36,
/* 0x0170 */ 12, 0, 0, 0, 0, 0,162,143, 8, 0,224, 3, 4, 0,189, 39,
/* 0x0180 */ 224,255,189, 39, 16, 0,188,175,244,255,209,143,244,255,213, 39,
/* 0x0190 */ 34,168,177, 2, 2, 0, 17, 4, 33, 32,224, 3,117,112,120, 0,
/* 0x01a0 */ 33, 40, 0, 0, 2, 17, 2, 36, 12, 0, 0, 0, 33,184, 64, 0,
/* 0x01b0 */ 0, 0,147,142, 33,240,160, 3, 28, 0,179,175,248,255, 1, 36,
/* 0x01c0 */ 35,232,179, 3, 36,232,161, 3,252,255,144,142,252,255, 1, 36,
/* 0x01d0 */ 36,128, 1, 2, 8, 0,136,130, 24, 0,211,175, 24, 0,199, 39,
/* 0x01e0 */ 33, 48,160, 3, 4, 0,133,142, 1, 0, 17, 4, 12, 0,132, 38,
/* 0x01f0 */ 0, 0,188,175, 0, 0,161,147, 36, 0,163,143, 3, 0, 32, 16,
/* 0x0200 */ 28, 0,161,143, 24, 0,163,175, 16, 0,161,175, 33, 48, 96, 2,
/* 0x0210 */ 33, 40,160, 3, 33, 32,224, 2,164, 15, 2, 36, 12, 0, 0, 0,
/* 0x0220 */ 33,232,192, 3,232,255,189, 39, 20, 0,160,175, 16, 0,183,175,
/* 0x0230 */ 1, 0, 7, 36, 5, 0, 6, 36, 0, 0,133,142, 33, 32, 0, 0,
/* 0x0240 */ 250, 15, 2, 36, 12, 0, 0, 0, 24, 0,189, 39, 24, 0,162,175,
/* 0x0250 */ 8, 0, 95, 36, 33, 32,224, 2,166, 15, 2, 36, 12, 0, 0, 0,
/* 0x0260 */ 8, 0,224, 3, 33,128,176, 2, 2, 17, 2, 36, 12, 0, 0, 0,
/* 0x0270 */ 8, 0,224, 3, 0, 0, 0, 0,253, 15, 2, 36, 12, 0, 0, 0,
/* 0x0280 */ 8, 0,224, 3, 0, 0, 0, 0, 0, 0,131,140, 4, 0,132, 36,
/* 0x0190 */ 34,168,177, 2, 16, 0, 5, 36, 2, 0, 17, 4, 33, 32,224, 3,
/* 0x01a0 */ 117,112,120, 0, 2, 17, 2, 36, 12, 0, 0, 0, 6, 0,224, 16,
/* 0x01b0 */ 33,184, 64, 0, 3, 0,160, 16,234,255, 69, 36,246,255,160, 16,
/* 0x01c0 */ 0, 0, 0, 0, 13, 0, 0, 0, 0, 0,147,142, 33,240,160, 3,
/* 0x01d0 */ 28, 0,179,175,248,255, 1, 36, 35,232,179, 3, 36,232,161, 3,
/* 0x01e0 */ 252,255,144,142,252,255, 1, 36, 36,128, 1, 2, 8, 0,136,130,
/* 0x01f0 */ 24, 0,211,175, 24, 0,199, 39, 33, 48,160, 3, 4, 0,133,142,
/* 0x0200 */ 1, 0, 17, 4, 12, 0,132, 38, 0, 0,188,175, 0, 0,161,147,
/* 0x0210 */ 36, 0,163,143, 3, 0, 32, 16, 28, 0,161,143, 24, 0,163,175,
/* 0x0220 */ 16, 0,161,175, 33, 48, 96, 2, 33, 40,160, 3, 33, 32,224, 2,
/* 0x0230 */ 164, 15, 2, 36, 12, 0, 0, 0,226,255,224, 20, 33,232,192, 3,
/* 0x0240 */ 232,255,189, 39, 20, 0,160,175, 16, 0,183,175, 1, 0, 7, 36,
/* 0x0250 */ 5, 0, 6, 36, 0, 0,133,142, 33, 32, 0, 0,250, 15, 2, 36,
/* 0x0260 */ 12, 0, 0, 0,215,255,224, 20, 24, 0,189, 39, 24, 0,162,175,
/* 0x0270 */ 8, 0, 95, 36, 33, 32,224, 2,166, 15, 2, 36, 12, 0, 0, 0,
/* 0x0280 */ 8, 0,224, 3, 33,128,176, 2, 0, 0,131,140, 4, 0,132, 36,
/* 0x0290 */ 253,255, 96, 20, 33,176,128, 0, 8, 0,224, 3, 6, 0, 8, 36,
/* 0x02a0 */ 249,255, 17, 4, 4, 0,164, 39,247,255, 17, 4, 33, 32,192, 2,
/* 0x02b0 */ 0, 0,131,140, 8, 0,132, 36, 3, 0,104, 16,252,255,130,140,
@@ -92,74 +92,66 @@ unsigned char stub_mipsel_r3000_linux_elf_entry[1995] = {
/* 0x0340 */ 1, 0, 0, 0, 6, 0, 0, 0, 0, 0, 0, 0, 52, 0, 0, 0,
/* 0x0350 */ 76, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0,
/* 0x0360 */ 0, 0, 0, 0, 27, 0, 0, 0, 9, 0, 0, 0, 0, 0, 0, 0,
/* 0x0370 */ 0, 0, 0, 0, 0, 5, 0, 0, 8, 0, 0, 0, 6, 0, 0, 0,
/* 0x0370 */ 0, 0, 0, 0,200, 4, 0, 0, 8, 0, 0, 0, 6, 0, 0, 0,
/* 0x0380 */ 1, 0, 0, 0, 4, 0, 0, 0, 8, 0, 0, 0, 44, 0, 0, 0,
/* 0x0390 */ 1, 0, 0, 0, 6, 0, 0, 0, 0, 0, 0, 0,128, 1, 0, 0,
/* 0x03a0 */ 92, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 4, 0, 0, 0,
/* 0x03b0 */ 0, 0, 0, 0, 40, 0, 0, 0, 9, 0, 0, 0, 0, 0, 0, 0,
/* 0x03c0 */ 0, 0, 0, 0, 8, 5, 0, 0, 16, 0, 0, 0, 6, 0, 0, 0,
/* 0x03c0 */ 0, 0, 0, 0,208, 4, 0, 0, 16, 0, 0, 0, 6, 0, 0, 0,
/* 0x03d0 */ 3, 0, 0, 0, 4, 0, 0, 0, 8, 0, 0, 0, 17, 0, 0, 0,
/* 0x03e0 */ 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,220, 2, 0, 0,
/* 0x03f0 */ 53, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0,
/* 0x0400 */ 0, 0, 0, 0, 1, 0, 0, 0, 2, 0, 0, 0, 0, 0, 0, 0,
/* 0x0410 */ 0, 0, 0, 0, 84, 4, 0, 0,112, 0, 0, 0, 7, 0, 0, 0,
/* 0x0410 */ 0, 0, 0, 0, 84, 4, 0, 0, 80, 0, 0, 0, 7, 0, 0, 0,
/* 0x0420 */ 3, 0, 0, 0, 4, 0, 0, 0, 16, 0, 0, 0, 9, 0, 0, 0,
/* 0x0430 */ 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,196, 4, 0, 0,
/* 0x0440 */ 57, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0,
/* 0x0430 */ 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,164, 4, 0, 0,
/* 0x0440 */ 34, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0,
/* 0x0450 */ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
/* 0x0460 */ 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
/* 0x0470 */ 3, 0, 1, 0, 10, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
/* 0x0480 */ 3, 0, 3, 0, 19, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
/* 0x0490 */ 17, 0, 1, 0, 26, 0, 0, 0,232, 0, 0, 0, 0, 0, 0, 0,
/* 0x04a0 */ 17, 0, 3, 0, 39, 0, 0, 0,248, 0, 0, 0, 0, 0, 0, 0,
/* 0x04b0 */ 17, 0, 3, 0, 49, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
/* 0x04c0 */ 16, 0, 0, 0, 0, 69, 76, 70, 77, 65, 73, 78, 88, 0, 69, 76,
/* 0x04d0 */ 70, 77, 65, 73, 78, 90, 0, 95,115,116, 97,114,116, 0,109,101,
/* 0x04e0 */ 109,102,100, 95, 99,114,101, 97,116,101, 0,102,116,114,117,110,
/* 0x04f0 */ 99, 97,116,101, 0, 79, 95, 66, 73, 78, 70, 79, 0, 0, 0, 0,
/* 0x0500 */ 0, 0, 0, 0, 10, 2, 0, 0,104, 0, 0, 0, 10, 1, 0, 0,
/* 0x0510 */ 88, 1, 0, 0, 2, 6, 0, 0,102,105,108,101, 32,102,111,114,
/* 0x0520 */ 109, 97,116, 32,101,108,102, 51, 50, 45,108,105,116,116,108,101,
/* 0x0530 */ 109,105,112,115, 10, 10, 83,101, 99,116,105,111,110,115, 58, 10,
/* 0x0540 */ 73,100,120, 32, 78, 97,109,101, 32, 32, 32, 32, 32, 32, 32, 32,
/* 0x0550 */ 32, 32, 83,105,122,101, 32, 32, 32, 32, 32, 32, 86, 77, 65, 32,
/* 0x0560 */ 32, 32, 32, 32, 32, 32, 76, 77, 65, 32, 32, 32, 32, 32, 32, 32,
/* 0x0570 */ 70,105,108,101, 32,111,102,102, 32, 32, 65,108,103,110, 32, 32,
/* 0x0580 */ 70,108, 97,103,115, 10, 32, 32, 48, 32, 69, 76, 70, 77, 65, 73,
/* 0x0590 */ 78, 88, 32, 32, 32, 32, 32, 32, 48, 49, 52, 99, 32, 32, 48, 32,
/* 0x05a0 */ 32, 48, 32, 32, 48, 51, 52, 32, 32, 50, 42, 42, 48, 32, 32, 67,
/* 0x05b0 */ 79, 78, 84, 69, 78, 84, 83, 10, 32, 32, 49, 32, 69, 76, 70, 77,
/* 0x05c0 */ 65, 73, 78, 90, 32, 32, 32, 32, 32, 32, 48, 49, 53, 99, 32, 32,
/* 0x05d0 */ 48, 32, 32, 48, 32, 32, 48, 49, 56, 48, 32, 32, 50, 42, 42, 50,
/* 0x05e0 */ 32, 32, 67, 79, 78, 84, 69, 78, 84, 83, 10, 83, 89, 77, 66, 79,
/* 0x05f0 */ 76, 32, 84, 65, 66, 76, 69, 58, 10, 48, 48, 48, 48, 48, 48, 48,
/* 0x0600 */ 48, 32,108, 32, 32, 32, 32,100, 32, 32, 69, 76, 70, 77, 65, 73,
/* 0x0610 */ 78, 88, 32, 48, 32, 69, 76, 70, 77, 65, 73, 78, 88, 10, 48, 48,
/* 0x0620 */ 48, 48, 48, 48, 48, 48, 32,108, 32, 32, 32, 32,100, 32, 32, 69,
/* 0x0630 */ 76, 70, 77, 65, 73, 78, 90, 32, 48, 32, 69, 76, 70, 77, 65, 73,
/* 0x0640 */ 78, 90, 10, 48, 48, 48, 48, 48, 48, 48, 48, 32,103, 32, 32, 32,
/* 0x0650 */ 32, 32, 79, 32, 69, 76, 70, 77, 65, 73, 78, 88, 32, 48, 32, 95,
/* 0x0660 */ 115,116, 97,114,116, 10, 48, 48, 48, 48, 48, 48,101, 56, 32,103,
/* 0x0670 */ 32, 32, 32, 32, 32, 79, 32, 69, 76, 70, 77, 65, 73, 78, 90, 32,
/* 0x0680 */ 48, 32,109,101,109,102,100, 95, 99,114,101, 97,116,101, 10, 48,
/* 0x0690 */ 48, 48, 48, 48, 48,102, 56, 32,103, 32, 32, 32, 32, 32, 79, 32,
/* 0x06a0 */ 69, 76, 70, 77, 65, 73, 78, 90, 32, 48, 32,102,116,114,117,110,
/* 0x06b0 */ 99, 97,116,101, 10, 48, 48, 48, 48, 48, 48, 48, 48, 32, 32, 32,
/* 0x06c0 */ 32, 32, 32, 32, 32, 32, 42, 85, 78, 68, 42, 32, 48, 32, 79, 95,
/* 0x06d0 */ 66, 73, 78, 70, 79, 10, 10, 82, 69, 76, 79, 67, 65, 84, 73, 79,
/* 0x06e0 */ 78, 32, 82, 69, 67, 79, 82, 68, 83, 32, 70, 79, 82, 32, 91, 69,
/* 0x06f0 */ 76, 70, 77, 65, 73, 78, 88, 93, 58, 10, 79, 70, 70, 83, 69, 84,
/* 0x0700 */ 32, 32, 32, 84, 89, 80, 69, 32, 32, 32, 32, 32, 32, 32, 32, 32,
/* 0x0710 */ 32, 32, 32, 32, 32, 86, 65, 76, 85, 69, 10, 48, 48, 48, 48, 48,
/* 0x0720 */ 48, 48, 48, 32, 82, 95, 77, 73, 80, 83, 95, 80, 67, 49, 54, 32,
/* 0x0730 */ 32, 32, 32, 32, 32, 32, 69, 76, 70, 77, 65, 73, 78, 90, 10, 10,
/* 0x0740 */ 82, 69, 76, 79, 67, 65, 84, 73, 79, 78, 32, 82, 69, 67, 79, 82,
/* 0x0750 */ 68, 83, 32, 70, 79, 82, 32, 91, 69, 76, 70, 77, 65, 73, 78, 90,
/* 0x0760 */ 93, 58, 10, 79, 70, 70, 83, 69, 84, 32, 32, 32, 84, 89, 80, 69,
/* 0x0770 */ 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 86, 65,
/* 0x0780 */ 76, 85, 69, 10, 48, 48, 48, 48, 48, 48, 54, 56, 32, 82, 95, 77,
/* 0x0790 */ 73, 80, 83, 95, 80, 67, 49, 54, 32, 32, 32, 32, 32, 32, 32, 69,
/* 0x07a0 */ 76, 70, 77, 65, 73, 78, 88, 10, 48, 48, 48, 48, 48, 49, 53, 56,
/* 0x07b0 */ 32, 82, 95, 77, 73, 80, 83, 95, 51, 50, 32, 32, 32, 32, 32, 32,
/* 0x07c0 */ 32, 32, 32, 79, 95, 66, 73, 78, 70, 79, 10
/* 0x0490 */ 17, 0, 1, 0, 26, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
/* 0x04a0 */ 16, 0, 0, 0, 0, 69, 76, 70, 77, 65, 73, 78, 88, 0, 69, 76,
/* 0x04b0 */ 70, 77, 65, 73, 78, 90, 0, 95,115,116, 97,114,116, 0, 79, 95,
/* 0x04c0 */ 66, 73, 78, 70, 79, 0, 0, 0, 0, 0, 0, 0, 10, 2, 0, 0,
/* 0x04d0 */ 128, 0, 0, 0, 10, 1, 0, 0, 88, 1, 0, 0, 2, 4, 0, 0,
/* 0x04e0 */ 102,105,108,101, 32,102,111,114,109, 97,116, 32,101,108,102, 51,
/* 0x04f0 */ 50, 45,108,105,116,116,108,101,109,105,112,115, 10, 10, 83,101,
/* 0x0500 */ 99,116,105,111,110,115, 58, 10, 73,100,120, 32, 78, 97,109,101,
/* 0x0510 */ 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 83,105,122,101, 32, 32,
/* 0x0520 */ 32, 32, 32, 32, 86, 77, 65, 32, 32, 32, 32, 32, 32, 32, 76, 77,
/* 0x0530 */ 65, 32, 32, 32, 32, 32, 32, 32, 70,105,108,101, 32,111,102,102,
/* 0x0540 */ 32, 32, 65,108,103,110, 32, 32, 70,108, 97,103,115, 10, 32, 32,
/* 0x0550 */ 48, 32, 69, 76, 70, 77, 65, 73, 78, 88, 32, 32, 32, 32, 32, 32,
/* 0x0560 */ 48, 49, 52, 99, 32, 32, 48, 32, 32, 48, 32, 32, 48, 51, 52, 32,
/* 0x0570 */ 32, 50, 42, 42, 48, 32, 32, 67, 79, 78, 84, 69, 78, 84, 83, 10,
/* 0x0580 */ 32, 32, 49, 32, 69, 76, 70, 77, 65, 73, 78, 90, 32, 32, 32, 32,
/* 0x0590 */ 32, 32, 48, 49, 53, 99, 32, 32, 48, 32, 32, 48, 32, 32, 48, 49,
/* 0x05a0 */ 56, 48, 32, 32, 50, 42, 42, 50, 32, 32, 67, 79, 78, 84, 69, 78,
/* 0x05b0 */ 84, 83, 10, 83, 89, 77, 66, 79, 76, 32, 84, 65, 66, 76, 69, 58,
/* 0x05c0 */ 10, 48, 48, 48, 48, 48, 48, 48, 48, 32,108, 32, 32, 32, 32,100,
/* 0x05d0 */ 32, 32, 69, 76, 70, 77, 65, 73, 78, 88, 32, 48, 32, 69, 76, 70,
/* 0x05e0 */ 77, 65, 73, 78, 88, 10, 48, 48, 48, 48, 48, 48, 48, 48, 32,108,
/* 0x05f0 */ 32, 32, 32, 32,100, 32, 32, 69, 76, 70, 77, 65, 73, 78, 90, 32,
/* 0x0600 */ 48, 32, 69, 76, 70, 77, 65, 73, 78, 90, 10, 48, 48, 48, 48, 48,
/* 0x0610 */ 48, 48, 48, 32,103, 32, 32, 32, 32, 32, 79, 32, 69, 76, 70, 77,
/* 0x0620 */ 65, 73, 78, 88, 32, 48, 32, 95,115,116, 97,114,116, 10, 48, 48,
/* 0x0630 */ 48, 48, 48, 48, 48, 48, 32, 32, 32, 32, 32, 32, 32, 32, 32, 42,
/* 0x0640 */ 85, 78, 68, 42, 32, 48, 32, 79, 95, 66, 73, 78, 70, 79, 10, 10,
/* 0x0650 */ 82, 69, 76, 79, 67, 65, 84, 73, 79, 78, 32, 82, 69, 67, 79, 82,
/* 0x0660 */ 68, 83, 32, 70, 79, 82, 32, 91, 69, 76, 70, 77, 65, 73, 78, 88,
/* 0x0670 */ 93, 58, 10, 79, 70, 70, 83, 69, 84, 32, 32, 32, 84, 89, 80, 69,
/* 0x0680 */ 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 86, 65,
/* 0x0690 */ 76, 85, 69, 10, 48, 48, 48, 48, 48, 48, 48, 48, 32, 82, 95, 77,
/* 0x06a0 */ 73, 80, 83, 95, 80, 67, 49, 54, 32, 32, 32, 32, 32, 32, 32, 69,
/* 0x06b0 */ 76, 70, 77, 65, 73, 78, 90, 10, 10, 82, 69, 76, 79, 67, 65, 84,
/* 0x06c0 */ 73, 79, 78, 32, 82, 69, 67, 79, 82, 68, 83, 32, 70, 79, 82, 32,
/* 0x06d0 */ 91, 69, 76, 70, 77, 65, 73, 78, 90, 93, 58, 10, 79, 70, 70, 83,
/* 0x06e0 */ 69, 84, 32, 32, 32, 84, 89, 80, 69, 32, 32, 32, 32, 32, 32, 32,
/* 0x06f0 */ 32, 32, 32, 32, 32, 32, 32, 86, 65, 76, 85, 69, 10, 48, 48, 48,
/* 0x0700 */ 48, 48, 48, 56, 48, 32, 82, 95, 77, 73, 80, 83, 95, 80, 67, 49,
/* 0x0710 */ 54, 32, 32, 32, 32, 32, 32, 32, 69, 76, 70, 77, 65, 73, 78, 88,
/* 0x0720 */ 10, 48, 48, 48, 48, 48, 49, 53, 56, 32, 82, 95, 77, 73, 80, 83,
/* 0x0730 */ 95, 51, 50, 32, 32, 32, 32, 32, 32, 32, 32, 32, 79, 95, 66, 73,
/* 0x0740 */ 78, 70, 79, 10
};
+1023 -1033
View File
File diff suppressed because it is too large Load Diff
+25 -18
View File
@@ -116,6 +116,8 @@ __NR_close = 6+ __NR_Linux
__NR_exit = 1+ __NR_Linux
__NR_ftruncate= 93+ __NR_Linux
__NR_memfd_create= 354+ __NR_Linux
MFD_EXEC= 0x10
EINVAL= 22
__NR_mmap = 90+ __NR_Linux
__NR_mprotect = 125+ __NR_Linux
__NR_msync = 144+ __NR_LINUX
@@ -180,7 +182,7 @@ eof_n2b:
subu a1,lxdst,v1 // actual length generated
sw a1,(lxdstlen)
li a2,ICACHE|DCACHE
li v0,__NR_cacheflush; syscall
li v0,__NR_cacheflush; syscall // ignore failure
lw v0,0(sp)
jr ra
@@ -199,10 +201,23 @@ unfold: # IN: $r_fexp,$r_auxv,$r_PMASK,$r_FOLD
la $r_elfa,sz_pack2 - f_exp($r_fexp)
sub $r_elfa,$r_elfa,$r_LENX # $r_elfa= &Elf32_Ehdr of this stub
bal 0f; move a0,ra; .asciz "upx"; .balign 4
li a1,MFD_EXEC // modern
2:
bal 0f
move a0,ra
.asciz "upx"; .balign 4
0:
move a1,zero
li v0,__NR_memfd_create; syscall; move $r_mfd,v0
li v0,__NR_memfd_create; syscall // attempt recovery
beqz a3,9f // success
move $r_mfd,v0 // return value
beqz a1,8f // failure if (, 0) already tried
addiu a1,v0,-EINVAL // MFD_EXEC appeared Linux 6.3 2023-04-23
beqz a1,2b // try old (, 0) if failure was EINVAL
nop
8:
HALT:
break // both (, MFD_EXEC) and (, 0) failed
9:
# alloca() for de-compressed stub
lw $r_szuf,sz_unc($r_FOLD) # sz_unc of fold
@@ -236,8 +251,8 @@ unfold: # IN: $r_fexp,$r_auxv,$r_PMASK,$r_FOLD
move a2,$r_szuf # .sz_unc
move a1,sp
move a0,$r_mfd
li v0,__NR_write; syscall
move sp,fp
li v0,__NR_write; syscall; bnez a3,HALT // faliure
move sp,fp
# Map de-compressed stub
addiu sp,-6*NBPW # space for all 6 args to mmap()
@@ -247,25 +262,17 @@ unfold: # IN: $r_fexp,$r_auxv,$r_PMASK,$r_FOLD
li a2,PROT_READ|PROT_EXEC # FIXME: PROT_WRITE is DEBUG only
lw a1,sz_unc($r_FOLD)
move a0,zero
li v0,__NR_mmap; syscall; addiu sp,6*NBPW
li v0,__NR_mmap; syscall; bnez a3,HALT // failure
addiu sp,6*NBPW
sw v0,F_ADRU(sp)
addiu ra,v0,2*NBPW
move a0,$r_mfd; li v0,__NR_close; syscall
move a0,$r_mfd
li v0,__NR_close; syscall // ignore failure
jr ra
addu $r_ADRX,$r_elfa,$r_ADRX # compressed data
memfd_create: .globl memfd_create
li v0,__NR_memfd_create; syscall
j ra
nop
ftruncate: .globl ftruncate
li v0,__NR_ftruncate; syscall
j ra
nop
zfind: # result in $r_auxv
lw v1,(a0); addiu a0,a0,NBPW
bnez v1,zfind
+6 -12
View File
@@ -31,6 +31,10 @@ NBPW= 4
#include "arch/mips/r3000/macros.ash"
#include "arch/mips/r3000/bits.ash"
// eglibc-2.11.1/ports/sysdeps/unix/sysv/linux/mips/mips64/n32/sysdep.h
// #define __SYSCALL_CLOBBERS "$1", "$3", "$10", "$11", "$12", "$13", \
// "$14", "$15", "$24", "$25", "hi", "lo", "memory"
.set mips1
.set noreorder
.set noat
@@ -399,25 +403,15 @@ mmap: .globl mmap
addiu sp,sp,sp_frame
sysgo: // src/mipsel.r3000-linux.elf-fold.S
sysgo2:
syscall
sysret:
bgez a3,sysOK
beqz a3,sysOK // Linux MIPS convention
nop
move v0,a3 // -errno: < 0, and > 0xfffff000
sub v0,zero,v0 // -errno: < 0, and > 0xfffff000
sysOK:
jr ra
nop
sysgo_incl: .globl sysgo_incl
syscall
sysret_incl: .globl sysret_incl
.set noat
sltiu at,a3,1 /* 1: no error; 0: error */
addiu at,at,-1 /* 0: no error; -1: error */
or v0,v0,at /* good result, else -1 for error */
.set at
exit: .globl exit
b sysgo; li v0,__NR_exit
brk: .globl brk
+1 -3
View File
@@ -8,8 +8,6 @@ SYMBOL TABLE:
00000000 l d ELFMAINX 0 ELFMAINX
00000000 l d ELFMAINZ 0 ELFMAINZ
00000000 g O ELFMAINX 0 _start
000000e8 g O ELFMAINZ 0 memfd_create
000000f8 g O ELFMAINZ 0 ftruncate
00000000 *UND* 0 O_BINFO
RELOCATION RECORDS FOR [ELFMAINX]:
@@ -18,5 +16,5 @@ OFFSET TYPE VALUE
RELOCATION RECORDS FOR [ELFMAINZ]:
OFFSET TYPE VALUE
00000068 R_MIPS_PC16 ELFMAINX
00000080 R_MIPS_PC16 ELFMAINX
00000158 R_MIPS_32 O_BINFO
+19 -21
View File
@@ -16,35 +16,33 @@ Linker script and memory map
0x0000000000000010 get4unal
0x0000000000000128 close
SYSCALLS 0x0000000000000000 0x1c4
SYSCALLS 0x0000000000000000 0x1c4 tmp/mips.r3000-linux.elf-fold.o
0x0000000000000184 munmap
0x0000000000000154 getpid
SYSCALLS 0x0000000000000000 0x1b4
SYSCALLS 0x0000000000000000 0x1b4 tmp/mips.r3000-linux.elf-fold.o
0x0000000000000174 munmap
0x0000000000000144 getpid
0x0000000000000094 memcpy
0x00000000000001a4 readlink
0x0000000000000194 readlink
0x0000000000000034 Psync
0x00000000000000bc mempcpy
0x000000000000014c ftruncate
0x000000000000015c lseek
0x000000000000013c ftruncate
0x000000000000014c lseek
0x00000000000000f0 mmap
0x00000000000000e4 mmap_privanon
0x00000000000001ac uname
0x00000000000001bc write
0x0000000000000130 sysret_incl
0x0000000000000164 memfd_create
0x000000000000019c read
0x00000000000001b4 unlink
0x000000000000019c uname
0x00000000000001ac write
0x0000000000000154 memfd_create
0x000000000000018c read
0x00000000000001a4 unlink
0x0000000000000074 memset
0x000000000000017c msync
0x000000000000016c msync
0x0000000000000068 my_bkpt
0x0000000000000000 Pprotect
0x000000000000018c stat
0x000000000000013c exit
0x0000000000000144 brk
0x000000000000012c sysgo_incl
0x0000000000000194 open
0x0000000000000174 mprotect
0x000000000000016c mkdir
0x000000000000017c stat
0x000000000000012c exit
0x0000000000000134 brk
0x0000000000000184 open
0x0000000000000164 mprotect
0x000000000000015c mkdir
HUMF_A 0x0000000000000000 0x8
HUMF_A 0x0000000000000000 0x8 tmp/mips.r3000-linux.elf-fold.o
+1 -3
View File
@@ -8,8 +8,6 @@ SYMBOL TABLE:
00000000 l d ELFMAINX 0 ELFMAINX
00000000 l d ELFMAINZ 0 ELFMAINZ
00000000 g O ELFMAINX 0 _start
000000e8 g O ELFMAINZ 0 memfd_create
000000f8 g O ELFMAINZ 0 ftruncate
00000000 *UND* 0 O_BINFO
RELOCATION RECORDS FOR [ELFMAINX]:
@@ -18,5 +16,5 @@ OFFSET TYPE VALUE
RELOCATION RECORDS FOR [ELFMAINZ]:
OFFSET TYPE VALUE
00000068 R_MIPS_PC16 ELFMAINX
00000080 R_MIPS_PC16 ELFMAINX
00000158 R_MIPS_32 O_BINFO
+19 -21
View File
@@ -16,35 +16,33 @@ Linker script and memory map
0x0000000000000010 get4unal
0x0000000000000128 close
SYSCALLS 0x0000000000000000 0x1c4
SYSCALLS 0x0000000000000000 0x1c4 tmp/mipsel.r3000-linux.elf-fold.o
0x0000000000000184 munmap
0x0000000000000154 getpid
SYSCALLS 0x0000000000000000 0x1b4
SYSCALLS 0x0000000000000000 0x1b4 tmp/mipsel.r3000-linux.elf-fold.o
0x0000000000000174 munmap
0x0000000000000144 getpid
0x0000000000000094 memcpy
0x00000000000001a4 readlink
0x0000000000000194 readlink
0x0000000000000034 Psync
0x00000000000000bc mempcpy
0x000000000000014c ftruncate
0x000000000000015c lseek
0x000000000000013c ftruncate
0x000000000000014c lseek
0x00000000000000f0 mmap
0x00000000000000e4 mmap_privanon
0x00000000000001ac uname
0x00000000000001bc write
0x0000000000000130 sysret_incl
0x0000000000000164 memfd_create
0x000000000000019c read
0x00000000000001b4 unlink
0x000000000000019c uname
0x00000000000001ac write
0x0000000000000154 memfd_create
0x000000000000018c read
0x00000000000001a4 unlink
0x0000000000000074 memset
0x000000000000017c msync
0x000000000000016c msync
0x0000000000000068 my_bkpt
0x0000000000000000 Pprotect
0x000000000000018c stat
0x000000000000013c exit
0x0000000000000144 brk
0x000000000000012c sysgo_incl
0x0000000000000194 open
0x0000000000000174 mprotect
0x000000000000016c mkdir
0x000000000000017c stat
0x000000000000012c exit
0x0000000000000134 brk
0x0000000000000184 open
0x0000000000000164 mprotect
0x000000000000015c mkdir
HUMF_A 0x0000000000000000 0x8
HUMF_A 0x0000000000000000 0x8 tmp/mipsel.r3000-linux.elf-fold.o