Skip to content

Update capstone lib to 3b2984212fe #129

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Oct 16, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 1 addition & 2 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
## [UNRELEASED] - YYYY-MM-DD
### Changed
- Bump minimum Rust version to 1.56.0
- `Arm64OperandType::Sys` contains `Arm64SysOp` instead of `u32`

## [0.11.0] - 2022-05-01

Expand All @@ -19,8 +20,6 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

### Fixed
- Soundness issue by remove `Insn` `Clone` impl (see "Removed" note above)
- `capstone-sys`: document that minimum supported Rust version is 1.50.0
- `capstone-sys`: suppress C compiler warning

## [0.10.0] - 2021-08-09

Expand Down
14 changes: 5 additions & 9 deletions capstone-rs/src/arch/arm64.rs
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,7 @@ pub use capstone_sys::arm64_pstate as Arm64Pstate;
pub use capstone_sys::arm64_prefetch_op as ArmPrefetchOp;
pub use capstone_sys::arm64_barrier_op as ArmBarrierOp;
pub use capstone_sys::arm64_sysreg as Arm64Sysreg;
pub use capstone_sys::arm64_ic_op as Arm64IcOp;
pub use capstone_sys::arm64_dc_op as Arm64DcOp;
pub use capstone_sys::arm64_at_op as Arm64AtOp;
pub use capstone_sys::arm64_tlbi_op as Arm64TlbiOp;
pub use capstone_sys::arm64_sys_op as Arm64SysOp;
pub use capstone_sys::arm64_barrier_op as Arm64BarrierOp;

