Skip to content

Commit

Permalink
Calculate a checksum for the system image (#48869)
Browse files Browse the repository at this point in the history
  • Loading branch information
timholy authored Mar 3, 2023
1 parent 3c7ca40 commit 48b4caa
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions src/staticdata.c
Original file line number Diff line number Diff line change
Expand Up @@ -3300,10 +3300,9 @@ static jl_value_t *jl_restore_package_image_from_stream(ios_t *f, jl_image_t *im
return restored;
}

static void jl_restore_system_image_from_stream(ios_t *f, jl_image_t *image)
static void jl_restore_system_image_from_stream(ios_t *f, jl_image_t *image, uint32_t checksum)
{
uint64_t checksum = 0; // TODO: make this real
jl_restore_system_image_from_stream_(f, image, NULL, checksum, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL);
jl_restore_system_image_from_stream_(f, image, NULL, checksum | ((uint64_t)0xfdfcfbfa << 32), NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL);
}

JL_DLLEXPORT jl_value_t *jl_restore_incremental_from_buf(const char *buf, jl_image_t *image, size_t sz, jl_array_t *depmods, int completeinfo)
Expand Down Expand Up @@ -3354,8 +3353,9 @@ JL_DLLEXPORT void jl_restore_system_image(const char *fname)
if (ios_readall(&f, sysimg, len) != len)
jl_errorf("Error reading system image file.");
ios_close(&f);
uint32_t checksum = jl_crc32c(0, sysimg, len);
ios_static_buffer(&f, sysimg, len);
jl_restore_system_image_from_stream(&f, &sysimage);
jl_restore_system_image_from_stream(&f, &sysimage, checksum);
ios_close(&f);
JL_SIGATOMIC_END();
}
Expand All @@ -3366,7 +3366,8 @@ JL_DLLEXPORT void jl_restore_system_image_data(const char *buf, size_t len)
ios_t f;
JL_SIGATOMIC_BEGIN();
ios_static_buffer(&f, (char*)buf, len);
jl_restore_system_image_from_stream(&f, &sysimage);
uint32_t checksum = jl_crc32c(0, buf, len);
jl_restore_system_image_from_stream(&f, &sysimage, checksum);
ios_close(&f);
JL_SIGATOMIC_END();
}
Expand Down

2 comments on commit 48b4caa

@nanosoldier
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Executing the daily package evaluation, I will reply here when finished:

@nanosoldier runtests(isdaily = true)

@nanosoldier
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Your package evaluation job has completed - possible new issues were detected.
A full report can be found here.

Please sign in to comment.