Repository activity
40458 results across all weeks
Forked child's threads are never preempted
A forked child keeps Tick_thread_running set with no tick thread, so its threads are never preempted: a program that spins waiting for a thread it created hangs.
KC Sivaramakrishnan (@kayceesrk)Forking during a Memprof callback corrupts the child
A child forked while another systhread is inside a Gc.Memprof callback keeps a pointer to that thread's freed memprof record and writes through it. Unix.fork in a program with threads runs caml_thread_reinitialize in the child. That frees every other thread and calls caml_memprof_delete_thread on its memprof record (st_stubs.c:392, st_stubs.c:470-482). If th…
KC Sivaramakrishnan (@kayceesrk)Gc.Memprof leaks stashed callstacks after a stop
Gc.Memprof leaks C heap when one thread stops a profile while another has a sampled allocation whose callback has not run yet. A sampled allocation stashes its call stack on the C heap (memprof.c:1677-1692). The stash is freed only when the allocation callback runs (memprof.c:1818-1826). If another thread stops the profile before the sampled thread reaches a…
KC Sivaramakrishnan (@kayceesrk)Gc.Memprof stop from an alloc callback trips an assertion
An allocation callback that calls Gc.Memprof.stop, Gc.Memprof.discard and Gc.minor aborts the debug runtime with Assertion failed: entries->size == 0 (memprof.c:2133-2139). The minor GC inside the callback sees the discarded profile, resets the thread table's config and deletes every entry except the running one. When the sampler resumes, the changed config …
KC Sivaramakrishnan (@kayceesrk)Gc.Memprof.start in a callback keeps the old sampling gap
Calling Gc.Memprof.start from inside the previous profile's alloc_minor callback keeps the old profile's next_rand_geom. The new profile's first sample then waits for what is left of the old profile's gap.
KC Sivaramakrishnan (@kayceesrk)Gc.Memprof.stop does not stop sampling in child domains
After Gc.Memprof.stop in the parent, a child domain that was sampling for the same profile can still take a sample, which trips an assertion in the debug runtime. caml_memprof_stop clears only the calling domain's trigger (memprof.c:2303-2321). A child domain that inherited the profile keeps its memprof_young_trigger set until its next minor GC. Until then, …
KC Sivaramakrishnan (@kayceesrk)Gc.set accepts a negative space_overhead
Gc.set { space_overhead = -100 } is accepted, stored as an unsigned, and the major GC stops pacing from allocation. caml_gc_set reads the field with Long_val and passes it to norm_pfree as an unsigned value, which only clamps it to at least 1 (gc_ctrl.c:151-154, :169), so 100 + percent_free wraps and the collector no longer schedules major work by allocation…
KC Sivaramakrishnan (@kayceesrk)Grow the mark stack when compression cannot make room
realloc_mark_stack can return without making room on the mark stack. mark_stack_push_range then writes past the end of the stack, and keeps doing so on every later push, because it only reallocates when count == size.
Nick Barnes (@NickBarnes)Hashtbl.Make.replace loses a binding when equal resizes
Hashtbl.Make.replace loses a binding and leaves length too large when the user's equal adds to the same table. replace reads the bucket index i and the bucket l, then walks l calling H.equal (hashtbl.ml:485-489). If equal grows the table, resize installs a new, doubled bucket array and relinks the cells in place (hashtbl.ml:156-165). Back in replace_bucket, …
KC Sivaramakrishnan (@kayceesrk)Hashtbl.filter_map_inplace can leave a negative length
Hashtbl.filter_map_inplace decrements size before the cell is unlinked, so a raise from f leaves length smaller than the number of bindings still in the table:
KC Sivaramakrishnan (@kayceesrk)Head shapes and constructor unboxing
This PR implements a variant of the "constructor unboxing" feature proposed by Jeremy Yallop (@yallop) in RFC #14 in March 2020, which extends the current [@@unboxed] annotation for single-constructor variant types (or single-field record types). A first experimental implementation of this feature was done Nicolas Chataing (@nchataing) in Summer 2021. I reba…
Gabriel Scherer (@gasche)Implement ASAN redzones for runtime events ring buffer
This introduces the general mechanism described in https://github.com/ocaml/ocaml/issues/15279, and applies it to Runtime_events.
Török Edwin (@edwintorok)Improving ASAN tracking of OOB accesses for mmap()-ed regions in the C runtime
It is desirable to make out of bounds accesses always trap when run under the address sanitizer, especially for testcases.
Török Edwin (@edwintorok)Inline the full-application part of caml_apply
Similar to #198, but we structure the code so that the argument loading is not repeated for the caml_apply and full application call, in order to not increase code size too much. This is especially important for functions with many arguments.
Stefan Muenzel (@smuenzel)Json output for the compiler, part 1: structured metadata for error messages
This PR is the result of @muskangarg21's Outreachy internship.
Florian Angeletti (@Octachron)Lazy.Mutexed.force leaks its mutex on an asynchronous exception
Lazy.Mutexed.force leaves the mutex locked if an asynchronous exception arrives after the thunk has returned, so the value is lost and the lazy is permanently wedged.
KC Sivaramakrishnan (@kayceesrk)Lost ephemeron marking round at the end of `mark`
A domain can lose an ephemeron round at the end of mark (), leaving an ephemeron with a marked key and unmarked data that no round rescans. The debug runtime asserts in caml_ephe_clean, and the release runtime gives the mutator data that the next cycle frees.
KC Sivaramakrishnan (@kayceesrk)Major GC never completes a cycle after a failed `Domain.spawn`
If domain_create fails after caml_init_major_gc has succeeded, for example because the minor heap arena cannot be committed, Domain.spawn raises Failure and from then on no major cycle completes. Gc.full_major () does not return and the major heap grows without bound.
KC Sivaramakrishnan (@kayceesrk)Make warning 8 (partial-match) fatal by default in ocamlc and ocamlopt
Fixes https://github.com/ocaml/ocaml/issues/12475
Kate (@kit-ty-kate)Malformed .cmi crashes ocamlobjinfo
ocamlobjinfo segfaults on a malformed .cmi. Reproduced on trunk f0c1023333 with the in-tree bytecode tools.
KC Sivaramakrishnan (@kayceesrk)