Commit d931762
committed
Add RISC-V fileless fetch payload support
Add riscv64le and riscv32le architecture support to the fileless
fetch payload adapter. This enables in-memory ELF execution via
memfd_create on RISC-V Linux targets without writing to disk.
The first-stage shellcode (52 bytes, 13 instructions) performs:
memfd_create("") -> ftruncate(fd, 0) -> getpid() -> kill(pid, SIGSTOP)
Uses getpid + kill(SIGSTOP) instead of pause, as pause is not
available in the asm-generic syscall table used by RISC-V. This
matches the existing aarch64 approach.
The jump stub uses auipc + ld/lw + jalr to load and branch to an
absolute address embedded after the instruction sequence (20 bytes
for rv64, 16 bytes for rv32).
Only RV32I/RV64I base integer instructions are used. The sole
difference between the two variants is sd vs sw for the stack
store.1 parent aee4762 commit d931762
1 file changed
Lines changed: 58 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
138 | 138 | | |
139 | 139 | | |
140 | 140 | | |
| 141 | + | |
| 142 | + | |
| 143 | + | |
| 144 | + | |
| 145 | + | |
| 146 | + | |
| 147 | + | |
| 148 | + | |
| 149 | + | |
| 150 | + | |
| 151 | + | |
| 152 | + | |
| 153 | + | |
| 154 | + | |
| 155 | + | |
| 156 | + | |
| 157 | + | |
| 158 | + | |
| 159 | + | |
| 160 | + | |
| 161 | + | |
| 162 | + | |
| 163 | + | |
| 164 | + | |
| 165 | + | |
| 166 | + | |
| 167 | + | |
| 168 | + | |
| 169 | + | |
| 170 | + | |
| 171 | + | |
| 172 | + | |
| 173 | + | |
| 174 | + | |
| 175 | + | |
| 176 | + | |
| 177 | + | |
| 178 | + | |
| 179 | + | |
| 180 | + | |
| 181 | + | |
| 182 | + | |
141 | 183 | | |
142 | 184 | | |
143 | 185 | | |
| |||
204 | 246 | | |
205 | 247 | | |
206 | 248 | | |
| 249 | + | |
| 250 | + | |
| 251 | + | |
| 252 | + | |
| 253 | + | |
| 254 | + | |
| 255 | + | |
| 256 | + | |
| 257 | + | |
| 258 | + | |
| 259 | + | |
| 260 | + | |
| 261 | + | |
| 262 | + | |
| 263 | + | |
| 264 | + | |
207 | 265 | | |
208 | 266 | | |
209 | 267 | | |
| |||
0 commit comments