Skip to content

Commit 9a6e727

Browse files
Merge branch 'Vector35:dev' into dev
2 parents 90d2968 + fdff8c8 commit 9a6e727

File tree

116 files changed

+30356
-2156
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

116 files changed

+30356
-2156
lines changed

.github/ISSUE_TEMPLATE/bug_report.md

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -32,11 +32,12 @@ If applicable, please add screenshots/video recording here to help explain your
3232
**Binary:**
3333
If applicable, please provide us with the binary to help us work with the issue faster. Here are a few options:
3434

35-
1. Directly attach it to this issue in a ZIP archive
36-
2. Share a publicly accessible link to it (For malware samples, we do not have access to VirusTotal; [Malshare](https://malshare.com/) is an option)
37-
3. Email it to binaryninja at vector35.com, or join our [slack](https://slack.binary.ninja/) and share with us in private
38-
4. We understand sometimes it is not possible to share the binary -- sure, no worries, we can still work with it!
39-
5. If your issue is general and not related to a specific binary, then there is no need to attach the binary as well
35+
1. Upload it privately using the [Binary Ninja Portal file uploader](https://portal.binary.ninja/upload) and add the provided reference phrase here
36+
2. Directly attach it to this issue in a ZIP archive
37+
3. Share a publicly accessible link to it (For malware samples, we do not have access to VirusTotal; [Malshare](https://malshare.com/) is an option)
38+
4. Email it to binaryninja at vector35.com, or join our [Slack](https://slack.binary.ninja/) and share it with us in private
39+
5. We understand sometimes it is not possible to share the binary -- sure, no worries, we can still work with it!
40+
6. If your issue is general and not related to a specific binary, then there is no need to attach the binary as well
4041

4142
**Additional Information:**
4243
Please add any other context about the problem here.

.github/workflows/rust.yml

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,13 +23,13 @@ jobs:
2323
# Ensure clippy is installed
2424
- uses: actions-rust-lang/setup-rust-toolchain@v1
2525
with:
26+
toolchain: 1.83.0
2627
components: clippy
2728
- name: Clippy Check
2829
uses: clechasseur/rs-clippy-check@v4
2930
with:
3031
# We do not run clippy on plugins.
31-
working-directory: ./rust
32-
args: --all-features
32+
args: -p binaryninja --all-features
3333

3434
# Check formatting with rustfmt
3535
formatting:
@@ -40,6 +40,7 @@ jobs:
4040
# Ensure rustfmt is installed
4141
- uses: actions-rust-lang/setup-rust-toolchain@v1
4242
with:
43+
toolchain: 1.83.0
4344
components: rustfmt
4445
- name: Rustfmt Check
4546
uses: actions-rust-lang/rustfmt@v1

Cargo.lock

Lines changed: 64 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,8 @@ members = [
1616
"plugins/idb_import",
1717
"plugins/pdb-ng",
1818
"plugins/pdb-ng/demo",
19-
"plugins/warp"
19+
"plugins/warp",
20+
"plugins/svd"
2021
]
2122

2223
[workspace.dependencies]
@@ -35,4 +36,4 @@ lto = false
3536
# Disable LTO on demo builds, it will export `rust_eh_personality`
3637
[profile.dev-demo]
3738
inherits = "dev"
38-
lto = false
39+
lto = false

arch/armv7/il.cpp

Lines changed: 62 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -167,13 +167,73 @@ static ExprId GetShiftedOffset(LowLevelILFunction& il, InstructionOperand& op)
167167
}
168168

169169

170+
static ExprId GetRegisterShiftedRegister(LowLevelILFunction& il, Register reg, Register shiftReg, Shift shiftType)
171+
{
172+
if (shiftType == SHIFT_NONE)
173+
return il.Register(get_register_size(reg), reg);
174+
175+
uint32_t regSize = get_register_size(reg);
176+
uint32_t shiftRegSize = get_register_size(shiftReg);
177+
switch (shiftType)
178+
{
179+
case SHIFT_ASR:
180+
return il.ArithShiftRight(
181+
regSize,
182+
il.Register(regSize, reg),
183+
il.And(
184+
shiftRegSize,
185+
il.Register(shiftRegSize, shiftReg),
186+
il.Const(shiftRegSize, 0xff)
187+
));
188+
case SHIFT_LSL:
189+
return il.ShiftLeft(
190+
regSize,
191+
il.Register(regSize, reg),
192+
il.And(
193+
shiftRegSize,
194+
il.Register(shiftRegSize, shiftReg),
195+
il.Const(shiftRegSize, 0xff)
196+
));
197+
case SHIFT_LSR:
198+
return il.LogicalShiftRight(
199+
regSize,
200+
il.Register(regSize, reg),
201+
il.And(
202+
shiftRegSize,
203+
il.Register(shiftRegSize, shiftReg),
204+
il.Const(shiftRegSize, 0xff)
205+
));
206+
case SHIFT_ROR:
207+
return il.RotateRight(
208+
regSize,
209+
il.Register(regSize, reg),
210+
il.And(
211+
shiftRegSize,
212+
il.Register(shiftRegSize, shiftReg),
213+
il.Const(shiftRegSize, 0xff)
214+
));
215+
case SHIFT_RRX:
216+
//RRX can only shift 1 at a time
217+
return il.RotateRightCarry(
218+
regSize,
219+
il.Register(regSize, reg),
220+
il.Const(1, 1),
221+
il.Flag(IL_FLAG_C)
222+
);
223+
default:
224+
return 0;
225+
}
226+
}
227+
228+
170229
static ExprId GetShiftedRegister(LowLevelILFunction& il, InstructionOperand& op)
171230
{
231+
if (op.flags.offsetRegUsed == 1)
232+
return GetRegisterShiftedRegister(il, op.reg, op.offset, op.shift);
172233
return GetShifted(il, op.reg, op.imm, op.shift);
173234
}
174235

175236

176-
177237
static ExprId ReadAddress(LowLevelILFunction& il, InstructionOperand& op, size_t addr)
178238
{
179239
//This should only be called by with cls or MEM_* or label
@@ -227,7 +287,7 @@ static ExprId ReadILOperand(LowLevelILFunction& il, InstructionOperand& op, size
227287
case REG:
228288
if (op.shift == SHIFT_NONE)
229289
return ReadRegisterOrPointer(il, op, addr);
230-
else if (op.flags.offsetRegUsed == 1)
290+
else if (op.flags.offsetRegUsed == 1 && op.imm != 0)
231291
{
232292
return GetShiftedOffset(il, op);
233293
}

arch/armv7/test.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,9 @@
99
# r0 = (r1 & 0b11111111111111111111111111100011) | ((r1 & 0b111) << 2)
1010
(b'\x11\x01\xc4\xe7', 'LLIL_SET_REG(r0,LLIL_OR(LLIL_AND(LLIL_REG(r0),LLIL_CONST(4294967267)),LLIL_LSL(LLIL_AND(LLIL_REG(r1),LLIL_CONST(7)),LLIL_CONST(2))))'), # bfi r0, r1, #2, #3
1111
# temp0 = r2*r3; r0=tmp0&0xFFFFFFFF; r1=tmp0>>32 ... LOGICAL shift since mul is unsigned
12-
(b'\x92\x03\x81\xe0', 'LLIL_SET_REG(temp0,LLIL_MUL(LLIL_REG(r2),LLIL_REG(r3))); LLIL_SET_REG(r0,LLIL_LOW_PART(LLIL_REG(temp0))); LLIL_SET_REG(r1,LLIL_LSR(LLIL_REG(temp0),LLIL_CONST(32)))'), # umull r0, r1, r2, r3
12+
(b'\x92\x03\x81\xe0', 'LLIL_SET_REG_SPLIT(r1,r0,LLIL_MULU_DP(LLIL_REG(r2),LLIL_REG(r3)))'), # umull r0, r1, r2, r3
1313
# same, but ARITHMETIC shift since mul is signed
14-
(b'\x92\x03\xc1\xe0', 'LLIL_SET_REG(temp0,LLIL_MUL(LLIL_REG(r2),LLIL_REG(r3))); LLIL_SET_REG(r0,LLIL_LOW_PART(LLIL_REG(temp0))); LLIL_SET_REG(r1,LLIL_ASR(LLIL_REG(temp0),LLIL_CONST(32)))'), # smull r0, r1, r2, r3
14+
(b'\x92\x03\xc1\xe0', 'LLIL_SET_REG_SPLIT(r1,r0,LLIL_MULS_DP(LLIL_REG(r2),LLIL_REG(r3)))'), # smull r0, r1, r2, r3
1515
# multiply and accumulate: mla r0, r1, r2, r3 lift to r0 = r3 + (r1 * r2)
1616
(b'\x91\x32\x20\xe0', 'LLIL_SET_REG(r0,LLIL_ADD(LLIL_REG(r3),LLIL_MUL(LLIL_REG(r1),LLIL_REG(r2))))'), # mla r0, r1, r2, r3
1717
# multiply and subtract: mls r0, r1, r2, r3 lift to r0 = r3 - (r1 * r2)

arch/armv7/test_lift.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -100,6 +100,9 @@
100100
('A', b'\x02\x0a\x83\xed', 'LLIL_STORE.d(LLIL_ADD.d(LLIL_REG.d(r3),LLIL_CONST.d(0x8)),LLIL_REG.d(s0))'),
101101
# vstr d16, [r3, #0x8]
102102
('A', b'\x02\x0b\xc3\xed', 'LLIL_STORE.q(LLIL_ADD.d(LLIL_REG.d(r3),LLIL_CONST.d(0x8)),LLIL_REG.q(d16))'),
103+
# orr r0, r1, r3, lsl r4
104+
('A', b'\x13\x04\x81\xe1', 'LLIL_SET_REG.d(r0,LLIL_OR.d(LLIL_REG.d(r1),LLIL_LSL.d(LLIL_REG.d(r3),LLIL_AND.d(LLIL_REG.d(r4),LLIL_CONST.d(0xFF)))))'),
105+
103106
# mov r2, r0
104107
('T', b'\x02\x46', 'LLIL_SET_REG.d(r2,LLIL_REG.d(r0))'),
105108
# cmp r1, r2
@@ -124,7 +127,7 @@
124127
# just r0 = r1 >> 20, no left shift required
125128
('T', b'\x41\xf3\x1d\x50', 'LLIL_SET_REG.d(r0,LLIL_ASR.d(LLIL_REG.d(r1),LLIL_CONST.b(0x14)))'),
126129
# rev r1, r1
127-
('T', b'\x09\xba', 'LLIL_SET_REG.d(r1,LLIL_OR.d(LLIL_LSR.d(LLIL_REG.d(r1),LLIL_CONST.d(0x18)),LLIL_OR.d(LLIL_LSL.d(LLIL_AND.d(LLIL_LSR.d(LLIL_REG.d(r1),LLIL_CONST.d(0x10)),LLIL_CONST.d(0xFF)),LLIL_CONST.d(0x8)),LLIL_OR.d(LLIL_LSL.d(LLIL_AND.d(LLIL_LSR.d(LLIL_REG.d(r1),LLIL_CONST.d(0x8)),LLIL_CONST.d(0xFF)),LLIL_CONST.d(0x10)),LLIL_LSL.d(LLIL_AND.d(LLIL_REG.d(r1),LLIL_CONST.d(0xFF)),LLIL_CONST.d(0x18))))))'),
130+
('T', b'\x09\xba', 'LLIL_SET_REG.d(r1,LLIL_OR.d(LLIL_LSR.d(LLIL_REG.d(r1),LLIL_CONST.d(0x18)),LLIL_OR.d(LLIL_LSL.d(LLIL_AND.d(LLIL_LSR.d(LLIL_REG.d(r1),LLIL_CONST.d(0x10)),LLIL_CONST.d(0xFF)),LLIL_CONST.b(0x8)),LLIL_OR.d(LLIL_LSL.d(LLIL_AND.d(LLIL_LSR.d(LLIL_REG.d(r1),LLIL_CONST.d(0x8)),LLIL_CONST.d(0xFF)),LLIL_CONST.b(0x10)),LLIL_LSL.d(LLIL_AND.d(LLIL_REG.d(r1),LLIL_CONST.d(0xFF)),LLIL_CONST.b(0x18))))))'),
128131
]
129132

130133
import re

binaryninjaapi.h

Lines changed: 29 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2776,6 +2776,10 @@ namespace BinaryNinja {
27762776
};
27772777

27782778

2779+
namespace Collaboration
2780+
{
2781+
class RemoteProject;
2782+
}
27792783
/*!
27802784

27812785
\ingroup project
@@ -2827,6 +2831,8 @@ namespace BinaryNinja {
28272831

28282832
void BeginBulkOperation();
28292833
void EndBulkOperation();
2834+
2835+
Ref<Collaboration::RemoteProject> GetRemoteProject();
28302836
};
28312837

28322838
/*!
@@ -3928,6 +3934,8 @@ namespace BinaryNinja {
39283934
const NameSpace& nameSpace = NameSpace(DEFAULT_INTERNAL_NAMESPACE), uint64_t ordinal = 0);
39293935
Symbol(BNSymbolType type, const std::string& name, uint64_t addr, BNSymbolBinding binding = NoBinding,
39303936
const NameSpace& nameSpace = NameSpace(DEFAULT_INTERNAL_NAMESPACE), uint64_t ordinal = 0);
3937+
Symbol(BNSymbolType type, const std::string& shortName, const std::string& fullName, const std::string& rawName,
3938+
uint64_t addr, BNNameSpace* nameSpace, BNSymbolBinding binding = NoBinding, uint64_t ordinal = 0);
39313939
Symbol(BNSymbolType type, const std::string& name, uint64_t addr, BNNameSpace* nameSpace,
39323940
BNSymbolBinding binding = NoBinding, uint64_t ordinal = 0);
39333941
Symbol(BNSymbol* sym);
@@ -6482,7 +6490,9 @@ namespace BinaryNinja {
64826490
const FunctionViewType& viewType, const std::function<bool(size_t current, size_t total)>& progress,
64836491
const std::function<bool(uint64_t addr, const LinearDisassemblyLine& line)>& matchCallback);
64846492

6485-
bool Search(const std::string& query, const std::function<bool(uint64_t offset, const DataBuffer& buffer)>& otherCallback);
6493+
bool Search(const std::string& query,
6494+
const std::function<bool(size_t current, size_t total)>& progressCallback,
6495+
const std::function<bool(uint64_t addr, const DataBuffer& buffer)>& matchCallback);
64866496

64876497
void Reanalyze();
64886498

@@ -10088,11 +10098,11 @@ namespace BinaryNinja {
1008810098

1008910099
/*! Clone a workflow, copying all Activities and the execution strategy
1009010100

10091-
\param name Name for the new Workflow
10101+
\param name If specified, name the new Workflow, otherwise the name is copied from the original
1009210102
\param activity If specified, perform the clone with `activity` as the root
1009310103
\return A new Workflow
1009410104
*/
10095-
Ref<Workflow> Clone(const std::string& name, const std::string& activity = "");
10105+
Ref<Workflow> Clone(const std::string& name = "", const std::string& activity = "");
1009610106

1009710107
/*! Register an Activity with this Workflow
1009810108

@@ -10203,6 +10213,22 @@ namespace BinaryNinja {
1020310213
*/
1020410214
bool Insert(const std::string& activity, const std::vector<std::string>& activities);
1020510215

10216+
/*! Insert an activity after the specified activity and at the same level.
10217+
10218+
\param activity Name of the activity to insert the new one after
10219+
\param newActivity Name of the new activity to be inserted
10220+
\return true on success, false otherwise
10221+
*/
10222+
bool InsertAfter(const std::string& activity, const std::string& newActivity);
10223+
10224+
/*! Insert a list of activities after the specified activity and at the same level.
10225+
10226+
\param activity Name of the activity to insert the new one after
10227+
\param newActivity Name of the new activities to be inserted
10228+
\return true on success, false otherwise
10229+
*/
10230+
bool InsertAfter(const std::string& activity, const std::vector<std::string>& activities);
10231+
1020610232
/*! Remove an activity by name
1020710233

1020810234
\param activity Name of the activity to remove

0 commit comments

Comments
 (0)