use capstone_sys::cs_arm64_op__bindgen_ty_2;
Expand Down Expand Up @@ -122,9 +119,8 @@ pub enum Arm64OperandType {
/// System PState Field (MSR instruction)
Pstate(Arm64Pstate),

// XXX todo(tmfink)
/// IC/DC/AT/TLBI operation (see Arm64IcOp, Arm64DcOp, Arm64AtOp, Arm64TlbiOp)
Sys(u32),
/// System operation (IC/DC/AT/TLBI)
Sys(Arm64SysOp),

/// PRFM operation
Prefetch(ArmPrefetchOp),
Expand Down Expand Up @@ -325,8 +321,8 @@ mod test {
RegMsr(arm64_sysreg::ARM64_SYSREG_ICC_EOIR1_EL1),
);
t(
(ARM64_OP_SYS, cs_arm64_op__bindgen_ty_2 { sys: 42 }),
Sys(42),
(ARM64_OP_SYS, cs_arm64_op__bindgen_ty_2 { sys: arm64_sys_op::ARM64_AT_S1E0R }),
Sys(arm64_sys_op::ARM64_AT_S1E0R),
);
t(
(ARM64_OP_PREFETCH, cs_arm64_op__bindgen_ty_2 {
Expand Down
6 changes: 5 additions & 1 deletion capstone-rs/src/test.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1067,7 +1067,7 @@ fn test_arch_arm64_detail() {
use crate::arch::arm64::Arm64OperandType::*;
use crate::arch::arm64::Arm64Pstate::*;
use crate::arch::arm64::Arm64Reg::*;
use crate::arch::arm64::Arm64Sysreg::*;
//use crate::arch::arm64::Arm64Sysreg::*;
use crate::arch::arm64::Arm64Vas::*;
use crate::arch::arm64::*;
use capstone_sys::arm64_op_mem;
Expand Down Expand Up @@ -1101,6 +1101,8 @@ fn test_arch_arm64_detail() {
&[],
&[
// mrs x9, midr_el1
// todo(tmfink): https://github.com/capstone-engine/capstone/issues/1881
/*
DII::new(
"mrs",
b"\x09\x00\x38\xd5",
Expand All @@ -1115,6 +1117,7 @@ fn test_arch_arm64_detail() {
},
],
),
*/
// msr spsel, #0
DII::new(
"msr",
Expand Down Expand Up @@ -1210,6 +1213,7 @@ fn test_arch_arm64_detail() {
Arm64Operand {
vector_index: Some(1),
op_type: Reg(RegId(ARM64_REG_V5 as RegIdInt)),
vas: ARM64_VAS_1D,
..Default::default()
},
],
Expand Down
11 changes: 10 additions & 1 deletion capstone-sys/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,17 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/)
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## UNRELEASED - YYYY-MM-DD
## [Unreleased] - YYYY-MM-DD

### Changed
- Upgraded bundled capstone to from [f278de39 to 3b298421](https://github.com/aquynh/capstone/compare/f278de39...3b298421)
- Merged enums `arm64_tlbi_op`, `arm64_at_op`, `arm64_dc_op`, `arm64_ic_op` into single enum `arm64_sys_op` (based on upstream [`3e23b60af0`](https://github.com/capstone-engine/capstone/commit/3e23b60af04aa75eb17c14ba33d6ed139a2c405c))

## [0.15.0] - 2022-05-01
### Fixed
- Document that minimum supported Rust version is actually 1.50.0
- Improperly documented as 1.40.0 in 0.14.0 release
- Suppress C compiler warning

## [0.14.0] - 2021-08-09

Expand Down Expand Up @@ -99,6 +106,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
### Removed
- Dependency

[Unreleased]: https://github.com/capstone-rust/capstone-rs/compare/capstone-sys-v0.15.0...master
[0.15.0]: https://github.com/capstone-rust/capstone-rs/compare/capstone-sys-v0.14.0...capstone-sys-v0.15.0
[0.14.0]: https://github.com/capstone-rust/capstone-rs/compare/capstone-sys-v0.13.0...capstone-sys-v0.14.0
[0.13.0]: https://github.com/capstone-rust/capstone-rs/compare/capstone-sys-v0.12.0...capstone-sys-v0.13.0
[0.12.0]: https://github.com/capstone-rust/capstone-rs/compare/capstone-sys-v0.11.0...capstone-sys-v0.12.0
Expand Down
154 changes: 154 additions & 0 deletions capstone-sys/capstone/.github/workflows/CITest.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,154 @@
name: Run Test
on:
push:
paths-ignore:
- ".gitignore"
- "docs/**"
- "ChangeLog"
- "CREDITS.TXT"
- "COMPILE.TXT"
- "COMPILE_MSVC.TXT"
- "COMPILE_CMAKE.TXT"
- "HACK.TXT"
- "LICENSE.TXT"
- "LICENSE_LLVM.TXT"
- "README.md"
- "RELEASE_NOTES"
- "SPONSORS.TXT"
- "TODO"
pull_request:

env:
CI: true

jobs:
Linux:
runs-on: ${{ matrix.config.os }}
name: ${{ matrix.config.name }}
strategy:
fail-fast: false
matrix:
config:
- {
name: 'ubuntu-18.04 x64 python2.7 make',
os: ubuntu-18.04,
arch: x64,
python-arch: x64,
python-version: '2.7',
build-system: 'make',
}
- {
name: 'ubuntu-18.04 x64 python3.6 make',
os: ubuntu-18.04,
arch: x64,
python-arch: x64,
python-version: '3.6',
build-system: 'make',
}
- {
name: 'ubuntu-20.04 x64 python2.7 make',
os: ubuntu-20.04,
arch: x64,
python-arch: x64,
python-version: '2.7',
build-system: 'make',
}
- {
name: 'ubuntu-20.04 x64 python3.9 make',
os: ubuntu-20.04,
arch: x64,
python-arch: x64,
python-version: '3.9',
build-system: 'make',
}
- {
name: 'ubuntu-20.04 x64 python3.9 cmake',
os: ubuntu-20.04,
arch: x64,
python-arch: x64,
python-version: '3.9',
build-system: 'cmake',
}

steps:
- uses: actions/checkout@v2

- name: Set up Python
uses: actions/setup-python@v2
with:
python-version: ${{ matrix.config.python-version }}

- name: prepare
shell: 'script -q -e -c "bash {0}"'
run: |
export LD_LIBRARY_PATH=`pwd`/tests/:$LD_LIBRARY_PATH
wget https://github.com/groundx/capstonefuzz/raw/master/corpus/corpus-libFuzzer-capstone_fuzz_disasmnext-latest.zip
unzip -q corpus-libFuzzer-capstone_fuzz_disasmnext-latest.zip -d suite/fuzz
git clone https://git.cryptomilk.org/projects/cmocka.git suite/cstest/cmocka
chmod +x suite/cstest/build_cstest.sh

- name: make
if: startsWith(matrix.config.build-system, 'make')
shell: 'script -q -e -c "bash {0}"'
run: |
./make.sh
make check
sudo make install

- name: cmake
if: startsWith(matrix.config.build-system, 'cmake')
shell: 'script -q -e -c "bash {0}"'
run: |
mkdir build
cd build
cmake -DCAPSTONE_INSTALL=1 ..
cmake --build . --config Release
sudo make install

- name: build python binding
shell: 'script -q -e -c "bash {0}"'
run: |
cp libcapstone.so.* bindings/python/libcapstone.so
cd bindings/python && make check; cd ../..;

- name: cstest
shell: 'script -q -e -c "bash {0}"'
run: |
cd suite/cstest && ./build_cstest.sh;
python cstest_report.py -D -t build/cstest -d ../MC;
python cstest_report.py -D -t build/cstest -f issues.cs; cd ..;

Windows:
runs-on: ${{ matrix.config.os }}
name: ${{ matrix.config.name }}
strategy:
fail-fast: false
matrix:
config:
- name: 'windows x64 MSVC 64bit'
os: windows-latest
arch: x64
platform: windows
python-arch: x64
python-version: '3.9'

steps:
- uses: actions/checkout@v3

- uses: lukka/get-cmake@latest
name: Get CMake

- name: '🛠️ Win MSVC 64 setup'
if: contains(matrix.config.name, 'MSVC 64')
uses: ilammy/msvc-dev-cmd@v1
with:
arch: 'x64'

- name: '🚧 Win MSVC 64 build'
if: contains(matrix.config.name, 'MSVC 64')
shell: bash
run: |
cmake --version
cmake --preset=${{ matrix.config.platform }}-x64
cmake --build --preset build-${{ matrix.config.platform }}-release
cmake --build --preset install-${{ matrix.config.platform }}-release
50 changes: 50 additions & 0 deletions capstone-sys/capstone/.github/workflows/build_release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
name: Build Source Release

# Trigger whenever a release is created
on:
release:
types:
- created

jobs:
build:
name: build
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v1
with:
submodules: true

- name: archive
id: archive
run: |
VERSION=${{ github.event.release.tag_name }}
PKGNAME="capstone-$VERSION"
SHASUM=$PKGNAME.tar.xz.sha256
mkdir -p /tmp/$PKGNAME
mv * /tmp/$PKGNAME
mv /tmp/$PKGNAME .
TARBALL=$PKGNAME.tar.xz
tar cJf $TARBALL $PKGNAME
sha256sum $TARBALL > $SHASUM
echo "::set-output name=tarball::$TARBALL"
echo "::set-output name=shasum::$SHASUM"
- name: upload tarball
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ github.event.release.upload_url }}
asset_path: ./${{ steps.archive.outputs.tarball }}
asset_name: ${{ steps.archive.outputs.tarball }}
asset_content_type: application/gzip

- name: upload shasum
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ github.event.release.upload_url }}
asset_path: ./${{ steps.archive.outputs.shasum }}
asset_name: ${{ steps.archive.outputs.shasum }}
asset_content_type: text/plain
Loading