Skip to content
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

CFI build failing on travis #166

Open
springmeyer opened this issue Dec 7, 2020 · 2 comments
Open

CFI build failing on travis #166

springmeyer opened this issue Dec 7, 2020 · 2 comments

Comments

@springmeyer
Copy link
Contributor

The CFI build is failing with:

# success: prints expected string
Illegal instruction (core dumped)

https://travis-ci.com/github/mapbox/node-cpp-skel/jobs/455213147#L449

I wonder if this started at 0f679d2? @artemp can you take a look?

@artemp
Copy link
Contributor

artemp commented Dec 7, 2020

The issue is cfi sanitizer doesn't like CRTP pattern cast here: https://github.com/nodejs/node-addon-api/blob/master/napi-inl.h#L3545

Process 27867 launched: '/opt/node/bin/node' (x86_64)
TAP version 13
# success: prints expected string
Process 27867 stopped
* thread #1, name = 'node', stop reason = signal SIGILL: illegal instruction operand
    frame #0: 0x00007ffff52271c2 module.node`Napi::ObjectWrap<object_sync::HelloObject>::ObjectWrap(this=0x00005555577d10c0, callbackInfo=0x00007fffffffc1a8) at napi-inl.h:3545:17
   3542	  napi_value wrapper = callbackInfo.This();
   3543	  napi_status status;
   3544	  napi_ref ref;
-> 3545	  T* instance = static_cast<T*>(this); <===================== FAIL  
   3546	  status = napi_wrap(env, wrapper, instance, FinalizeCallback, nullptr, &ref);
   3547	  NAPI_THROW_IF_FAILED_VOID(env, status);
   3548	

I'll submit PR with the fix (disabling cfi-derived-cast check for any functions which has 'ObjectWrap` string in its name.

@artemp
Copy link
Contributor

artemp commented Dec 7, 2020

Fixed in #167

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants