Skip to content

SIGILL on 1.4 with machine that doesn't support avx512 #14

@ultrabear

Description

@ultrabear

simple repro, (both CrcAlgorithms listed cause SIGILL):

use crc_fast::{CrcAlgorithm, checksum};
use rand::RngCore;

const ALGO: [CrcAlgorithm; 2] = [
    CrcAlgorithm::Crc32IsoHdlc,
    CrcAlgorithm::Crc64Nvme,
];

fn main() {


    println!("{}, {}", is_x86_feature_detected!("avx512f"), is_x86_feature_detected!("avx512vl"));

    let mut rng = rand::rng();

    let mut buf = vec![0; 1024 * 1024 * 2];

    rng.fill_bytes(&mut buf);

    for (i, fault) in ALGO.into_iter().enumerate() {
        println!("testing {i}");

        checksum(fault, &buf);
    }

    println!("Hello, world!");
}

Output with

[dependencies]
crc-fast = "1.4.0"
rand = "0.9.2"
false, false
testing 0
fish: Job 1, 'cargo r --release' terminated by signal SIGILL (Illegal instruction)

Output with

[dependencies]
crc-fast = "=1.3.0"
rand = "0.9.2"
false, false
testing 0
testing 1
Hello, world!

GDB reveals that the function failed in

0x00005567efff2096 in <crc_fast::arch::x86::X86Ops as crc_fast::traits::ArchOps>::xor3_vectors::hded281c38afe50a3 ()

This crate is imported by aws-sdk-s3 (which imports aws-smithy-checksums (which imports crc-fast)), which is where the sigill was identified

Tested with:
CPU: 12th Gen Intel(R) Core(TM) i7-1270P (16) @ 4.80 GHz

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions