Skip to content

repair make-immobile-bytevector for large sizes - #1070

Merged
mflatt merged 1 commit into
cisco:mainfrom
mflatt:big-immobile
Sep 24, 2026
Merged

mflatt merged 1 commit into
cisco:mainfrom
mflatt:big-immobile

Conversation

@mflatt

@mflatt mflatt commented Sep 24, 2026

Copy link
Copy Markdown
Contributor

When the segment allocator preemptively marks a large allocaiton as immobile, it did not set S_G.must_mark_gen0 to ensure that the right GC variant is triggered. As a result, the should-be-immobile byte vector could move.

When the segment allocator preemptively marks a large allocaiton as
immobile, it did not set `S_G.must_mark_gen0` to ensure that the right
GC variant is triggered. As a result, the should-be-immobile byte
vector could move.
samth added a commit to samth/racket that referenced this pull request Sep 24, 2026
…?` call

A foreign call made with `#:callback-exns?` catches an exception during
the call, escapes back out of the C frames, and ends the scheduler's
atomic mode, since a callback runs in atomic mode. But the exception can
also come from the foreign procedure itself: an invalid memory reference
in C becomes an exception with no callback involved. Ending atomic mode
then either failed with "internal-error: not in atomic mode to end",
which hid the invalid memory reference, or, when the caller was in
atomic mode, ended the caller's atomic mode instead.

Record the atomic-mode depth before the call and, on an escape, end
atomic mode only down to that depth.

For example, a `png_read_rows` call in racket/draw faulted when a large
"immobile" bytevector moved (cisco/ChezScheme#1070), and the fault was
reported only as the internal error.
samth added a commit to samth/racket that referenced this pull request Sep 24, 2026
…?` call

A foreign call made with `#:callback-exns?` catches an exception during
the call, escapes back out of the C frames, and ends the scheduler's
atomic mode, since a callback runs in atomic mode. But the exception can
also come from the foreign procedure itself: an invalid memory reference
in C becomes an exception with no callback involved. Ending atomic mode
then either failed with "internal-error: not in atomic mode to end",
which hid the invalid memory reference, or, when the caller was in
atomic mode, ended the caller's atomic mode instead.

Record the atomic-mode depth before the call and, on an escape, end
atomic mode only down to that depth.

For example, a `png_read_rows` call in racket/draw faulted when a large
"immobile" bytevector moved (cisco/ChezScheme#1070), and the fault was
reported only as the internal error.

@burgerrg burgerrg left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Thank you for finding and fixing this bug!

@mflatt
mflatt merged commit 7fbf1c0 into cisco:main Sep 24, 2026
17 checks passed
samth added a commit to samth/racket that referenced this pull request Oct 2, 2026
…?` call

A foreign call made with `#:callback-exns?` catches an exception during
the call, escapes back out of the C frames, and ends the scheduler's
atomic mode, since a callback runs in atomic mode. But the exception can
also come from the foreign procedure itself: an invalid memory reference
in C becomes an exception with no callback involved. Ending atomic mode
then either failed with "internal-error: not in atomic mode to end",
which hid the invalid memory reference, or, when the caller was in
atomic mode, ended the caller's atomic mode instead.

Record the atomic-mode depth before the call and, on an escape, end
atomic mode only down to that depth.

For example, a `png_read_rows` call in racket/draw faulted when a large
"immobile" bytevector moved (cisco/ChezScheme#1070), and the fault was
reported only as the internal error.
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

Successfully merging this pull request may close these issues.

2 participants