ELF2 64-bits: Use /dev/shm (O_TMPFILE) if memfd_create fails
Such as Ubuntu-20.04, Linux kernel 5.15.0-67, #74-20.04.1, 2023-02-22
modified: ../misc/testsuite/upx_testsuite_1-expected_sha256sums.sh
modified: stub/Makefile
modified: stub/src/amd64-linux.elf-entry.S
modified: stub/src/amd64-linux.elf-fold.S
modified: stub/src/amd64-linux.elf-main2.c
modified: stub/src/arm64-linux.elf-fold.S
modified: stub/src/upxfd_android.c
plus generated *.h *.map *.dump
This commit is contained in:
parent
5f6bdb0a8f
commit
e561da33bd
@ -46,12 +46,12 @@ b8c35fa2956da17ca505956e9f5017bb5f3a746322647e24ccb8ff28059cafa4 *powerpc-linux.
|
||||
a0950546dc17fca9437219431d8ddb0249ce5b08e899e0c799a87ac982adee70 *powerpc64le-linux.elf/upx-3.95
|
||||
"
|
||||
expected_sha256sums__t110_compress_ucl_nrv2b_3_no_filter="\
|
||||
4b12bf795c5a05986e10a3e3e64a78c35f2cdb7dea8236b32b464c201ee0f9d8 *amd64-linux.elf/upx-3.91
|
||||
d0f25e563332a0cf31b921c75f3f2d6857f9c17c89c0f342fa7d99eaad5bd818 *amd64-linux.elf/upx-3.95
|
||||
f70f80d375d105c4d90549f074c74799e659e8f3754067e3e26c4def2800bbfb *amd64-linux.elf/upx-3.91
|
||||
b2be85af5a5bf4dd81637d18bbffb920e98054ec712ff87d4bda289ae4193b33 *amd64-linux.elf/upx-3.95
|
||||
1bd70a3cd3b34e635a3c947cacd46c4d66bf07e0fd350cc6d1f3cf60483f75b9 *amd64-win64.pe/upx-3.95.exe
|
||||
c9d8d916100e1dd972a2a9a060e4213505b14c62e9705ab6c8b544a8f18e083d *arm-linux.elf/upx-3.95
|
||||
94422a91473a467dfb534afa3f20247bc38691aeb386a42fb3e0fd18d3d0ae08 *arm-wince.pe/upx-3.91.exe
|
||||
840e9e0b745092bc667d85539be92ab7ff4b58ce24bc6469cd3c9c250ee60257 *arm64-linux.elf/upx-3.95
|
||||
402fcc9533e5eb07a16eb4e5bd9df67816b0298ff38fff589a5458df05159eb3 *arm64-linux.elf/upx-3.95
|
||||
0a9d0d95822a7d645d67b61ebd5b86d8be07b8a36e0f29dbc9b55a8666ed67af *armeb-linux.elf/upx-3.91
|
||||
6e4ff31a80809fc5058ae714ab10ad7810c310bd7d116fad8b198009b9872312 *armeb-linux.elf/upx-3.95
|
||||
e17a126cebc32977991a292b7434d1435a7c95862ccece0e4acbf6e810bd3443 *i386-dos32.djgpp2.coff/upx-3.91.exe
|
||||
@ -69,12 +69,12 @@ fcbd8b4709ee324eb772e5de45a85bac5b8e560460fb1d50d0958f2ce568be97 *mipsel-linux.e
|
||||
d74c348bad0c1f3e776cf78282141492a58746c601f3f4288c9e675b7b425f82 *powerpc64le-linux.elf/upx-3.95
|
||||
"
|
||||
expected_sha256sums__t120_compress_ucl_nrv2d_3_no_filter="\
|
||||
5a2a9af4e1020724207ce44f78c5b4a752926374d736ed9d0042937dcb4f5cb4 *amd64-linux.elf/upx-3.91
|
||||
157964226febb66aad14a9446ee7501e68108b8d319de0c67a2765099896a950 *amd64-linux.elf/upx-3.95
|
||||
84328c2e1cf60ede2d14f4146f6894a5f88bfd027ffccdcad411a05f4b11c6c4 *amd64-linux.elf/upx-3.91
|
||||
628c5714fce61ba99fb78619ad94317abe42508ccf1b6b89e3653ed1603576d4 *amd64-linux.elf/upx-3.95
|
||||
0314c6974f29d180e46e41a1004d46a3993fe96f03de7f78d45ad89ad3b2177e *amd64-win64.pe/upx-3.95.exe
|
||||
0f781a70828dc3b939988b96e70c0734cef3f4a7693624e61f7a678b0c8667a6 *arm-linux.elf/upx-3.95
|
||||
d7839b7dee866794e4ca3df32e2b1084b35aa22dee5f060fa14b5ca09c612ba3 *arm-wince.pe/upx-3.91.exe
|
||||
40afddfeaface0cb138b82771087af85bf099d35991e8f69653532ff972ab2d0 *arm64-linux.elf/upx-3.95
|
||||
db8aa50bf2b27ae3b4d9179c308d1fc174e788af61ddc5a46ede11af04ec69bb *arm64-linux.elf/upx-3.95
|
||||
7ebffb7cd7a0f95e82738cb58728334fe51b5174f54f807303d281e4594037cf *armeb-linux.elf/upx-3.91
|
||||
4a9d498ec0df4923ebb475f634c25f9b47eea115998adfd9c46b7dc4a561cf47 *armeb-linux.elf/upx-3.95
|
||||
4a434c3a14686786369c8bede8736d15e307ed7dd8c40cccb8f22003b05db968 *i386-dos32.djgpp2.coff/upx-3.91.exe
|
||||
@ -92,12 +92,12 @@ d05786b4b729f13a9b325322c2ea41ca7db6f60fee9f82c58874a25ee7eca086 *powerpc-linux.
|
||||
c4888e9ed7c587163b53246c2c0cb2c6118122feacfc5248f371d8f6c8783abd *powerpc64le-linux.elf/upx-3.95
|
||||
"
|
||||
expected_sha256sums__t130_compress_ucl_nrv2e_3_no_filter="\
|
||||
9a49d54b4c98579e466a0cd3f41a034de67f16224b172969ba2dd4b00cde48d8 *amd64-linux.elf/upx-3.91
|
||||
c3cb3cac214da748f585cc7378019202d605d92460d8fd00dc3187f1696db502 *amd64-linux.elf/upx-3.95
|
||||
24f1c2077016095f0cdebcef1546777e39fd1a76b39ce0ef9be2f11bb5e4a49f *amd64-linux.elf/upx-3.91
|
||||
2cb7327ce348741a8c6bd1b3d93005e042aee5c6f2f9ac16852c50dbbebc9f90 *amd64-linux.elf/upx-3.95
|
||||
97bb5953405f3413d9ff9bdc272caf2858697168b3e85dab54213da356b5ea0f *amd64-win64.pe/upx-3.95.exe
|
||||
0bf33b6b3f246093a7e15c4a51b0a15f40c7ec9c16fcd38613b8b66004a3b3cb *arm-linux.elf/upx-3.95
|
||||
8c73f5acfc70e3c518be09978af87b9bec4906240cb457a166da0eba05bea4db *arm-wince.pe/upx-3.91.exe
|
||||
bf2fc6aa005cb75e64c1c1c3afe304204ccf743f4b4ab2be45d33312f0c3ffa6 *arm64-linux.elf/upx-3.95
|
||||
99af85dd3d7fbf8a2b46f4c6d1dd1953dd9edf5816f9f2007361fd915a2321a2 *arm64-linux.elf/upx-3.95
|
||||
4be1831f03092f1c594115d95663f3d180c0066e10b9d8389f25a350a3976529 *armeb-linux.elf/upx-3.91
|
||||
c3ec4a5148e25f74f6c8dca92b608f65dc5539f9c5a0f839f801612b13505bd1 *armeb-linux.elf/upx-3.95
|
||||
d454dd376db342e7650a93bd4859546711c94f5da55336e5b969dbea996465d9 *i386-dos32.djgpp2.coff/upx-3.91.exe
|
||||
@ -115,12 +115,12 @@ fa3be8f93006a88c7ad3d9fd13f600c4f69745859eb76f7eab317a5b87d256ea *mipsel-linux.e
|
||||
cf8c7d3616c00e6709eea0ae335cc3959a8debdac3623076541f51724649a6cc *powerpc64le-linux.elf/upx-3.95
|
||||
"
|
||||
expected_sha256sums__t140_compress_lzma_2_no_filter="\
|
||||
282165e9db23bcf497cefb24ff563320dc482ae03605e303811efca0dbcb42a7 *amd64-linux.elf/upx-3.91
|
||||
abdf5ac2a7217c47670258c464c75306cf98f4523fb255444f70db3455194add *amd64-linux.elf/upx-3.95
|
||||
5e382e35684d069e54b1c3e06065049f604c6c63a326008fc5a8b07dfe580a09 *amd64-linux.elf/upx-3.91
|
||||
ce7a33574f54c79a6c774d390f51cefe3fa5628e7b50794e9235dcf5af3ab7de *amd64-linux.elf/upx-3.95
|
||||
b8815f95e92d6853a04a86069e9054115be2d9aa657fa2c8912d0f37e56c894f *amd64-win64.pe/upx-3.95.exe
|
||||
7a832eb6c3c33a04053786334c9e1953796ba2debacc754b5a18632ec987aa40 *arm-linux.elf/upx-3.95
|
||||
018242f330e19dd7ca2fb78687c0070ad88f1aa2e113be865c30ad3ff94a4ada *arm-wince.pe/upx-3.91.exe
|
||||
8d680bccb15aaa544bee556ee2878b97badced3e7938851862c31df81ccbab65 *arm64-linux.elf/upx-3.95
|
||||
5b98de43bde4295c6231417b88b356c3e97cf4d34908fee8037ca20c0943b37d *arm64-linux.elf/upx-3.95
|
||||
0a64b334793d1d6056241d0072afe8aa34d92ca5680192d05e1df90ca2f3c893 *armeb-linux.elf/upx-3.91
|
||||
895a9facf830fbcf2953adc0d7cf364fc5ab716f03940fc6165b49343c5253de *armeb-linux.elf/upx-3.95
|
||||
4e16bdab8b74ea5c7de4f255eec035189c24ac6374afef883c17696642c4fe16 *i386-dos32.djgpp2.coff/upx-3.91.exe
|
||||
@ -138,12 +138,12 @@ a214c035d403c1dc7b5d80d6cfd8e00e2278f8600332875f2e53e1c61648fdc2 *powerpc-linux.
|
||||
e614e62b002d3f8e900099d1683d17a932e8879c53de6b9a9d4a064f551afa8d *powerpc64le-linux.elf/upx-3.95
|
||||
"
|
||||
expected_sha256sums__t150_compress_ucl_2_all_filters="\
|
||||
9e00165e1608106a0d576a24e53d24bea149c132da319d1e4e42dc54b2ce7f08 *amd64-linux.elf/upx-3.91
|
||||
fc50dad7daeaed52fbbd319a46754ddbd08e7ff6bed199f16361d452ce57b496 *amd64-linux.elf/upx-3.95
|
||||
352c29b1409142882f937699929b7b5dc06bba8838f5bf3ca1395bc5ae182f48 *amd64-linux.elf/upx-3.91
|
||||
b120b86e3fcbcd3aae7f09a50018e811d9020f98f9726bff69bc74b03ea89d07 *amd64-linux.elf/upx-3.95
|
||||
434732efb16b89114162a1787a28c128e2c11edb9835411f2b707cac5cd475ae *amd64-win64.pe/upx-3.95.exe
|
||||
acbb1628a4631ec5ded40ec286c55544839f57a671ef925c89f81a7fff937954 *arm-linux.elf/upx-3.95
|
||||
93e2ead9e54732a1731896681d415e3ce60b7420ad7f3c57822ad7dbd061cdd3 *arm-wince.pe/upx-3.91.exe
|
||||
eab327d6f35c9c70d7de4da8ee06aee30624b88f534c49cc791ce2a72de460ce *arm64-linux.elf/upx-3.95
|
||||
dce835023a600f7a6760c38dc536d1f43f0df6f97aac9945d99cc8c29bc97e22 *arm64-linux.elf/upx-3.95
|
||||
9d6b8ef721a9af947f8439c5e6805da9ecadf8e5e41f1e5ef54c40f3c8395db2 *armeb-linux.elf/upx-3.91
|
||||
591f023a8c6506cf8113fcb8a8672d0044890d60c6b9372a7eeeb40c9f5af464 *armeb-linux.elf/upx-3.95
|
||||
2957b481e67689a5ad43dcfdfde207b9eb16142c161f3e43fd0eeff5917fefbd *i386-dos32.djgpp2.coff/upx-3.91.exe
|
||||
@ -161,12 +161,12 @@ e3825daa7fb8d509590c1db347a8403dbd899da453fb43850ebf1d31abbe0cba *powerpc-linux.
|
||||
3b246002f2dff8e44cf3c2cd2c64701514a1354c27b616c9a704f542df30e04f *powerpc64le-linux.elf/upx-3.95
|
||||
"
|
||||
expected_sha256sums__t160_compress_all_methods_1_no_filter="\
|
||||
4d6e7ba9e9e90b33120e313f2670f797d035d2534225b9a4706744fbf5bb3cf5 *amd64-linux.elf/upx-3.91
|
||||
520254ad0392618ce75641c9606c27d63427986e37a2fbb4e355db2d62afb785 *amd64-linux.elf/upx-3.95
|
||||
095796a3c7949b8f7776a87983fe74f70e61dd47254bd3f1834234b11ae4f6bf *amd64-linux.elf/upx-3.91
|
||||
fb0f758cca710724004f3e5fcc33bbf3403e54ee4c9470c665724acbb6b1b3cc *amd64-linux.elf/upx-3.95
|
||||
f38ff7edc916c1a3e82020035667de858c89d52c98d960dad0e21b4da444ed6c *amd64-win64.pe/upx-3.95.exe
|
||||
2481a933d3f1bcaed047e9cbc81ae227351e86e7c6c761c4756faea0c525aeb6 *arm-linux.elf/upx-3.95
|
||||
bb475839ec547696aaccf4da202b99be927c872e5de298a5eb1f0be0edc06d1d *arm-wince.pe/upx-3.91.exe
|
||||
0c2264c309866b25772210f179499352b335db309ea4e3cffa0363f0b815f0ca *arm64-linux.elf/upx-3.95
|
||||
d7495b7dc13ba9cb7893bd585009b1c89174068de77c01e356ac9069dd8d3a11 *arm64-linux.elf/upx-3.95
|
||||
d33a702da5d0c46e744056c24e8323360223ed8e1be07660eecc28ade7b5fc75 *armeb-linux.elf/upx-3.91
|
||||
57790e4d030d32d19ae6ba2a485a5bc6f7244c7e65d3ec4c8b0afe395927dd83 *armeb-linux.elf/upx-3.95
|
||||
8673a20ba4b83e25daab30431ed215dcb35f595fa0cabf67ff57368a07ba4c14 *i386-dos32.djgpp2.coff/upx-3.91.exe
|
||||
@ -184,12 +184,12 @@ c37806b0d68697276cdd208ab37c92e01055bfbab73c6bbdf054c95fe9cef3b9 *powerpc-linux.
|
||||
bdd174f8e00e1364fba1f821b56e0083fb9993d2bab9e3a93fced8f66ccc84c7 *powerpc64le-linux.elf/upx-3.95
|
||||
"
|
||||
expected_sha256sums__t170_compress_all_methods_no_lzma_5_no_filter="\
|
||||
4b7c186404b4d029454e6041551e0e8c75a14281c4f1e9aa5292e525cd2752a6 *amd64-linux.elf/upx-3.91
|
||||
9766ab5bb49b7f6dbf9e7dece1f95294b055a94024c25f6c377c9614f58cfedd *amd64-linux.elf/upx-3.95
|
||||
9c0cbd5abc56d506be45a411613883079adbf3e5ff7f5652fd6cc2808bc4212a *amd64-linux.elf/upx-3.91
|
||||
3aa2b0388df377ca3f450332f7c223461e2884f66228e99e1373f4a35f1be4f8 *amd64-linux.elf/upx-3.95
|
||||
5fccb0f5044baaa74d176efb25eefa3b5810dc737ed0f9d38084d275f7ebe7b8 *amd64-win64.pe/upx-3.95.exe
|
||||
90e56eefcce87542dbbc65e54c83c7e921a747877cbe489089c6043165b4f334 *arm-linux.elf/upx-3.95
|
||||
56be0b4046accdfadbe534ecb6e6452b9e3a18bb9eac39da0ee8893c31d24416 *arm-wince.pe/upx-3.91.exe
|
||||
fcb30463df67e4e948cf250625011a4cc5b64c7db7e11e5dbfcd63bdb475e332 *arm64-linux.elf/upx-3.95
|
||||
77dde1deababe02b6504a54bb90b083e20485816bbe65fba98df8890142eea64 *arm64-linux.elf/upx-3.95
|
||||
0925e9f13460111685bcf3e695a0e191a083f43149cb0a2e6f93ca68f414614b *armeb-linux.elf/upx-3.91
|
||||
03e9bb54264382f17dc15e451b9aff634e41d0b3e14585350479bf143b612c09 *armeb-linux.elf/upx-3.95
|
||||
6f9fbac216cd42aa370cb90965e74669daf33fd403bf0a250aaec06dd3439009 *i386-dos32.djgpp2.coff/upx-3.91.exe
|
||||
|
||||
@ -757,8 +757,8 @@ tmp/arm64-expand.o: $(srcdir)/src/$$T.S
|
||||
$(call tc,gcc) -c $< -o $@
|
||||
arm64-linux-objdump-2.25 -Dr $(tc_objdump_disasm_options) tmp/$T.o | $(RTRIM) > tmp/$T.o.disasm
|
||||
|
||||
tmp/arm64-linux.elf-main2.o : $(srcdir)/src/$$T.c
|
||||
$(call tc,gcc) -c -Os $< -o $@
|
||||
tmp/arm64-linux.elf-main2.o : $(srcdir)/src/$$T.c $(srcdir)/src/amd64-linux.elf-main2.c
|
||||
$(call tc,gcc) -c -Os $(srcdir)/src/arm64-linux.elf-main2.c -o $@
|
||||
$(call tc,f-objstrip,$@)
|
||||
|
||||
tmp/arm64-linux.elf-so_main.o : $(srcdir)/src/$$T.c
|
||||
|
||||
141
src/stub/amd64-linux.elf-entry.h
generated
141
src/stub/amd64-linux.elf-entry.h
generated
@ -1,5 +1,5 @@
|
||||
/* amd64-linux.elf-entry.h
|
||||
created from amd64-linux.elf-entry.bin, 1109 (0x455) bytes
|
||||
created from amd64-linux.elf-entry.bin, 1161 (0x489) bytes
|
||||
|
||||
This file is part of the UPX executable compressor.
|
||||
|
||||
@ -32,79 +32,82 @@
|
||||
|
||||
/* clang-format off */
|
||||
|
||||
#define STUB_AMD64_LINUX_ELF_ENTRY_SIZE 1109
|
||||
#define STUB_AMD64_LINUX_ELF_ENTRY_ADLER32 0x1d1a3b3a
|
||||
#define STUB_AMD64_LINUX_ELF_ENTRY_CRC32 0x9b761203
|
||||
#define STUB_AMD64_LINUX_ELF_ENTRY_SIZE 1161
|
||||
#define STUB_AMD64_LINUX_ELF_ENTRY_ADLER32 0xd1f34e96
|
||||
#define STUB_AMD64_LINUX_ELF_ENTRY_CRC32 0xa3acf450
|
||||
|
||||
unsigned char stub_amd64_linux_elf_entry[1109] = {
|
||||
unsigned char stub_amd64_linux_elf_entry[1161] = {
|
||||
/* 0x0000 */ 127, 69, 76, 70, 2, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
||||
/* 0x0010 */ 1, 0, 62, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
||||
/* 0x0020 */ 0, 0, 0, 0, 0, 0, 0, 0,240, 1, 0, 0, 0, 0, 0, 0,
|
||||
/* 0x0020 */ 0, 0, 0, 0, 0, 0, 0, 0, 40, 2, 0, 0, 0, 0, 0, 0,
|
||||
/* 0x0030 */ 0, 0, 0, 0, 64, 0, 0, 0, 0, 0, 64, 0, 0, 0, 0, 0,
|
||||
/* 0x0040 */ 89, 84, 95, 81,232, 54, 1, 0, 0,232, 49, 1, 0, 0, 72,139,
|
||||
/* 0x0040 */ 89, 84, 95, 81,232,107, 1, 0, 0,232,102, 1, 0, 0, 72,139,
|
||||
/* 0x0050 */ 7, 72,139, 79, 8, 72,131,199, 16, 72,131,248, 6,116, 12, 72,
|
||||
/* 0x0060 */ 199,193, 0, 16, 0, 0, 72,133,192,117,227, 72,247,217, 81, 82,
|
||||
/* 0x0070 */ 104,117,112,120, 0, 84, 95,190, 16, 0, 0, 0,184, 63, 1, 0,
|
||||
/* 0x0080 */ 0,232, 6, 1, 0, 0, 73,137,196, 89, 72,141, 61,171,255,255,
|
||||
/* 0x0090 */ 255,139, 15, 72, 41,207, 72,141, 53, 0, 0, 0, 0,173,147, 65,
|
||||
/* 0x00a0 */ 137,221,173,146,131,194, 16, 82,106,255, 87, 72, 41,217, 81, 72,
|
||||
/* 0x00b0 */ 1,251, 83, 84, 93, 72, 41,212, 72,131,228,192, 84, 95,173, 80,
|
||||
/* 0x00c0 */ 173,102,131,248, 2,116, 1,244, 88, 72, 1,240, 80, 85, 49,219,
|
||||
/* 0x00d0 */ 49,201, 72,141, 21,200, 0, 0, 0,106,255, 93,252,168,164,255,
|
||||
/* 0x00e0 */ 210,114,251,141, 65, 1,255,210, 17,192,255,210,115,248,131,232,
|
||||
/* 0x00f0 */ 3,114, 12,193,224, 8,172,131,240,255,116, 47, 72, 99,232,141,
|
||||
/* 0x0100 */ 65, 1,255,210, 17,201,255,210, 17,201,117, 13,137,193,131,192,
|
||||
/* 0x0110 */ 2,255,210, 17,201,255,210,115,248,129,253, 0,243,255,255, 17,
|
||||
/* 0x0120 */ 193, 86, 72,141, 52, 47,243,164, 94,235,180, 93, 89, 72, 57,206,
|
||||
/* 0x0130 */ 116, 1,244, 72,139, 69, 48, 72,137, 4, 36, 72,139, 85, 32, 72,
|
||||
/* 0x0140 */ 131,234, 16, 84, 94, 76,137,231,106, 1, 88,232, 60, 0, 0, 0,
|
||||
/* 0x0150 */ 85, 92, 69, 41,201, 77,137,224,106, 1, 65, 90, 82, 94,106, 7,
|
||||
/* 0x0160 */ 90, 41,255,106, 9, 88,232, 33, 0, 0, 0, 80, 72,137, 69, 24,
|
||||
/* 0x0170 */ 65, 80, 95,106, 3, 88, 15, 5, 88, 72,131,192, 8,255,224, 72,
|
||||
/* 0x0180 */ 139, 7, 72,131,199, 8, 72,133,192,117,244,195, 80, 15, 5, 89,
|
||||
/* 0x0190 */ 72, 61, 0,240,255,255,114, 1,244,195, 72,139, 60, 36,102,175,
|
||||
/* 0x01a0 */ 195, 1,219,116, 2,243,195,139, 30, 72,131,238,252, 17,219,243,
|
||||
/* 0x01b0 */ 195, 0, 0, 0, 0, 0, 0, 0,102,105,108,101, 32,102,111,114,
|
||||
/* 0x01c0 */ 109, 97,116, 32,101,108,102, 54, 52, 45,120, 56, 54, 45, 54, 52,
|
||||
/* 0x01d0 */ 10, 10, 83,101, 99,116,105,111,110,115, 58, 10, 73,100,120, 32,
|
||||
/* 0x01e0 */ 78, 97,109,101, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 83,105,
|
||||
/* 0x01f0 */ 122,101, 32, 32, 32, 32, 32, 32, 86, 77, 65, 32, 32, 32, 32, 32,
|
||||
/* 0x0200 */ 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 76, 77, 65, 32, 32, 32,
|
||||
/* 0x0210 */ 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 70,105,108,101,
|
||||
/* 0x0220 */ 32,111,102,102, 32, 32, 65,108,103,110, 32, 32, 70,108, 97,103,
|
||||
/* 0x0230 */ 115, 10, 32, 32, 48, 32, 69, 76, 70, 77, 65, 73, 78, 88, 32, 32,
|
||||
/* 0x0240 */ 32, 32, 32, 32, 48, 49, 55, 49, 32, 32, 48, 32, 32, 48, 32, 32,
|
||||
/* 0x0250 */ 48, 52, 48, 32, 32, 50, 42, 42, 48, 32, 32, 67, 79, 78, 84, 69,
|
||||
/* 0x0260 */ 78, 84, 83, 10, 32, 32, 49, 32, 69, 76, 70, 77, 65, 73, 78, 90,
|
||||
/* 0x0270 */ 32, 32, 32, 32, 32, 32, 48, 52, 32, 32, 48, 32, 32, 48, 32, 32,
|
||||
/* 0x0280 */ 48, 49, 98, 52, 32, 32, 50, 42, 42, 50, 32, 32, 67, 79, 78, 84,
|
||||
/* 0x0290 */ 69, 78, 84, 83, 10, 83, 89, 77, 66, 79, 76, 32, 84, 65, 66, 76,
|
||||
/* 0x02a0 */ 69, 58, 10, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48,
|
||||
/* 0x02b0 */ 48, 48, 48, 32,108, 32, 32, 32, 32,100, 32, 32, 69, 76, 70, 77,
|
||||
/* 0x02c0 */ 65, 73, 78, 90, 32, 48, 32, 69, 76, 70, 77, 65, 73, 78, 90, 10,
|
||||
/* 0x02d0 */ 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48,
|
||||
/* 0x02e0 */ 32,108, 32, 32, 32, 32,100, 32, 32, 69, 76, 70, 77, 65, 73, 78,
|
||||
/* 0x02f0 */ 88, 32, 48, 32, 69, 76, 70, 77, 65, 73, 78, 88, 10, 48, 48, 48,
|
||||
/* 0x0300 */ 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 32,103, 32,
|
||||
/* 0x0310 */ 32, 32, 32, 32, 32, 32, 69, 76, 70, 77, 65, 73, 78, 88, 32, 48,
|
||||
/* 0x0320 */ 32, 95,115,116, 97,114,116, 10, 48, 48, 48, 48, 48, 48, 48, 48,
|
||||
/* 0x0330 */ 48, 48, 48, 48, 48, 48, 48, 48, 32, 32, 32, 32, 32, 32, 32, 32,
|
||||
/* 0x0340 */ 32, 42, 85, 78, 68, 42, 32, 48, 32, 79, 95, 66, 73, 78, 70, 79,
|
||||
/* 0x0350 */ 10, 10, 82, 69, 76, 79, 67, 65, 84, 73, 79, 78, 32, 82, 69, 67,
|
||||
/* 0x0360 */ 79, 82, 68, 83, 32, 70, 79, 82, 32, 91, 69, 76, 70, 77, 65, 73,
|
||||
/* 0x0370 */ 78, 88, 93, 58, 10, 79, 70, 70, 83, 69, 84, 32, 32, 32, 32, 32,
|
||||
/* 0x0380 */ 32, 32, 32, 32, 32, 32, 84, 89, 80, 69, 32, 32, 32, 32, 32, 32,
|
||||
/* 0x0390 */ 32, 32, 32, 32, 32, 32, 32, 32, 86, 65, 76, 85, 69, 10, 48, 48,
|
||||
/* 0x03a0 */ 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 53, 57, 32, 82,
|
||||
/* 0x03b0 */ 95, 88, 56, 54, 95, 54, 52, 95, 80, 67, 51, 50, 32, 32, 32, 32,
|
||||
/* 0x03c0 */ 32, 69, 76, 70, 77, 65, 73, 78, 90, 43, 48,120,102,102,102,102,
|
||||
/* 0x03d0 */ 102,102,102,102,102,102,102,102,102,102,102, 99, 10, 10, 82, 69,
|
||||
/* 0x03e0 */ 76, 79, 67, 65, 84, 73, 79, 78, 32, 82, 69, 67, 79, 82, 68, 83,
|
||||
/* 0x03f0 */ 32, 70, 79, 82, 32, 91, 69, 76, 70, 77, 65, 73, 78, 90, 93, 58,
|
||||
/* 0x0400 */ 10, 79, 70, 70, 83, 69, 84, 32, 32, 32, 32, 32, 32, 32, 32, 32,
|
||||
/* 0x0410 */ 32, 32, 84, 89, 80, 69, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,
|
||||
/* 0x0420 */ 32, 32, 32, 32, 86, 65, 76, 85, 69, 10, 48, 48, 48, 48, 48, 48,
|
||||
/* 0x0430 */ 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 32, 82, 95, 88, 56, 54,
|
||||
/* 0x0440 */ 95, 54, 52, 95, 51, 50, 32, 32, 32, 32, 32, 32, 32, 79, 95, 66,
|
||||
/* 0x0450 */ 73, 78, 70, 79, 10
|
||||
/* 0x0080 */ 0, 15, 5,133,192,121, 45,133,246,116, 4, 49,246,235,237,232,
|
||||
/* 0x0090 */ 17, 0, 0, 0,192, 1, 0, 0, 2, 0, 65, 0, 47,100,101,118,
|
||||
/* 0x00a0 */ 47,115,104,109, 0, 94,173,146,173, 86,150, 95,106, 2, 88,232,
|
||||
/* 0x00b0 */ 13, 1, 0, 0, 73,137,196, 89, 72,141, 61,125,255,255,255,139,
|
||||
/* 0x00c0 */ 15, 72, 41,207, 72,141, 53, 0, 0, 0, 0,173,147, 65,137,221,
|
||||
/* 0x00d0 */ 173,146,131,194, 16, 82,106,255, 87, 72, 41,217, 81, 72, 1,251,
|
||||
/* 0x00e0 */ 83, 84, 93, 72, 41,212, 72,131,228,192, 84, 95,173, 80,173,102,
|
||||
/* 0x00f0 */ 131,248, 2,116, 1,244, 88, 72, 1,240, 80, 85, 49,219, 49,201,
|
||||
/* 0x0100 */ 72,141, 21,207, 0, 0, 0,106,255, 93,252,168,164,255,210,114,
|
||||
/* 0x0110 */ 251,141, 65, 1,255,210, 17,192,255,210,115,248,131,232, 3,114,
|
||||
/* 0x0120 */ 12,193,224, 8,172,131,240,255,116, 47, 72, 99,232,141, 65, 1,
|
||||
/* 0x0130 */ 255,210, 17,201,255,210, 17,201,117, 13,137,193,131,192, 2,255,
|
||||
/* 0x0140 */ 210, 17,201,255,210,115,248,129,253, 0,243,255,255, 17,193, 86,
|
||||
/* 0x0150 */ 72,141, 52, 47,243,164, 94,235,180, 93, 89, 72, 57,206,116, 1,
|
||||
/* 0x0160 */ 244, 72,139, 69, 48, 72,137, 4, 36, 72,139, 85, 32, 72,131,234,
|
||||
/* 0x0170 */ 16, 84, 94, 76,137,231, 82,106, 1, 88,232, 66, 0, 0, 0, 72,
|
||||
/* 0x0180 */ 1,198, 41,194,117,241, 94, 85, 92, 77, 49,201, 77,137,224,106,
|
||||
/* 0x0190 */ 1, 65, 90,106, 7, 90, 41,255,106, 9, 88,232, 33, 0, 0, 0,
|
||||
/* 0x01a0 */ 80, 72,137, 69, 24, 65, 80, 95,106, 3, 88, 15, 5, 88, 72,131,
|
||||
/* 0x01b0 */ 192, 8,255,224, 72,139, 7, 72,131,199, 8, 72,133,192,117,244,
|
||||
/* 0x01c0 */ 195, 80, 15, 5, 89, 72, 61, 0,240,255,255,114, 1,244,195, 72,
|
||||
/* 0x01d0 */ 139, 60, 36,102,175,195, 1,219,116, 2,243,195,139, 30, 72,131,
|
||||
/* 0x01e0 */ 238,252, 17,219,243,195, 0, 0, 0, 0, 0, 0,102,105,108,101,
|
||||
/* 0x01f0 */ 32,102,111,114,109, 97,116, 32,101,108,102, 54, 52, 45,120, 56,
|
||||
/* 0x0200 */ 54, 45, 54, 52, 10, 10, 83,101, 99,116,105,111,110,115, 58, 10,
|
||||
/* 0x0210 */ 73,100,120, 32, 78, 97,109,101, 32, 32, 32, 32, 32, 32, 32, 32,
|
||||
/* 0x0220 */ 32, 32, 83,105,122,101, 32, 32, 32, 32, 32, 32, 86, 77, 65, 32,
|
||||
/* 0x0230 */ 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 76, 77,
|
||||
/* 0x0240 */ 65, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,
|
||||
/* 0x0250 */ 70,105,108,101, 32,111,102,102, 32, 32, 65,108,103,110, 32, 32,
|
||||
/* 0x0260 */ 70,108, 97,103,115, 10, 32, 32, 48, 32, 69, 76, 70, 77, 65, 73,
|
||||
/* 0x0270 */ 78, 88, 32, 32, 32, 32, 32, 32, 48, 49, 97, 54, 32, 32, 48, 32,
|
||||
/* 0x0280 */ 32, 48, 32, 32, 48, 52, 48, 32, 32, 50, 42, 42, 48, 32, 32, 67,
|
||||
/* 0x0290 */ 79, 78, 84, 69, 78, 84, 83, 10, 32, 32, 49, 32, 69, 76, 70, 77,
|
||||
/* 0x02a0 */ 65, 73, 78, 90, 32, 32, 32, 32, 32, 32, 48, 52, 32, 32, 48, 32,
|
||||
/* 0x02b0 */ 32, 48, 32, 32, 48, 49,101, 56, 32, 32, 50, 42, 42, 50, 32, 32,
|
||||
/* 0x02c0 */ 67, 79, 78, 84, 69, 78, 84, 83, 10, 83, 89, 77, 66, 79, 76, 32,
|
||||
/* 0x02d0 */ 84, 65, 66, 76, 69, 58, 10, 48, 48, 48, 48, 48, 48, 48, 48, 48,
|
||||
/* 0x02e0 */ 48, 48, 48, 48, 48, 48, 48, 32,108, 32, 32, 32, 32,100, 32, 32,
|
||||
/* 0x02f0 */ 69, 76, 70, 77, 65, 73, 78, 90, 32, 48, 32, 69, 76, 70, 77, 65,
|
||||
/* 0x0300 */ 73, 78, 90, 10, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48,
|
||||
/* 0x0310 */ 48, 48, 48, 48, 32,108, 32, 32, 32, 32,100, 32, 32, 69, 76, 70,
|
||||
/* 0x0320 */ 77, 65, 73, 78, 88, 32, 48, 32, 69, 76, 70, 77, 65, 73, 78, 88,
|
||||
/* 0x0330 */ 10, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48,
|
||||
/* 0x0340 */ 48, 32,103, 32, 32, 32, 32, 32, 32, 32, 69, 76, 70, 77, 65, 73,
|
||||
/* 0x0350 */ 78, 88, 32, 48, 32, 95,115,116, 97,114,116, 10, 48, 48, 48, 48,
|
||||
/* 0x0360 */ 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 32, 32, 32, 32,
|
||||
/* 0x0370 */ 32, 32, 32, 32, 32, 42, 85, 78, 68, 42, 32, 48, 32, 79, 95, 66,
|
||||
/* 0x0380 */ 73, 78, 70, 79, 10, 10, 82, 69, 76, 79, 67, 65, 84, 73, 79, 78,
|
||||
/* 0x0390 */ 32, 82, 69, 67, 79, 82, 68, 83, 32, 70, 79, 82, 32, 91, 69, 76,
|
||||
/* 0x03a0 */ 70, 77, 65, 73, 78, 88, 93, 58, 10, 79, 70, 70, 83, 69, 84, 32,
|
||||
/* 0x03b0 */ 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 84, 89, 80, 69, 32, 32,
|
||||
/* 0x03c0 */ 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 86, 65, 76, 85,
|
||||
/* 0x03d0 */ 69, 10, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48,
|
||||
/* 0x03e0 */ 56, 55, 32, 82, 95, 88, 56, 54, 95, 54, 52, 95, 80, 67, 51, 50,
|
||||
/* 0x03f0 */ 32, 32, 32, 32, 32, 69, 76, 70, 77, 65, 73, 78, 90, 43, 48,120,
|
||||
/* 0x0400 */ 102,102,102,102,102,102,102,102,102,102,102,102,102,102,102, 99,
|
||||
/* 0x0410 */ 10, 10, 82, 69, 76, 79, 67, 65, 84, 73, 79, 78, 32, 82, 69, 67,
|
||||
/* 0x0420 */ 79, 82, 68, 83, 32, 70, 79, 82, 32, 91, 69, 76, 70, 77, 65, 73,
|
||||
/* 0x0430 */ 78, 90, 93, 58, 10, 79, 70, 70, 83, 69, 84, 32, 32, 32, 32, 32,
|
||||
/* 0x0440 */ 32, 32, 32, 32, 32, 32, 84, 89, 80, 69, 32, 32, 32, 32, 32, 32,
|
||||
/* 0x0450 */ 32, 32, 32, 32, 32, 32, 32, 32, 86, 65, 76, 85, 69, 10, 48, 48,
|
||||
/* 0x0460 */ 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 32, 82,
|
||||
/* 0x0470 */ 95, 88, 56, 54, 95, 54, 52, 95, 51, 50, 32, 32, 32, 32, 32, 32,
|
||||
/* 0x0480 */ 32, 79, 95, 66, 73, 78, 70, 79, 10
|
||||
};
|
||||
|
||||
1808
src/stub/amd64-linux.elf-fold.h
generated
1808
src/stub/amd64-linux.elf-fold.h
generated
File diff suppressed because it is too large
Load Diff
1992
src/stub/arm64-linux.elf-fold.h
generated
1992
src/stub/arm64-linux.elf-fold.h
generated
File diff suppressed because it is too large
Load Diff
@ -118,12 +118,29 @@ AT_PAGESZ= 6 // /usr/include/elf.h
|
||||
neg %rcx; push %rcx // F_PMASK
|
||||
push %rdx // F_RDX
|
||||
|
||||
// Create anonymous temporary file on mfd
|
||||
push $'u'|('p'<<8)|('x'<<16)|(0<<24)
|
||||
#define arg2l esi
|
||||
#define arg3l edx
|
||||
// Create anonymous temporary file on mfd; like upxfd_create
|
||||
push $'u'|('p'<<8)|('x'<<16)|(0<<24) // MATCH_22
|
||||
push %rsp; pop %arg1 // "upx"
|
||||
mov $MFD_EXEC,%arg2l
|
||||
movl $__NR_memfd_create,%eax; call sys_check; mov %rax,%r12 // mfd
|
||||
pop %rcx // discard "upx"
|
||||
0: // try memfd_create
|
||||
movl $__NR_memfd_create,%eax; syscall
|
||||
test %eax,%eax; jns ok_memfd // success
|
||||
test %arg2l,%arg2l; jz no_memfd // memfd_create failed twice
|
||||
xor %arg2l,%arg2l; jmp 0b // try again without MFD_EXEC
|
||||
no_memfd: // so try /dev/shm
|
||||
O_RDWR= 2
|
||||
O_DIRECTORY= 0200000 // 0x010000
|
||||
O_TMPFILE= 020000000 // 0x400000
|
||||
call 0f; .int 0700, O_RDWR|O_DIRECTORY|O_TMPFILE; .asciz "/dev/shm"; 0: pop %rsi
|
||||
lodsl; xchg %eax,%arg3l
|
||||
lodsl; push %rsi; xchg %eax,%arg2l
|
||||
pop %arg1
|
||||
push $__NR_open; pop %rax; call sys_check
|
||||
ok_memfd:
|
||||
mov %rax,%r12 // mfd
|
||||
pop %rcx // MATCH_22 discard "upx"
|
||||
|
||||
lea sz_pack2(%rip),%rdi
|
||||
mov (%rdi),%ecx // sz_pack2: length before stub
|
||||
@ -242,15 +259,19 @@ eof_n2b:
|
||||
sub $INSURANCE,%arg3 // memcheck limit
|
||||
push %rsp; pop %arg2 // buffer
|
||||
mov %r12,%arg1 // mfd
|
||||
push %arg3 // MATCH_21 save LENU
|
||||
0: // /dev/shm might be restricted to 8KiB at a time!
|
||||
push $__NR_write; pop %rax; call sys_check
|
||||
add %rax,%arg2 // advance ptr
|
||||
sub %eax,%arg3l; jnz 0b // decrement count
|
||||
pop %arg2 // MATCH_21 restore LENU to mmap.len
|
||||
// de-alloca()
|
||||
push old_sp; pop %rsp
|
||||
|
||||
// Map unfolded code the SELinux way
|
||||
sub %arg6l,%arg6l // 0 offset
|
||||
xor %arg6,%arg6 // 0 offset
|
||||
mov %r12,%arg5 // mfd
|
||||
push $MAP_SHARED; pop %sys4
|
||||
push %arg3; pop %arg2 // LENU
|
||||
push $PROT_WRITE|PROT_READ|PROT_EXEC; pop %arg3 // FIXME: add PROT_WRITE for DEBUG only
|
||||
subl %edi,%edi // (%arg1)dst = 0; // kernel chooses addr
|
||||
push $__NR_mmap; pop %rax; call sys_check
|
||||
|
||||
@ -216,8 +216,23 @@ my_bkpt: .globl my_bkpt
|
||||
proc_self_exe:
|
||||
.asciz "/proc/self/exe"
|
||||
|
||||
memfd_create: .globl memfd_create
|
||||
mov $__NR_memfd_create,%eax; jmp sysgo2
|
||||
upxfd_create: .globl upxfd_create // (char *tag, unsigned flags)
|
||||
0: // try memfd_create
|
||||
movl $__NR_memfd_create,%eax; syscall
|
||||
test %eax,%eax; jns ok_memfd // success
|
||||
test %arg2l,%arg2l; jz no_memfd // memfd_create failed twice
|
||||
xor %arg2l,%arg2l; jmp 0b // try again without MFD_EXEC
|
||||
no_memfd: // so try /dev/shm
|
||||
O_RDWR= 2
|
||||
O_DIRECTORY= 0200000 // 0x010000
|
||||
O_TMPFILE= 020000000 // 0x400000
|
||||
call 0f; .int 0700, O_RDWR|O_DIRECTORY|O_TMPFILE; .asciz "/dev/shm"; 0: pop %rsi
|
||||
lodsl; xchg %eax,%arg3l
|
||||
lodsl; push %rsi; xchg %eax,%arg2l
|
||||
pop %arg1
|
||||
push $__NR_open; pop %rax; call sys_check
|
||||
ok_memfd:
|
||||
ret
|
||||
|
||||
Pmap: .globl Pmap // page-align the lo end
|
||||
mov PAGE_MASK(%rip),%rax; not %rax // frag mask
|
||||
@ -230,6 +245,7 @@ mmap: .globl mmap
|
||||
sysgo: # NOTE: kernel demands 4th arg in %sys4, NOT %arg4
|
||||
movzbl %al,%eax
|
||||
sysgo2:
|
||||
sys_check:
|
||||
push %rax // save __NR_
|
||||
syscall // %rax= -errno
|
||||
pop %rcx // recover __NR_
|
||||
|
||||
@ -34,6 +34,9 @@
|
||||
#endif //}
|
||||
|
||||
#include "include/linux.h"
|
||||
// memfd_create, but fall back to /dev/shm
|
||||
// such as Ubuntu-20.04, Linux kernel 5.15.0-67, #74-20.04.1, 2023-02-22
|
||||
extern int upxfd_create(char const *tag, unsigned flags);
|
||||
#define MFD_EXEC 0x0010
|
||||
|
||||
extern void *memcpy(void *dst, void const *src, size_t n);
|
||||
@ -259,7 +262,7 @@ make_hatch_x86_64(
|
||||
((long *)hatch)[0] = 0xc35a050f; // syscall; pop %arg3{%rdx); ret
|
||||
}
|
||||
else { // Does not fit at hi end of .text, so must use a new page "permanently"
|
||||
int mfd = memfd_create(addr_string("upx"), MFD_EXEC); // the directory entry
|
||||
int mfd = upxfd_create(addr_string("upx"), MFD_EXEC); // the directory entry
|
||||
write(mfd, addr_string("\x0f\x05\x5a\xc3"), sz_code);
|
||||
hatch = mmap(0, sz_code, PROT_READ|PROT_EXEC, MAP_SHARED, mfd, 0);
|
||||
close(mfd);
|
||||
@ -294,7 +297,7 @@ make_hatch_ppc64(
|
||||
memcpy(hatch, code, sz_code);
|
||||
}
|
||||
else { // Does not fit at hi end of .text, so must use a new page "permanently"
|
||||
int mfd = memfd_create(addr_string("upx"), MFD_EXEC); // the directory entry
|
||||
int mfd = upxfd_create(addr_string("upx"), MFD_EXEC); // the directory entry
|
||||
write(mfd, code, sz_code);
|
||||
hatch = mmap(0, sz_code, PROT_READ|PROT_EXEC, MAP_SHARED, mfd, 0);
|
||||
close(mfd);
|
||||
@ -329,7 +332,7 @@ make_hatch_arm64(
|
||||
memcpy(hatch, code, sz_code);
|
||||
}
|
||||
else { // Does not fit at hi end of .text, so must use a new page "permanently"
|
||||
int mfd = memfd_create(addr_string("upx"), MFD_EXEC); // the directory entry
|
||||
int mfd = upxfd_create(addr_string("upx"), MFD_EXEC); // the directory entry
|
||||
write(mfd, code, sz_code);
|
||||
hatch = mmap(0, sz_code, PROT_READ|PROT_EXEC, MAP_SHARED, mfd, 0);
|
||||
close(mfd);
|
||||
@ -551,7 +554,7 @@ do_xmap(
|
||||
// Cannot set PROT_EXEC except via mmap() into a region (Linux "vma")
|
||||
// that has never had PROT_WRITE. So use a Linux-only "memory file"
|
||||
// to hold the contents.
|
||||
mfd = memfd_create(addr_string("upx"), MFD_EXEC); // the directory entry
|
||||
mfd = upxfd_create(addr_string("upx"), MFD_EXEC); // the directory entry
|
||||
ftruncate(mfd, mlen); // Allocate the pages in the file.
|
||||
if (frag) {
|
||||
// Note: *addr does not exist yet, and figuring out a substitute
|
||||
|
||||
@ -319,8 +319,10 @@ space3eq:
|
||||
.ascii " ="
|
||||
proc_self_exe:
|
||||
.asciz "/proc/self/exe"
|
||||
.balign 4
|
||||
devshm:
|
||||
.asciz "/dev/shm"
|
||||
|
||||
.balign 4
|
||||
f_unfilter: // (char *ptr, uint len, uint cto, uint fid)
|
||||
ptr .req x0
|
||||
len .req x1
|
||||
@ -497,8 +499,24 @@ brk: do_sys __NR_brk; ret
|
||||
.globl munmap
|
||||
munmap: do_sys __NR_munmap; ret
|
||||
|
||||
.globl memfd_create
|
||||
memfd_create: do_sys __NR_memfd_create; ret
|
||||
ufdc_bits: .int O_RDWR|O_DIRECTORY|O_TMPFILE
|
||||
upxfd_create: .globl upxfd_create // (char *tag, unsigned flags)
|
||||
0: // try memfd_create
|
||||
mov w8,#__NR_memfd_create; svc #0
|
||||
tst w0,w0; bpl ok_memfd // success
|
||||
cbz w1, no_memfd // memfd_create failed twice
|
||||
mov w1,#0; b 0b // try again without MFD_EXEC
|
||||
no_memfd: // so try /dev/shm
|
||||
O_RDWR= 2
|
||||
O_DIRECTORY= 0200000 // 0x010000
|
||||
O_TMPFILE= 020000000 // 0x400000
|
||||
mov w3,#0700
|
||||
ldr w2,ufdc_bits
|
||||
adr x1,devshm
|
||||
mov w0,#AT_FDCWD
|
||||
mov w8,#__NR_openat; svc #0
|
||||
ok_memfd:
|
||||
ret
|
||||
|
||||
.globl ftruncate
|
||||
ftruncate: do_sys __NR_ftruncate; ret
|
||||
|
||||
@ -7,14 +7,14 @@
|
||||
*/
|
||||
|
||||
#if defined(__i386__) //}{
|
||||
#define addr_string(string) ({ \
|
||||
#define addr_string(string) (char *)({ \
|
||||
char const *str; \
|
||||
asm("call 0f; .asciz \"" string "\"; 0: pop %0" \
|
||||
/*out*/ : "=r"(str) ); \
|
||||
str; \
|
||||
})
|
||||
#elif defined(__arm__) //}{
|
||||
#define addr_string(string) ({ \
|
||||
#define addr_string(string) (char *)({ \
|
||||
char const *str; \
|
||||
asm("bl 0f; .string \"" string "\"; .balign 4; 0: mov %0,lr" \
|
||||
/*out*/ : "=r"(str) \
|
||||
|
||||
6
src/stub/tmp/amd64-linux.elf-entry.bin.dump
generated
vendored
6
src/stub/tmp/amd64-linux.elf-entry.bin.dump
generated
vendored
@ -2,8 +2,8 @@ file format elf64-x86-64
|
||||
|
||||
Sections:
|
||||
Idx Name Size VMA LMA File off Algn Flags
|
||||
0 ELFMAINX 0171 0 0 040 2**0 CONTENTS
|
||||
1 ELFMAINZ 04 0 0 01b4 2**2 CONTENTS
|
||||
0 ELFMAINX 01a6 0 0 040 2**0 CONTENTS
|
||||
1 ELFMAINZ 04 0 0 01e8 2**2 CONTENTS
|
||||
SYMBOL TABLE:
|
||||
0000000000000000 l d ELFMAINZ 0 ELFMAINZ
|
||||
0000000000000000 l d ELFMAINX 0 ELFMAINX
|
||||
@ -12,7 +12,7 @@ SYMBOL TABLE:
|
||||
|
||||
RELOCATION RECORDS FOR [ELFMAINX]:
|
||||
OFFSET TYPE VALUE
|
||||
0000000000000059 R_X86_64_PC32 ELFMAINZ+0xfffffffffffffffc
|
||||
0000000000000087 R_X86_64_PC32 ELFMAINZ+0xfffffffffffffffc
|
||||
|
||||
RELOCATION RECORDS FOR [ELFMAINZ]:
|
||||
OFFSET TYPE VALUE
|
||||
|
||||
34
src/stub/tmp/amd64-linux.elf-fold.map
generated
vendored
34
src/stub/tmp/amd64-linux.elf-fold.map
generated
vendored
@ -46,24 +46,24 @@ LOAD tmp/amd64-expand.o
|
||||
LOAD tmp/amd64-linux.elf-main2.o
|
||||
OUTPUT(tmp/amd64-linux.elf-fold.bin elf64-x86-64)
|
||||
|
||||
SYSCALLS 0x0000000000000000 0x8e
|
||||
SYSCALLS 0x0000000000000000 0x8e tmp/amd64-linux.elf-fold.o
|
||||
0x0000000000000018 Pmap
|
||||
0x000000000000006a munmap
|
||||
0x000000000000007a ftruncate
|
||||
0x000000000000002a mmap
|
||||
0x0000000000000086 write
|
||||
0x0000000000000011 memfd_create
|
||||
0x000000000000008a read
|
||||
SYSCALLS 0x0000000000000000 0xc0
|
||||
SYSCALLS 0x0000000000000000 0xc0 tmp/amd64-linux.elf-fold.o
|
||||
0x000000000000004a Pmap
|
||||
0x000000000000009c munmap
|
||||
0x00000000000000ac ftruncate
|
||||
0x000000000000005c mmap
|
||||
0x00000000000000b8 write
|
||||
0x00000000000000bc read
|
||||
0x0000000000000011 upxfd_create
|
||||
0x0000000000000000 my_bkpt
|
||||
0x0000000000000045 Pprotect
|
||||
0x0000000000000086 Pwrite
|
||||
0x000000000000005a Punmap
|
||||
0x000000000000006e exit
|
||||
0x0000000000000072 brk
|
||||
0x000000000000007e open
|
||||
0x0000000000000082 mprotect
|
||||
0x0000000000000076 close
|
||||
0x0000000000000077 Pprotect
|
||||
0x00000000000000b8 Pwrite
|
||||
0x000000000000008c Punmap
|
||||
0x00000000000000a0 exit
|
||||
0x00000000000000a4 brk
|
||||
0x00000000000000b0 open
|
||||
0x00000000000000b4 mprotect
|
||||
0x00000000000000a8 close
|
||||
|
||||
LZMA_DEC10 0x0000000000000000 0x9f7
|
||||
LZMA_DEC10 0x0000000000000000 0x9f7 tmp/amd64-expand.o
|
||||
|
||||
32
src/stub/tmp/arm64-linux.elf-fold.map
generated
vendored
32
src/stub/tmp/arm64-linux.elf-fold.map
generated
vendored
@ -12,17 +12,17 @@ LOAD tmp/arm64-expand.o
|
||||
LOAD tmp/arm64-linux.elf-main2.o
|
||||
OUTPUT(tmp/arm64-linux.elf-fold.bin elf64-littleaarch64)
|
||||
|
||||
.text 0x0000000000000000 0xa98
|
||||
.text 0x0000000000000000 0x240 tmp/arm64-linux.elf-fold.o
|
||||
.text 0x0000000000000000 0xaa0
|
||||
.text 0x0000000000000000 0x248 tmp/arm64-linux.elf-fold.o
|
||||
0x0000000000000008 get_page_mask
|
||||
0x0000000000000018 mmap_privanon
|
||||
0x0000000000000028 mmap
|
||||
0x0000000000000044 Pprotect
|
||||
0x0000000000000044 mprotect
|
||||
.text 0x0000000000000240 0x0 tmp/arm64-expand.o
|
||||
.text 0x0000000000000240 0x858 tmp/arm64-linux.elf-main2.o
|
||||
0x00000000000008f4 underlay
|
||||
0x0000000000000960 upx_main
|
||||
.text 0x0000000000000248 0x0 tmp/arm64-expand.o
|
||||
.text 0x0000000000000248 0x858 tmp/arm64-linux.elf-main2.o
|
||||
0x00000000000008fc underlay
|
||||
0x0000000000000968 upx_main
|
||||
|
||||
.data 0x0000000000000000 0x0
|
||||
.data 0x0000000000000000 0x0 tmp/arm64-linux.elf-fold.o
|
||||
@ -34,8 +34,8 @@ OUTPUT(tmp/arm64-linux.elf-fold.bin elf64-littleaarch64)
|
||||
.bss 0x0000000000000000 0x0 tmp/arm64-expand.o
|
||||
.bss 0x0000000000000000 0x0 tmp/arm64-linux.elf-main2.o
|
||||
|
||||
SYSCALLS 0x0000000000000000 0xe0
|
||||
SYSCALLS 0x0000000000000000 0xe0 tmp/arm64-linux.elf-fold.o
|
||||
SYSCALLS 0x0000000000000000 0x110
|
||||
SYSCALLS 0x0000000000000000 0x110 tmp/arm64-linux.elf-fold.o
|
||||
0x0000000000000000 my_bkpt
|
||||
0x0000000000000008 exit
|
||||
0x0000000000000010 read
|
||||
@ -44,14 +44,14 @@ SYSCALLS 0x0000000000000000 0xe0
|
||||
0x0000000000000034 getpid
|
||||
0x0000000000000040 brk
|
||||
0x000000000000004c munmap
|
||||
0x0000000000000058 memfd_create
|
||||
0x0000000000000064 ftruncate
|
||||
0x0000000000000070 unlink
|
||||
0x0000000000000084 readlink
|
||||
0x000000000000008c open
|
||||
0x00000000000000a8 __clear_cache
|
||||
0x00000000000000bc memcpy
|
||||
0x00000000000000d0 memset
|
||||
0x000000000000005c upxfd_create
|
||||
0x0000000000000094 ftruncate
|
||||
0x00000000000000a0 unlink
|
||||
0x00000000000000b4 readlink
|
||||
0x00000000000000bc open
|
||||
0x00000000000000d8 __clear_cache
|
||||
0x00000000000000ec memcpy
|
||||
0x0000000000000100 memset
|
||||
|
||||
EXP_HEAD 0x0000000000000000 0x104
|
||||
EXP_HEAD 0x0000000000000000 0x104 tmp/arm64-expand.o
|
||||
|
||||
Loading…
Reference in New Issue
Block a user