Thicket thicket
ocaml
REPOS 27
SEARCH THE ARCHIVE

Repository activity

40458 results across all weeks

  1. IssueW47.2026 · 16–22 Novocaml/ocaml

    Sys.command overwrites a SIGINT handler from another domain

    A SIGINT handler installed with Sys.signal while another domain runs Sys.command is lost: a later SIGINT kills the process instead of running the handler.

    KC Sivaramakrishnan (@kayceesrk)
  2. IssueW47.2026 · 16–22 Novocaml/ocaml

    Sys.readdir aborts when an entry allocation fails

    Sys.readdir aborts with Fatal error: no domain lock held when the copy of a directory entry name cannot be allocated. caml_read_directory makes that copy with the raising caml_stat_strdup (unix.c:352). The copy happens inside the blocking section of Sys.readdir (sys.c:839-841), which has released the domain lock. If the allocation fails, the raise runs with …

    KC Sivaramakrishnan (@kayceesrk)
  3. IssueW47.2026 · 16–22 Novocaml/ocaml

    Sys.set_signal truncates the signal number before its check

    Sys.set_signal ((1 lsl 32) + 2) installs a handler for SIGINT instead of raising Invalid_argument. The number is truncated to a C int before the range check (signals.c:730). Sys.signal_of_int truncates the same way: (1 lsl 32) + 2 returns -6, which is Sys.sigint, and (1 lsl 32) - 2 returns -2, which is Sys.sigalrm. This is the int truncation from #15249 and …

    KC Sivaramakrishnan (@kayceesrk)
  4. IssueW47.2026 · 16–22 Novocaml/ocaml

    Terminated domains leak their finaliser tables

    Repeatedly spawning domains that register finalisers leaks memory after they terminate. Found with DeepSeek v4.1 Flash 1017. On 5.5.0, macOS arm64:

    KC Sivaramakrishnan (@kayceesrk)
  5. IssueW47.2026 · 16–22 Novocaml/ocaml

    Testsuite failures on Power+TSAN

    While investigating failures in #14469, @OlivierNicole discovered that many tests were failing on power when TSAN was enabled. It turns out these failures were unrelated to the changes in #14469. I could recreate the failures on trunk.

    KC Sivaramakrishnan (@kayceesrk)
  6. Pull requestW47.2026 · 16–22 Novocaml/ocaml

    The Pattern-Matching Bug returns: Or-pattern version

    Original bug report by @mshinwell: oxcaml/oxcaml#8030.

    Vincent Laviron (@lthls)
  7. IssueW47.2026 · 16–22 Novocaml/ocaml

    The masterlock is initialised without its lock

    st_masterlock_init writes its fields without m->lock: init = true (st_pthreads.h:100), then busy = true (:102) and waiters = 0 (:103). A registrant can see the domain from the moment its unique id is published (domain.c:891), before the init hook (:1430), and reads these fields without the domain lock (st_stubs.c:842). The three failures below are one cause:…

    KC Sivaramakrishnan (@kayceesrk)
  8. IssueW47.2026 · 16–22 Novocaml/ocaml

    Unix exec stubs can pass a string with a NUL to the child

    When another domain writes into the string array passed to Unix.create_process_env (or Unix.execve, execv, execvp, execvpe, create_process), an element containing a NUL can get past the NUL check. The child then receives the string truncated at the NUL, and the call does not raise EINVAL.

    KC Sivaramakrishnan (@kayceesrk)
  9. IssueW47.2026 · 16–22 Novocaml/ocaml

    Unix path stubs leak the path copy when a handler raises

    The Unix path stubs copy the path with caml_stat_strdup and then call caml_enter_blocking_section (stat_unix.c:119-123). That runs pending OCaml signal handlers before dropping the domain lock (signals.c:167-185). A handler that raises skips the caml_stat_free, so the copy leaks. About 30 path stubs have the same order, including getaddrinfo and gethostbynam…

    KC Sivaramakrishnan (@kayceesrk)
  10. IssueW47.2026 · 16–22 Novocaml/ocaml

    Unix.ADDR_INET silently truncates the port

    Unix.ADDR_INET accepts any int as the port and truncates it modulo 65536 when the address is converted to a sockaddr_in. bind with port 70000 binds 4464.

    KC Sivaramakrishnan (@kayceesrk)
  11. IssueW47.2026 · 16–22 Novocaml/ocaml

    Unix.close_process_in can leave the child unreaped

    close_process_in removes the entry from popen_processes and closes the channel before it waits for the child (unix_unix.ml:1062-1067). waitpid_non_intr calls the waitpid stub. A pending OCaml signal handler runs when the stub enters its blocking section (signals.c:167-185), and one that arrives during the wait runs when the stub raises EINTR (fail_nat.c:68).…

    KC Sivaramakrishnan (@kayceesrk)
  12. IssueW47.2026 · 16–22 Novocaml/ocaml

    Unix.establish_server leaks the socket when bind fails

    When bind fails, Unix.establish_server raises and leaves its socket open: 100 failed calls leak 100 descriptors. It creates the socket and calls setsockopt, bind and listen with no error path (unix_unix.ml:1120-1125). open_connection, just above, closes the socket when connect raises (unix_unix.ml:1104-1111).

    KC Sivaramakrishnan (@kayceesrk)
  13. IssueW47.2026 · 16–22 Novocaml/ocaml

    Unix.kill, waitpid and alarm truncate their arguments

    Unix.kill ((1 lsl 32) + child) Sys.sigterm kills the child, and Unix.waitpid [] ((1 lsl 32) + child) reaps it. Unix.alarm (1 lsl 32) cancels a pending alarm exactly like alarm 0. kill.c:28 and wait.c:96 pass Int_val straight to a pid_t, truncating it to 32 bits (kill.c:28, wait.c:96), and Unix.alarm casts to unsigned int (alarm.c:21). This is the same trunca…

    KC Sivaramakrishnan (@kayceesrk)
  14. IssueW47.2026 · 16–22 Novocaml/ocaml

    Unix.mktime truncates the year field

    Unix.mktime with tm_year = 70 + 2^32 returns the same time as tm_year = 70, 1 January 1970. It reads the tm fields with Int_val into the C int fields of struct tm (gmtime.c:78-83), so a tm_year outside the int range wraps.

    KC Sivaramakrishnan (@kayceesrk)
  15. IssueW47.2026 · 16–22 Novocaml/ocaml

    Unix.setuid and Unix.getpwuid truncate ids mod 2^32

    Unix.getpwuid (0x1_0000_0000 + 501) returns the entry for uid 501, and Unix.setuid (0x1_0000_0000 + 501) is setuid 501. The stubs convert the id with Int_val, which casts it to a C int (caml/mlvalues.h:84), so an out-of-range id is silently reduced mod 2^32 instead of rejected.

    KC Sivaramakrishnan (@kayceesrk)
  16. IssueW47.2026 · 16–22 Novocaml/ocaml

    Unix.sigsuspend does not run the handler that woke it

    With the signal blocked, Unix.sigsuspend returns when the signal arrives, but the OCaml handler does not run until the signal is unblocked afterwards. The usual sigprocmask/sigsuspend wait loop can then block indefinitely on its next iteration.

    KC Sivaramakrishnan (@kayceesrk)
  17. IssueW47.2026 · 16–22 Novocaml/ocaml

    Unix.stat raises ENOENT on a Unix-domain socket file on Windows

    Unix.stat and Unix.lstat fail on the file a Unix-domain socket is bound to, although the file exists:

    Thomas Gazagnaire (@samoht)
  18. IssueW47.2026 · 16–22 Novocaml/ocaml

    Unix.utimes gets a negative usec for pre-1970 times

    On Linux, Unix.utimes with a negative fractional time such as -100.5 fails with EINVAL, while -100.0 and 100.5 work. caml_timeval_of_sec splits the time with modf and multiplies the fraction by 1e6 (unixsupport.h:192-204). For a negative fractional time the fraction is negative, so tv_usec is negative, and Linux utimes rejects that with EINVAL.

    KC Sivaramakrishnan (@kayceesrk)
  19. IssueW47.2026 · 16–22 Novocaml/ocaml

    Unix: SO_RCVTIMEO and SO_SNDTIMEO don't round-trip on Windows

    On Windows, a socket timeout set with Unix.setsockopt_float reads back truncated:

    Thomas Gazagnaire (@samoht)
  20. Pull requestW47.2026 · 16–22 Novocaml/ocaml

    Unix: do not run signal handlers while holding C resources

    Many Unix stubs copy their string arguments out of the OCaml heap (or open a Windows HANDLE) and then call caml_enter_blocking_section, which runs pending OCaml signal handlers. If a handler raises, the copy (or handle) is never released.

    Nicolás Ojeda Bär (@nojb)