BRANCHLESS SOFTWARE CONTROL FLOW INTEGRITY ENFORCEMENT
The present disclosure relates to branchless control flow integrity enforcement. A value of an instruction located at an indirect branch target may be moved into a first register. A result of an add instruction with the value of the instruction and a value of an inverse of a landing pad instruction may be moved into a second register. Based on one or more memory accesses, it may be determined whether a value of the second register is nonzero. In response to determining that the value of the second register is nonzero, a segmentation fault may be caused.
The present disclosure relates to enforcing control flow integrity.
BACKGROUNDThe control flow of a program is the order in which the program's individual statements are evaluated or executed. Control flow integrity (CFI) is a security property of a program related to whether the actual transitions of the program's control flow at runtime follow the control flow intended by the program's developer. CFI can be violated by, for instance, a control flow hijacking attack, where an attacker gains control over a code pointer, which references a specific location in memory whether some piece of executable code resides. Manipulating a code pointer enables the attacker to redirect the program's control flow to code of their choosing. CFI enforcement mechanisms seek to strengthen programs against such attacks. For example, an attacker could use a form of memory corruption primitive to overwrite an indirect branch target and divert the intended control flow to potentially malicious code.
Various mechanisms exist for enforcing CFI. One example of such a mechanism is indirect branch tracking (IBT). In IBT, the callsite of an indirect branch can be tied to a target that starts with a landing pad instruction—in this case, the endbranch instruction. The endbranch instruction marks an indirect branch target as valid. At the callsite, before the program jumps to the target, the program reads the instruction located at the beginning of the indirect branch target, checks to see whether this instruction matches an expected endbranch instruction, and only proceeds with the indirect branch if the check succeeds.
Consider the following x86 assembly code:
-
- global _start
- section .text
- target_valid:
- endbr64
- ret
- _start:
- mov rbx, target_valid
- mov eax, [rbx]
- cmp eax, 0xfa1e0ff3
- je succeed
- int3
- succeed:
- call rbx
The address of the target_valid label is first moved into the rbx register. The, the bytes located at the memory address stored in rbx—the value of the endbranch instruction, endbr64—is moved into the eax register. Then, the cmp instruction compares the value of the endbr64 instruction (loaded into eax) with the bytes that represent endbr64. If the comparison is successful, then the conditional jump je succeed jumps to the succeed label, which executes endbr64 to validate the indirect branch target and allow the indirect branch to proceed. Otherwise, the int3 instruction triggers a breakpoint interrupt so that the indirect branch does not proceed. Note, however, that this code is merely an example used to illustrate the concepts discussed above.
But a typical CFI mechanism as implemented in paragraph 0004 has multiple downsides. For example, it involves performing a branch and a comparison, which pollutes the branch predictor. The branch predictor, which is a part of the central processing unit (CPU), involves an internal cache stores the target addresses of branches that were previously taken. Thus, because a CFI check is performed before every indirect branch, every indirect branch results in another entry in the branch predictor, which makes the branch predictor less efficient. As another example downside, the CFI mechanism in paragraph 0004 is coarse-grained—an indirect branch can only be allowed or disallowed. If an attacker manages to hijack the control flow, the attacker can redirect the control flow to any endbranch instruction.
Thus, it would be desirable to have CFI enforcement that avoids polluting the branch predictor and enables fine-grained validation of indirect branch targets.
The approaches described in this section are approaches that could be pursued, but not necessarily approaches that have been previously conceived or pursued. Therefore, unless otherwise indicated, it should not be assumed that any of the approaches described in this section qualify as prior art merely by virtue of their inclusion in this section.
In the drawings:
In the following description, for the purposes of explanation, numerous specific details are set forth in order to provide a thorough understanding of the present invention. It will be apparent, however, that the present invention may be practiced without these specific details. In other instances, well-known structures and devices are shown in block diagram form in order to avoid unnecessarily obscuring the present invention.
General OverviewThe present disclosure relates to branchless control flow integrity enforcement. The disclosed approaches may achieve branchless CFI enforcement using virtual memory management mechanisms. For example, the address space of a process may be configured to comprise multiple different memory regions with different access permissions and a reference address. The bytes of an indirect branch target may be loaded into a register, and that value may be used as an offset from the reference address to perform one or more memory accesses that will fall in one of the memory regions. The one or more memory accesses may be configured so that a memory access will fall in a memory region that is readable if the offset matches an expected value, while a memory access will fall in a memory region that is not readable if the offset does not match the expected value. If the offset causes a memory access to fall in a region that is not readable, then the memory access fails and the program terminates, thereby indicating a breach in CFI. A greater number of regions may be used to limit the number of memory accesses while increasing setup cost, while a fewer number of memory regions may be used to decrease setup cost at the expense of a greater number of memory accesses. This technique omits the cmp instruction and associated branch found in conventional CFI enforcement techniques, thereby avoiding pollution of the branch predictor.
This expected value may be the value of a landing pad instruction. A landing pad instruction marks an indirect branch target as valid. That is, the indirect branch target is considered valid if it starts with an expected landing pad instruction. The landing pad instruction may include, for example, an endbranch instruction, which is an instruction that should be present at the target of an indirect branch for the CPU to permit the branch in certain instruction set architectures. As another example, the landing pad instruction may be an instruction that includes an expected branch target identifier as an operand. A branch target identifier may be any hexadecimal value that identifies a particular branch target. An indirect branch target may be validated if it starts with an instruction that includes a value that matches a branch target identifier for the expected branch. Using a branch target identifier improves conventional CFI enforcement techniques by enabling fine-grained validation of indirect branches.
Branchless Control Flow Integrity EnforcementIn this example, computer 100 includes an address space 103 of a process executing a program. The address space 103 includes a range of memory addresses that the process may use. The address space 103 includes two consecutive memory regions: a check-allow region 106 and a check-deny region 109. The check-allow region 106 has readable permissions, while the check-deny region 109 does not have any access permissions. A size of each of the two memory regions may be a multiple of page size that is larger than the maximum value that can be encoded by the bytes taken by the endbranch instruction. For example, if the endbranch instruction is four bytes, each region may have a size of at least 0xffffffff.
The address space 103 may include reference address 112 located between the check-allow region 106 and the check-deny region 109. reference address 112 may be used as a reference point relative to check-allow region 106 and check-deny region 109 to verify whether an indirect branch target begins with a valid endbranch instruction. The address of the first instruction at the endbranch target is subtracted from the bytes of a valid endbranch instruction. Memory accesses may then be performed at addresses derived by adding and subtracting the result from reference address 112. If, then one of these memory accesses may cause a segmentation fault or other error, resulting in termination of the program by the operating system. This technique is more efficient than conventional CFI enforcement techniques because it does not perform a branch and therefore does not pollute the branch predictor.
To illustrate, consider the following code in an x86 assembly language. This code is merely an example used to illustrate the concepts discussed herein, and any code executable by a computing device like computer 100 to perform the operations described herein may be used.
-
- global _start
- section .text
- target_valid:
- endbr64
- ret
- _start:
- mov rbx, target_valid
- mov eax, [rbx]
- add rax, 0x5e1f00d
- test [reference address−rax], 0
- test [reference address+rax], 0
- call rbx
In this example, the address of target_valid is moved into the rbx register, and the address of rbx is dereferenced to move the bytes of endbr64 into register rax. An add instruction is then performed to add rax with the inverse of the value of endbr64. The result is stored in rax. If a valid endbranch instruction does exist at the location of target_valid, then the result of the instruction that is stored in rax would be zero. Otherwise, the result would be nonzero—which could indicate a breach of control flow integrity. Two test instructions are performed to check the result of the add: one test instruction that checks whether rax is now greater than zero, and another test instruction that checks whether rax is now less than zero. This example uses the test instruction because it performs memory access with little cost, but any suitable instruction that accesses memory may be used. In addition, any value may be used for the second parameter of each test instruction.
The first test instruction subtracts rax from reference address and accesses memory at the resulting address. If the value stored in rax is greater than zero—and thus the value located at target_valid is greater than endbr64—then the memory access will attempt to access check-deny region 109 and fail. The second test instruction adds rax to reference address and accesses memory at the resulting address. If the value stored in rax is less than zero—and thus the value located at target_valid is less than endbr64—then the memory access will likewise attempt to access check-deny region 109 and fail. Failure of either memory access may trigger a segmentation fault. If neither memory access fails, then the indirect branch proceeds as normal.
Branchless CFI Enforcement With Limited Memory AccessesIn this example, computer 200 includes an address space 203 of a process executing a program. The address space 203 includes a range of memory addresses that the process may use. The address space 203 includes three consecutive memory regions: a first check-deny region 206, a check-allow page 209, and a second check-deny region 212. check-allow page 209 may comprise a single page of memory. The first check-deny region 206 and the second check-deny region 212 may have a size equal to page size multiplied by 0xffffffff (e.g., 4 K). While the address space 203 may include a greater number of memory addresses than the address space 103 shown in
To illustrate, consider the following code in an x86 assembly language. This code is merely an example used to illustrate the concepts discussed herein, and any code executable by a computing device like computer 200 to perform the operations described herein may be used.
-
- global _start
- section .text
- target:
- endbr64
- ret
- _start:
- mov rbx, target
- mov eax, [rbx]
- add rax, 0x5e1f00d
- mul rax, <page_size>
- test [reference address+rax], 0
- call rbx
As with the technique described above, the address of target is moved into rbx, and the bytes of endbr64 are moved into rax by dereferencing rbx. An add instruction is then performed to add register rax with the inverse value of endbr64. If an endbranch instruction does exist at the location of target, then a result of zero would be stored in rax. Otherwise, the result would be nonzero, potentially indicating that CFI has been breached. Then, rax is multiplied by the page size (represented by the placeholder <page_size>). If rax is zero, then the result of the mul instruction would also be zero. In that case, the subsequent test instruction, which adds rax to reference address and accesses memory at the resulting address, would access memory within check-allow page 209. The indirect branch would then proceed as normal. On the other hand, if rax is nonzero, then the result of the mul instruction would be nonzero. The test instruction would therefore access memory within either the first check-deny region 206 or the second check-deny region 212 (and would not access check-allow page 209 because rax is multiplied by page size). The resulting segmentation fault would then let the operating system take action and terminate the program. As above, any suitable instruction that accesses memory may be used in place of test, and any value may be used for the second parameter of the test instruction.
Distingiuishing Different Branch TargetsThe endbranch instruction, however, may not be able to distinguish between different branch targets. The techniques described above may allow any endbranch instruction as a branch target.
To address this issue, a constant may be used as a branch target identifier to identify a valid branch target. A branch target identifier may be any hexadecimal value that identifies a particular branch target. Like with the endbranch instruction, if an indirect branch begins with bytes that match an expected branch target identifier, the indirect branch target may be considered valid. Otherwise, a violation of CFI may have occurred.
Instead of using the endbranch instruction, another instruction that accepts an immediate operand like a branch target identifier may be used. Any instruction that does not modify any register and has negligible impact on regular program execution (i.e., a semantic NOP) may be used. Assuming a page granularity of 4 KB, “buckets” of 0x100000 branch targets may be distinguishable. Thus, different branch target identifiers may be used to distinguish between different callsites. That way, an attack cannot redirect control flow to a branch target that does not include the expected branch target identifier. This technique may be used with various different address space configurations, such as those described in
To illustrate, consider the following x86 assembly code. This code is merely an example used to illustrate the concepts discussed herein, and any code executable by a computing device like computer 100 or computer 200 to perform the operations described herein may be used.
-
- global _start
- section .data
- m1: dd 0xdeadbeef
- section .text
- target:
- test rax, 0xdeadbeef
- ret
- _start:
- mov rbx, target
- mov eax, [rbx+2]
- test [reference address+m1+eax], 0 ; label+eax
- will be >=0 and <4096 for the right label bucket
- call rbx
In this example, the address of target is moved into the rbx register. target includes the test instruction, which accepts the four-byte immediate 0xdeadbeef, the value of which serves as a branch target identifier. The address of rbx plus a two-byte offset is dereferenced and loaded into eax. Considering the instruction “test rax, 0xdeadbeef” from target (which has been loaded into rbx), this two-byte offset is added to account for one byte representing the test opcode and one byte representing the label rax. Then, the subsequent test instruction accesses memory at the address given by adding m1 and eax to reference address. If the correct branch target identifier does not exist at target, reference address+m1+eax will attempt to access memory outside of the expected range for the branch target identifier and fail. The resulting segmentation fault would then allow the operating system to terminate the program.
Example Process For Branchless CFI EnforcementAt step 303, a target is moved into a register. The target may represent an indirect branch target that a currently-executing program is attempting to call. The value located at the target's address is loaded into a register. If no violation of CFI has occurred, this value would match the value of a landing pad instruction. A landing pad instruction is an instruction that marks an indirect branch target as valid—the indirect branch target is considered valid if it starts with an expected landing pad instruction. The landing pad instruction may include, for example, an endbranch instruction or an instruction that includes an expected branch target identifier, depending on the implementation. The target may be loaded by, for example, moving the target's address into one register and then dereferencing the target's address in another register.
At step 306, the target is added to an inverse value associated with the landing pad instruction. In implementations where the landing pad instruction is an endbranch instruction, the inverse value is the inverse of the value of the endbranch instruction (the inverse of endbr64 can be calculated by subtracting the 64-bit hexadecimal representation of endbr 64 from zero). If the landing pad instruction includes a branch target identifier, though, the inverse value is the inverse of the value of the branch target identifier (the inverse of a branch target identifier can be calculated by performing a bitwise NOT operation on the hexadecimal value of the branch target identifier). If the target is valid, then the result of this step would be zero because the target did include the expected landing pad instruction. Otherwise, if the result is nonzero, then the value read from the target is not the endbranch instruction, and a violation of CFI may have occurred.
At step 309, a memory access is performed to check whether the result of step 306 is greater than zero. The memory access may attempt to access an address given by subtracting the result from a reference address. The reference address may be located between two memory regions such as the check-allow region 106 and a check-deny region 109 shown in
At step 312, the process proceeds based on whether the memory access at step 309 was successful. A memory management unit (MMU) may check whether the memory access is allowed using page tables. If the memory access is not allowed (i.e., it falls within the check-deny region 109), then the memory access fails and the process proceeds to step 321. If the memory access is allowed (i.e., it falls within the check-allow region 106), then the memory access succeeds and the process proceeds to step 315.
At step 315, a memory access is performed to check whether the result of step 312 is less than zero. The memory access may attempt to access an address given by adding the result to the reference address. If the result of step 312 is less than zero, then the address accessed would in the check-deny region 109. If the result of step 312 is equal to zero, then the address accessed would fall in the check-allow region 106.
At step 318, the process proceeds based on whether the memory access at step 318 was successful. The MMU may check page tables to determine whether the memory access is allowed. If the memory access is not allowed (i.e., it falls within the check-deny region 109), then the memory access fails and the process proceeds to step 321. If the memory access is allowed (i.e., it falls within the check-allow region 106), then the memory access succeeds and the process proceeds to step 324.
At step 321, a segmentation fault occurs. When the MMU determines that a memory access is not allowed at step 312 and 318, the MMU may trigger a hardware exception, and the program that called the indirect branch target may terminate its execution. Then, an administrator may investigate what caused the segmentation fault and mitigate any violation of CFI.
At step 324, the indirect branch proceeds. Because no segmentation fault occurred as a result of the memory accesses at steps 309 and 315, no violation of CFI has been detected, and the indirect branch target is valid.
Example Process For Branchless CFI Enforcement With Limited Memory AccessesAt step 403, a target is moved into a register. The target may represent an indirect branch target that a currently-executing program is attempting to call. The value located at the target's address is loaded into a register. If no violation of CFI has occurred, this value would match the value of a landing pad instruction. A landing pad instruction is an instruction that marks an indirect branch target as valid—the indirect branch target is considered valid if it starts with an expected landing pad instruction. The landing pad instruction may include, for example, an endbranch instruction or an instruction that includes an expected branch target identifier, depending on the implementation. The target may be loaded by, for example, moving the target's address into one register and then dereferencing the target's address in another register.
At step 406, the target is added to an inverse value associated with the landing pad instruction. In implementations where the landing pad instruction is an endbranch instruction, the inverse value is the inverse of the value of the endbranch instruction (the inverse of endbr64 can be calculated by subtracting the 64-bit hexadecimal representation of endbr 64 from zero). If the landing pad instruction includes a branch target identifier, though, the inverse value is the inverse of the value of the branch target identifier (the inverse of a branch target identifier can be calculated by performing a bitwise NOT operation on the hexadecimal value of the branch target identifier). If the target is valid, then the result of this step would be zero because the target did include the expected landing pad instruction. Otherwise, if the result is nonzero, then the value read from the target is not the endbranch instruction, and a violation of CFI may have occurred.
At step 409, a memory access is performed to determine whether the result of step 406 is nonzero. The memory access may attempt to access an address given by adding the result of step 406 to reference address 215 and then multiplying that value by page size. Multiplying by page size in 406 ensures that the address will land outside of the check-allow page 209, and in the first check-deny region 206 or the second check-deny region 212, if the result of the addition in step 406 was nonzero.
At step 412, the process proceeds based on whether the memory access at step 409 was successful. A memory management unit (MMU) may check whether the memory access is allowed using page tables. If the memory access is not allowed (i.e., it falls within the check-deny region 206 or check-deny region 212), then the memory access fails and the process proceeds to step 415. If the memory access is allowed (i.e., it falls within the check-allow page 209), then the memory access succeeds and the process proceeds to step 418.
At step 415, a segmentation fault occurs. When the MMU determines that a memory access is not allowed at step 412, the MMU may trigger a hardware exception, and the program that called the indirect branch target may terminate its execution. Then, an administrator may investigate what caused the segmentation fault.
At step 418, the indirect branch proceeds. Because no segmentation fault occurred as a result of the memory access at step 409, no violation of CFI has been detected, and the indirect branch target is valid.
Hardware OverviewAccording to one embodiment, the techniques described herein are implemented by one or more special-purpose computing devices. The special-purpose computing devices may be hard-wired to perform the techniques, or may include digital electronic devices such as one or more application-specific integrated circuits (ASICs) or field programmable gate arrays (FPGAs) that are persistently programmed to perform the techniques, or may include one or more general purpose hardware processors programmed to perform the techniques pursuant to program instructions in firmware, memory, other storage, or a combination. Such special-purpose computing devices may also combine custom hard-wired logic, ASICs, or FPGAs with custom programming to accomplish the techniques. The special-purpose computing devices may be desktop computer systems, portable computer systems, handheld devices, networking devices or any other device that incorporates hard-wired and/or program logic to implement the techniques.
For example,
Computer system 500 also includes a main memory 506, such as a random access memory (RAM) or other dynamic storage device, coupled to bus 502 for storing information and instructions to be executed by processor 504. Main memory 506 also may be used for storing temporary variables or other intermediate information during execution of instructions to be executed by processor 504. Such instructions, when stored in non-transitory storage media accessible to processor 504, render computer system 500 into a special-purpose machine that is customized to perform the operations specified in the instructions.
Computer system 500 further includes a read only memory (ROM) 508 or other static storage device coupled to bus 502 for storing static information and instructions for processor 504. A storage device 510, such as a magnetic disk, optical disk, or solid-state drive is provided and coupled to bus 502 for storing information and instructions.
Computer system 500 may be coupled via bus 502 to a display 512, such as a cathode ray tube (CRT), for displaying information to a computer user. An input device 514, including alphanumeric and other keys, is coupled to bus 502 for communicating information and command selections to processor 504. Another type of user input device is cursor control 516, such as a mouse, a trackball, or cursor direction keys for communicating direction information and command selections to processor 504 and for controlling cursor movement on display 512. This input device typically has two degrees of freedom in two axes, a first axis (e.g., x) and a second axis (e.g., y), that allows the device to specify positions in a plane.
Computer system 500 may implement the techniques described herein using customized hard-wired logic, one or more ASICs or FPGAs, firmware and/or program logic which in combination with the computer system causes or programs computer system 500 to be a special-purpose machine. According to one embodiment, the techniques herein are performed by computer system 500 in response to processor 504 executing one or more sequences of one or more instructions contained in main memory 506. Such instructions may be read into main memory 506 from another storage medium, such as storage device 510. Execution of the sequences of instructions contained in main memory 506 causes processor 504 to perform the process steps described herein. In alternative embodiments, hard-wired circuitry may be used in place of or in combination with software instructions.
The term “storage media” as used herein refers to any non-transitory media that store data and/or instructions that cause a machine to operate in a specific fashion. Such storage media may comprise non-volatile media and/or volatile media. Non-volatile media includes, for example, optical disks, magnetic disks, or solid-state drives, such as storage device 510. Volatile media includes dynamic memory, such as main memory 506. Common forms of storage media include, for example, a floppy disk, a flexible disk, hard disk, solid-state drive, magnetic tape, or any other magnetic data storage medium, a CD-ROM, any other optical data storage medium, any physical medium with patterns of holes, a RAM, a PROM, and EPROM, a FLASH-EPROM, NVRAM, any other memory chip or cartridge.
Storage media is distinct from but may be used in conjunction with transmission media. Transmission media participates in transferring information between storage media. For example, transmission media includes coaxial cables, copper wire and fiber optics, including the wires that comprise bus 502. Transmission media can also take the form of acoustic or light waves, such as those generated during radio-wave and infra-red data communications.
Various forms of media may be involved in carrying one or more sequences of one or more instructions to processor 504 for execution. For example, the instructions may initially be carried on a magnetic disk or solid-state drive of a remote computer. The remote computer can load the instructions into its dynamic memory and send the instructions over a telephone line using a modem. A modem local to computer system 500 can receive the data on the telephone line and use an infra-red transmitter to convert the data to an infra-red signal. An infra-red detector can receive the data carried in the infra-red signal and appropriate circuitry can place the data on bus 502. Bus 502 carries the data to main memory 506, from which processor 504 retrieves and executes the instructions. The instructions received by main memory 506 may optionally be stored on storage device 510 either before or after execution by processor 504.
Computer system 500 also includes a communication interface 518 coupled to bus 502. Communication interface 518 provides a two-way data communication coupling to a network link 520 that is connected to a local network 522. For example, communication interface 518 may be an integrated services digital network (ISDN) card, cable modem, satellite modem, or a modem to provide a data communication connection to a corresponding type of telephone line. As another example, communication interface 518 may be a local area network (LAN) card to provide a data communication connection to a compatible LAN. Wireless links may also be implemented. In any such implementation, communication interface 518 sends and receives electrical, electromagnetic or optical signals that carry digital data streams representing various types of information.
Network link 520 typically provides data communication through one or more networks to other data devices. For example, network link 520 may provide a connection through local network 522 to a host computer 524 or to data equipment operated by an Internet Service Provider (ISP) 526. ISP 526 in turn provides data communication services through the world wide packet data communication network now commonly referred to as the “Internet” 528. Local network 522 and Internet 528 both use electrical, electromagnetic or optical signals that carry digital data streams. The signals through the various networks and the signals on network link 520 and through communication interface 518, which carry the digital data to and from computer system 500, are example forms of transmission media.
Computer system 500 can send messages and receive data, including program code, through the network(s), network link 520 and communication interface 518. In the Internet example, a server 530 might transmit a requested code for an application program through Internet 528, ISP 526, local network 522 and communication interface 518.
The received code may be executed by processor 504 as it is received, and/or stored in storage device 510, or other non-volatile storage for later execution.
In the foregoing specification, embodiments of the invention have been described with reference to numerous specific details that may vary from implementation to implementation. The specification and drawings are, accordingly, to be regarded in an illustrative rather than a restrictive sense. The sole and exclusive indicator of the scope of the invention, and what is intended by the applicants to be the scope of the invention, is the literal and equivalent scope of the set of claims that issue from this application, in the specific form in which such claims issue, including any subsequent correction.
Software OverviewSoftware system 600 is provided for directing the operation of computing system 500. Software system 600, which may be stored in system memory (RAM) 506 and on fixed storage (e.g., hard disk or flash memory) 510, includes a kernel or operating system (OS) 610.
The OS 610 manages low-level aspects of computer operation, including managing execution of processes, memory allocation, file input and output (I/O), and device I/O. One or more application programs, represented as 602A, 602B, 602C . . . 602N, may be “loaded” (e.g., transferred from fixed storage 510 into memory 506) for execution by the system 600. The applications or other software intended for use on computer system 500 may also be stored as a set of downloadable computer-executable instructions, for example, for downloading and installation from an Internet location (e.g., a Web server, an app store, or other online service).
Software system 600 includes a graphical user interface (GUI) 615, for receiving user commands and data in a graphical (e.g., “point-and-click” or “touch gesture”) fashion. These inputs, in turn, may be acted upon by the system 600 in accordance with instructions from operating system 610 and/or application(s) 602. The GUI 615 also serves to display the results of operation from the OS 610 and application(s) 602, whereupon the user may supply additional inputs or terminate the session (e.g., log off).
OS 610 can execute directly on the bare hardware 620 (e.g., processor(s) 504) of computer system 500. Alternatively, a hypervisor or virtual machine monitor (VMM) 630 may be interposed between the bare hardware 620 and the OS 610. In this configuration, VMM 630 acts as a software “cushion” or virtualization layer between the OS 610 and the bare hardware 620 of the computer system 500.
VMM 630 instantiates and runs one or more virtual machine instances (“guest machines”). Each guest machine comprises a “guest” operating system, such as OS 610, and one or more applications, such as application(s) 602, designed to execute on the guest operating system. The VMM 630 presents the guest operating systems with a virtual operating platform and manages the execution of the guest operating systems.
In some instances, the VMM 630 may allow a guest operating system to run as if it is running on the bare hardware 620 of computer system 600 directly. In these instances, the same version of the guest operating system configured to execute on the bare hardware 620 directly may also execute on VMM 630 without modification or reconfiguration. In other words, VMM 630 may provide full hardware and CPU virtualization to a guest operating system in some instances.
In other instances, a guest operating system may be specially designed or configured to execute on VMM 630 for efficiency. In these instances, the guest operating system is “aware” that it executes on a virtual machine monitor. In other words, VMM 630 may provide para-virtualization to a guest operating system in some instances.
A computer system process comprises an allotment of hardware processor time, and an allotment of memory (physical and/or virtual), the allotment of memory being for storing instructions executed by the hardware processor, for storing data generated by the hardware processor executing the instructions, and/or for storing the hardware processor state (e.g. content of registers) between allotments of the hardware processor time when the computer system process is not running. Computer system processes run under the control of an operating system, and may run under the control of other programs being executed on the computer system.
Cloud ComputingThe term “cloud computing” is generally used herein to describe a computing model which enables on-demand access to a shared pool of computing resources, such as computer networks, servers, software applications, and services, and which allows for rapid provisioning and release of resources with minimal management effort or service provider interaction.
A cloud computing environment (sometimes referred to as a cloud environment, or a cloud) can be implemented in a variety of different ways to best suit different requirements. For example, in a public cloud environment, the underlying computing infrastructure is owned by an organization that makes its cloud services available to other organizations or to the general public. In contrast, a private cloud environment is generally intended solely for use by, or within, a single organization. A community cloud is intended to be shared by several organizations within a community; while a hybrid cloud comprise two or more types of cloud (e.g., private, community, or public) that are bound together by data and application portability.
Generally, a cloud computing model enables some of those responsibilities which previously may have been provided by an organization's own information technology department, to instead be delivered as service layers within a cloud environment, for use by consumers (either within or external to the organization, according to the cloud's public/private nature). Depending on the particular implementation, the precise definition of components or features provided by or within each cloud service layer can vary, but common examples include: Software as a Service (SaaS), in which consumers use software applications that are running upon a cloud infrastructure, while a SaaS provider manages or controls the underlying cloud infrastructure and applications. Platform as a Service (PaaS), in which consumers can use software programming languages and development tools supported by a PaaS provider to develop, deploy, and otherwise control their own applications, while the PaaS provider manages or controls other aspects of the cloud environment (i.e., everything below the run-time execution environment). Infrastructure as a Service (IaaS), in which consumers can deploy and run arbitrary software applications, and/or provision processing, storage, networks, and other fundamental computing resources, while an IaaS provider manages or controls the underlying physical cloud infrastructure (i.e., everything below the operating system layer). Database as a Service (DBaaS) in which consumers use a database server or Database Management System that is running upon a cloud infrastructure, while a DbaaS provider manages or controls the underlying cloud infrastructure and applications.
The above-described basic computer hardware and software and cloud computing environment presented for purpose of illustrating the basic underlying computer components that may be employed for implementing the example embodiment(s). The example embodiment(s), however, are not necessarily limited to any particular computing environment or computing device configuration. Instead, the example embodiment(s) may be implemented in any type of system architecture or processing environment that one skilled in the art, in light of this disclosure, would understand as capable of supporting the features and functions of the example embodiment(s) presented herein.
In the foregoing specification, embodiments of the invention have been described with reference to numerous specific details that may vary from implementation to implementation. The specification and drawings are, accordingly, to be regarded in an illustrative rather than a restrictive sense. The sole and exclusive indicator of the scope of the invention, and what is intended by the applicants to be the scope of the invention, is the literal and equivalent scope of the set of claims that issue from this application, in the specific form in which such claims issue, including any subsequent correction.
In the foregoing specification, embodiments of the invention have been described with reference to numerous specific details that may vary from implementation to implementation. The specification and drawings are, accordingly, to be regarded in an illustrative rather than a restrictive sense. The sole and exclusive indicator of the scope of the invention, and what is intended by the applicants to be the scope of the invention, is the literal and equivalent scope of the set of claims that issue from this application, in the specific form in which such claims issue, including any subsequent correction.
Claims
1. A method comprising:
- moving, into a first register, a value of an instruction located at an indirect branch target;
- moving, into a second register, a result of an add instruction with the value of the instruction and a value of an inverse of a landing pad instruction;
- determining, based on one or more memory accesses, whether a value of the second register is nonzero; and
- in response to determining that the value of the second register is nonzero, causing a segmentation fault,
- wherein the method is performed by one or more computing devices.
2. The method of claim 1, wherein the one or more memory accesses caused by one or more test instructions.
3. The method of claim 1, wherein
- the one or more memory accesses comprise a first memory access and a second memory access,
- the first memory access accesses a first memory address that is based on subtracting the value of the second register from a reference address, and
- the second memory access accesses a second memory address that is based on adding the value of the second register to the reference address.
4. The method of claim 3, wherein
- an address space comprises of a process of the one or more computing devices comprises a first memory region with read permissions and a second memory region with no access permissions, and
- determining that the value of the second register is nonzero is based on the first memory address or the second memory address being located in the second memory region.
5. The method of claim 1, wherein the one or more memory accesses comprise a memory access, the method further comprising:
- moving, into the second register, the value of the second register multiplied by a page size; and
- wherein the memory accesses a memory address that is based on adding the value of the second register to a reference address.
6. The method of claim 1, wherein an address space of a process of the one or more computing devices comprises a first memory region with no access permissions, a second memory region with read access permissions, and a third memory region with no access permissions, and the method further comprises:
- determining that the value of the second register is nonzero is based on the memory address being located in the first memory region or the third memory region.
7. The method of claim 6, wherein the second memory region comprises a memory page.
8. The method of claim 1, wherein the landing pad instruction comprises a branch target identifier.
9. The method of claim 1, wherein the landing pad instruction comprises an endbranch instruction.
10. The method of claim 1, wherein the instruction is a first instruction, the indirect branch target is a first indirect branch target, and the one or more memory accesses are one or more first memory accesses, and the method further comprises:
- moving, into the first register, a value of a second instruction located at a second indirect branch target;
- moving, into the second register, a result of an add instruction comprising the value of the second instruction and the value of the inverse of the landing pad instruction;
- determining, based on one or more second memory accesses, whether the value of the second register is nonzero; and
- in response to determining that the value of the second register is not nonzero, executing an indirect branch corresponding to the indirect branch target.
11. One or more non-transitory storage media storing instructions which, when executed by one or more computing devices, cause:
- moving, into a first register, a value of an instruction located at an indirect branch target;
- moving, into a second register, a result of an add instruction with the value of the instruction and a value of an inverse of a landing pad instruction;
- determining, based on one or more memory accesses, whether a value of the second register is nonzero; and
- in response to determining that the value of the second register is nonzero, causing a segmentation fault.
12. The one or more non-transitory storage media of claim 11, wherein the one or more memory accesses caused by one or more test instructions.
13. The one or more non-transitory storage media of claim 11, wherein
- the one or more memory accesses comprise a first memory access and a second memory access,
- the first memory access accesses a first memory address that is based on subtracting the value of the second register from a reference address, and
- the second memory access accesses a second memory address that is based on adding the value of the second register to the reference address.
14. The one or more non-transitory storage media of claim 13, wherein
- an address space comprises of a process of the one or more computing devices comprises a first memory region with read permissions and a second memory region with no access permissions, and
- determining that the value of the second register is nonzero is based on the first memory address or the second memory address being located in the second memory region.
15. The one or more non-transitory storage media of claim 11, wherein the one or more memory accesses comprise a memory access, and the one or more instructions, when executed by one or more computing devices, further cause:
- moving, into the second register, the value of the second register multiplied by a page size; and
- wherein the memory accesses a memory address that is based on adding the value of the second register to a reference address.
16. The one or more non-transitory storage media of claim 11, wherein an address space of a process of the one or more computing devices comprises a first memory region with no access permissions, a second memory region with read access permissions, and the one or more instructions, when executed by one or more computing devices, further cause:
- determining that the value of the second register is nonzero is based on the memory address being located in the first memory region or the third memory region.
17. The one or more non-transitory storage media of claim 16, wherein the second memory region comprises a memory page.
18. The one or more non-transitory storage media of claim 11, wherein the landing pad instruction comprises a branch target identifier.
19. The one or more non-transitory storage media of claim 11, wherein the landing pad instruction comprises an endbranch instruction.
20. The one or more non-transitory storage media of claim 11, wherein the instruction is a first instruction, the indirect branch target is a first indirect branch target, and the one or more memory accesses are one or more first memory accesses, and the one or more instructions, when executed by one or more computing devices, further cause:
- moving, into the first register, a value of a second instruction located at a second indirect branch target;
- moving, into the second register, a result of an add instruction comprising the value of the second instruction and the value of the inverse of the landing pad instruction;
- determining, based on one or more second memory accesses, whether the value of the second register is nonzero; and
- in response to determining that the value of the second register is not nonzero, executing an indirect branch corresponding to the indirect branch target.
Type: Application
Filed: May 20, 2025
Publication Date: Nov 26, 2026
Inventors: Matthias Neugschwandtner (Perchtoldsdorf), Lukas Stadler (Linz), David Leopoldseder (Vienna)
Application Number: 19/213,107