Skip to content

function call: parameter "pthread_key_create::destructor" type mismatch when hitting thread::current() #1781

@roypat

Description

@roypat

When a kani is run with --mir-linker --enable-unstable and encounters thread::current() (or rather, the destructor of a thread object?) it yields the error message from the title.

I tried this code:

fn main() {}

#[kani::proof]
fn crash() {
    std::thread::current();
}

using the following command line invocation:

cargo clean; cargo kani --mir-linker --enable-unstable

with Kani version: cargo-kani 0.12.0

I expected to see this happen: As std::thread interfaces with the OS API (pthread on linux) I'd have expected kani to complain about it reaching some function for which it does not have access to the source code. If I run kani without --mir-linker, this is indeed what happens.

Instead, this happened:

Checking harness crash...
CBMC 5.67.0 (cbmc-5.67.0)
CBMC version 5.67.0 (cbmc-5.67.0) 64-bit x86_64 linux
Reading GOTO program from file /home/ec2-user/kani-reproducer/target/x86_64-unknown-linux-gnu/debug/deps/cbmc-linked.for-crash.out
Generating GOTO Program
Adding CPROVER library (x86_64)
Removal of function pointers and virtual functions
Generic Property Instrumentation
Running with 16 object bits, 48 offset bits (user-specified)
Starting Bounded Model Checking
: function call: parameter "pthread_key_create::destructor" type mismatch:
got struct_tag
  * identifier: tag-_3583338355805481440
expected pointer
  * #source_location: 
    * file: <builtin-library-pthread_key_create>
    * line: 11
    * function: pthread_key_create
    * working_directory: /home/ec2-user/kani-reproducer/src
  * width: 64
  * #failed_symbol: pthread_key_create::destructor$object
  0: code
      * #source_location: 
        * file: <builtin-library-pthread_key_create>
        * line: 11
        * function: pthread_key_create
        * working_directory: /home/ec2-user/kani-reproducer/src
      * return_type: empty
          * #source_location: 
            * file: <builtin-library-pthread_key_create>
            * line: 11
            * function: pthread_key_create
            * working_directory: /home/ec2-user/kani-reproducer/src
      * parameters: 
        0: parameter
            * type: pointer
                * #source_location: 
                  * file: <builtin-library-pthread_key_create>
                  * line: 11
                  * function: pthread_key_create
                  * working_directory: /home/ec2-user/kani-reproducer/src
                * width: 64
                0: empty
                    * #source_location: 
                      * file: <builtin-library-pthread_key_create>
                      * line: 11
                      * function: pthread_key_create
                      * working_directory: /home/ec2-user/kani-reproducer/src
            * #source_location: 
              * file: <builtin-library-pthread_key_create>
              * line: 11
              * function: pthread_key_create
              * working_directory: /home/ec2-user/kani-reproducer/src
Verification Time: 0.81680673s

Metadata

Metadata

Assignees

Labels

T-UserTag user issues / requests[C] BugThis is a bug. Something isn't working.[F] CrashKani crashed

Type

No type

Projects

Relationships

None yet

Development

No branches or pull requests

Issue actions