Project

General

Profile

Actions

Bug #7498

closed

rust: cleanup of extern "C" functions and no_mangle

Added by Jason Ish 4 months ago. Updated 24 days ago.

Status:
Closed
Priority:
Normal
Assignee:
Target version:
Affected Versions:
Effort:
Difficulty:
Label:

Description

I recently ran into an issue where a plugin was using a sha256 library that had a function names sha256_transform. Suricata also has a function:

#[no_mangle]
extern "C" fn sha256_finalize

The plugin was using our version leading to a crash.

On our side we should:
- only use no_mangle for pub extern "C", and these must be prefixed with "SC"
- if not pub, we shouldn't need no_mangle, for example if the function is only ever used by pointer. We can let normal Rust mangling deal with it.

I plan to do this as a sweeping change.


Related issues 2 (1 open1 closed)

Related to Suricata - Story #7148: extensibility: pluginsNewVictor JulienActions
Related to Suricata - Task #7079: rust: unify rust ffi styleClosedJason IshActions
Actions #1

Updated by Victor Julien 4 months ago

Actions #2

Updated by Victor Julien about 2 months ago

  • Target version changed from 8.0.0-beta1 to 8.0.0-rc1
Actions #3

Updated by Jason Ish 25 days ago

  • Status changed from New to In Review
Actions #4

Updated by Jason Ish 24 days ago

  • Status changed from In Review to Closed

Done. Now just a matter of staying on top it during code review, etc.

Actions #5

Updated by Jason Ish 8 days ago

  • Related to Task #7079: rust: unify rust ffi style added
Actions

Also available in: Atom PDF