# US 2024/0176623 A1 · Method and apparatus for determining binary function entry

> Agents: this data is available as JSON from the patentgrep API and MCP server — see https://patentgrep.com/llms.txt

- Number: US 2024/0176623 A1
- Document ID: US20240176623A1
- Status: Published application
- Kind: A1
- Application number: 18/360,011
- Filed: 2023-07-27
- Published: 2024-05-30
- Earliest claimed: 2022-11-29
- Assignees: Korea Advanced Institute of Science and Technology
- Applicants: Korea Advanced Institute of Science and Technology
- Inventors: Sang Kil CHA; Hyungseok KIM; Junoh LEE; Soomin KIM
- Web page: https://patentgrep.com/patent/US20240176623A1

## CPC

- G06F 8/53: Decompilation; Disassembly
- G06F 8/427: {Parsing}
- G06F 8/433: {Dependency analysis; Data or control flow analysis}
- G06F 8/4435: {Detection or removal of dead or redundant code}
- G06F 9/30058: {Conditional branch instructions}
- G06F: ELECTRIC DIGITAL DATA PROCESSING (computer systems based on specific computational models G06N)

## Abstract

A method for determining a binary function entry includes distinguishing a text section and an exception handling section by parsing a binary code, disassembling the text section to determine an address of an end branch instruction, an address of a direct call target, and an address of a direct jump target, determining an indirect return function call address from the addresses of the end branch instructions, determining an exception handling block address from the addresses of the end branch instructions, excluding the indirect return function call address and the exception handling block address from the addresses of the end branch instructions and determining a tail call corresponding to the binary function entry from the addresses of the direct jump targets.

## Claims

### Claim 1

A method for determining a binary function entry, the method comprising:
distinguishing a text section and an exception handling section by parsing a binary code;
disassembling the text section to determine an address of an end branch instruction, an address of a direct call target, and an address of a direct jump target;
determining an indirect return function call address from the addresses of the end branch instructions;
determining an exception handling block address from the addresses of the end branch instructions;
excluding the indirect return function call address and the exception handling block address from the addresses of the end branch instructions; and
determining a tail call corresponding to the binary function entry from the addresses of the direct jump targets.

### Claim 2 (depends on 1)

The method of claim 1, wherein the binary function entry is determined as a union of an address set excluding the indirect return function call address and the exception handling block address from the addresses of the end branch instructions, an address set of the direct call target and an address set of the tail call.

### Claim 3 (depends on 1)

The method of claim 1, wherein the end branch instruction represents an indirect branch target.

### Claim 4 (depends on 1)

The method of claim 1, wherein the determining indirect return function call address comprises:
checking whether there is a preceding call instruction which refers to a procedure linking table in a target instruction;
extracting a target function name from the target instruction when there is the preceding call instruction which refers to the procedure linking table in the target instruction; and
comparing the target function name with names of predefined reference indirect return functions.

### Claim 5 (depends on 4)

The method of claim 4, wherein the predefined reference indirect return functions include a setjmp function and a vfork function.

### Claim 6 (depends on 5)

The method of claim 5, wherein the predefined reference indirect return functions further include a sigsetjmp function, a savectx function, and a getcontext function.

### Claim 7 (depends on 1)

The method of claim 1, wherein, in the determining the tail call, when a destination of a jump instruction is above a function including the jump instruction, the destination of the jump instruction is determined as the tail call.

### Claim 8 (depends on 1)

The method of claim 1, wherein, in the determining the tail call, when a destination of a jump instruction is a destination of jump instructions of two or more functions, the destination of the jump instruction is determined as the tail call.

### Claim 9 (depends on 1)

The method of claim 1, wherein, in the determining the tail call, when a destination of a jump instruction is above a function including the jump instruction and is a destination of jump instructions of two or more functions, the destination of the jump instruction is determined as the tail call.

### Claim 10 (depends on 9)

The method of claim 9, wherein when func_range(x) represents an address range of a function including an address x, represents a set of address pairs (a, b) of addresses a of direct jump instruction and the addresses b of the direct jump targets corresponding to the addresses a of the direct jump instructions, represents an address of the tail call, C1={b|(a,b)∈∧(b<min(func_range(a))∨b>max(func_range(a)))} and C2={b|(a,b)∈∧(c,b)∈∨func_range(a)≠func_range(c)}, =C1∩C2 is satisfied.

### Claim 11 (depends on 1)

The method of claim 1, wherein the end branch instructions are located at the binary function entry, the indirect return function call address and the exception handling block address.

### Claim 12 (depends on 1)

The method of claim 1, wherein the binary function entry includes the end branch instruction, the direct call target or the direct jump target.

### Claim 13

An apparatus for determining a binary function entry, the apparatus comprising:
a parser configured to parse a binary code to distinguish a text section and an exception handling section;
a disassembler configured to disassemble the text section to determine an address of an end branch instruction, an address of a direct call target, and an address of a direct jump target;
a filter configured to determine an indirect return function call address and an exception handling block address from the addresses of the end branch instructions, and exclude the indirect return function call address and the exception handling block address from the addresses of the end branch instructions; and
a tail call selector configured to determine a tail call corresponding to the binary function entry from the addresses of the direct jump targets.

### Claim 14 (depends on 13)

The apparatus of claim 13, wherein the binary function entries are determined as a union of an address set excluding the indirect return function call address and the exception handling block address from the addresses of the end branch instructions, an address set of the direct call targets and an address set of the tail calls.

### Claim 15 (depends on 13)

The apparatus of claim 13, wherein the end branch instruction represents an indirect branch target.

### Claim 16 (depends on 13)

The apparatus of claim 13, wherein when a destination of a jump instruction is above a function including the jump instruction and is a destination of jump instructions of two or more functions, the tail call selector is configured to determine the destination of the jump instruction as the tail call.

### Claim 17 (depends on 16)

The apparatus of claim 16, wherein when func_range(x) represents an address range of a function including an address x, represents a set of address pairs (a, b) of addresses a of direct jump instruction and the addresses b of the direct jump targets corresponding to the addresses a of the direct jump instructions, represents an address of the tail call, C1={b|(a,b)∈∧(b<min(func_range(a))∨b>max(func_range(a)))} and C2={b|(a,b)∈∧(c,b)∈∧func_range(a)≠func_range(c)}, =C1∩C2 is satisfied.

### Claim 18

A method for determining a binary function entry, the method comprising:
generating an end branch instruction address from a binary code as a candidate set;
excluding an indirect return function call address and an exception handling block address from the candidate set; and
determining an address of a tail call function and including the address of the tail call function in the candidate set.

### Claim 19 (depends on 18)

The method of claim 18, wherein when a destination of a jump instruction is above a function including the jump instruction and is a destination of jump instructions of two or more functions, the destination of the jump instruction is determined as the address of the tail call function.
