forked from vbpf/ebpf-verifier
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Emit ModRM Correctly When Register R12 Is Used (vbpf#534)
When register R12 is used in an instruction requiring a ModRM byte, the semantics and encoding of the instruction are unique. The emit_modrm_and_displacement function did not handle this uniqueness properly. This patch modifies the function to handle the use of R12 correctly. Fixes vbpf#529 Signed-off-by: Will Hawkins <[email protected]>
- Loading branch information
Showing
4 changed files
with
120 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
# Copyright (c) Big Switch Networks, Inc | ||
# SPDX-License-Identifier: Apache-2.0 | ||
-- asm | ||
mov %r0, 0 | ||
mov %r2, %r1 | ||
mov %r7, %r1 | ||
mov %r8, %r1 | ||
add %r7, 1 | ||
add %r8, 2 | ||
ldxb %r0, [%r2+0] | ||
ldxb %r7, [%r7+0] | ||
ldxb %r8, [%r8+0] | ||
add %r0, %r7 | ||
add %r0, %r8 | ||
exit | ||
-- mem | ||
01 02 03 | ||
-- result | ||
0x06 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
# Copyright (c) Big Switch Networks, Inc | ||
# SPDX-License-Identifier: Apache-2.0 | ||
-- asm | ||
mov %r2, %r1 | ||
mov %r8, %r1 | ||
ldxb %r2, [%r2+0x80] | ||
ldxb %r8, [%r8+0x88] | ||
mov %r0, %r2 | ||
add %r0, %r8 | ||
exit | ||
-- mem | ||
aa bb 11 cc dd ee ff 11 | ||
aa bb 11 cc dd ee ff 11 | ||
aa bb 11 cc dd ee ff 11 | ||
aa bb 11 cc dd ee ff 11 | ||
aa bb 11 cc dd ee ff 11 | ||
aa bb 11 cc dd ee ff 11 | ||
aa bb 11 cc dd ee ff 11 | ||
aa bb 11 cc dd ee ff 11 | ||
aa bb 11 cc dd ee ff 11 | ||
aa bb 11 cc dd ee ff 11 | ||
aa bb 11 cc dd ee ff 11 | ||
aa bb 11 cc dd ee ff 11 | ||
aa bb 11 cc dd ee ff 11 | ||
aa bb 11 cc dd ee ff 11 | ||
aa bb 11 cc dd ee ff 11 | ||
aa bb 11 cc dd ee ff 11 | ||
02 bb 11 cc dd ee ff 11 | ||
03 bb 11 cc dd ee ff 11 | ||
-- result | ||
0x05 | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
# Copyright (c) Big Switch Networks, Inc | ||
# SPDX-License-Identifier: Apache-2.0 | ||
-- asm | ||
mov %r2, %r1 | ||
mov %r8, %r1 | ||
ldxb %r2, [%r2+0x08] | ||
ldxb %r8, [%r8+0x7f] | ||
mov %r0, %r2 | ||
add %r0, %r8 | ||
exit | ||
-- mem | ||
aa bb 11 cc dd ee ff 11 | ||
02 bb 11 cc dd ee ff 11 | ||
aa bb 11 cc dd ee ff 11 | ||
aa bb 11 cc dd ee ff 11 | ||
aa bb 11 cc dd ee ff 11 | ||
aa bb 11 cc dd ee ff 11 | ||
aa bb 11 cc dd ee ff 11 | ||
aa bb 11 cc dd ee ff 11 | ||
aa bb 11 cc dd ee ff 11 | ||
aa bb 11 cc dd ee ff 11 | ||
aa bb 11 cc dd ee ff 11 | ||
aa bb 11 cc dd ee ff 11 | ||
aa bb 11 cc dd ee ff 11 | ||
aa bb 11 cc dd ee ff 11 | ||
aa bb 11 cc dd ee ff 11 | ||
aa bb 11 cc dd ee ff 03 | ||
aa bb 11 cc dd ee ff 11 | ||
aa bb 11 cc dd ee ff 11 | ||
-- result | ||
0x05 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters