Research Article
IRePf: An Instruction Reorganization Virtual Platform for Kernel Stack Overflow Detection
Algorithm 2
Instruction modification.
| Input: source code fragments scodep and ins | | Output: reorganization code fragments rcodep | (1) | thirdaddress ← COMPUTER (Original address and parameters of ins) | (2) | If thirdaddress is an immediate data then | (3) | firstaddress ← thirdaddress, call step (15) in Algorithm 1 | (4) | else | (5) | firstins ← ins//first jump instructions | (6) | newins ← PUSH thirdaddress | (7) | newscodep ← Adding an instruction newins after the last instruction of scodep | (8) | plataddress ← The entry address of IRePf | (9) | inins ← Adding conditional transfer instruction secondins, the jump address is plataddress | (10) | rcodep ← Adding an instruction inins after newins in newscodep | (11) | re_fragment[j][1] ← rcodep; re_fragment[j][2] ← secondaddress; j ← j + 1 | (12) | addresstable[n][2] ← (firstaddress, secondaddress); false ← true | (13) | End If |
|