Skip to content

Native hardening to land with the next native rebuild (stream_proxy ABI probe + iOS 15 targets) #453

Description

@DenisovAV

Two changes are already made or designed but cannot take effect until the native artifacts are rebuilt. Collecting them here so they land together rather than each triggering a seven-platform rebuild.

1. stream_proxy.c — make the ABI probe unable to guess wrong (#447 follow-up)

The v0.14 → v0.15 stream-callback shape is decided at runtime by probing for litert_lm_stream_chunk_get_text. The probe uses dlsym(RTLD_DEFAULT, …), so NULL means either "the library is old and has no such symbol" or "the library is new but its symbols are not in this search scope" — and the code silently picks the first, registering a 4-arg callback against a 2-arg library. That is #447: arguments 3 and 4 come from whatever the registers hold, strdup faults, zero chunks and SIGABRT.

Not urgent. Since flutter_gemma_litertlm 1.5.2 the generation path loads through openLiteRtLmRequiringDefaultScope, which throws on exactly that poisoned-scope state, so the C-level guess is no longer reachable from a normal app. This is defence in depth for a construct that has already fired once.

  • resolve through the handle stream_proxy_load_global already returns, instead of the ambient scope;
  • add a control symbol present in both versions (litert_lm_engine_create) so "old library" and "invisible library" stop sharing one answer;
  • return NULL from stream_proxy_create for the third case, and check that return in litert_lm_client.dart — today it is ignored, so a loud C-side failure would still be driven past.

2. iOS deployment targets already lowered, waiting for a rebuild (#441)

packages/flutter_gemma_litertlm/native/litert_lm/build_ios.sh and packages/flutter_gemma_rag_qdrant/native/qdrant_edge/build_local.sh now compile at ios15.0 instead of 16.0, matching the floor shipped in flutter_gemma 1.6.4.

The published native-v0.16.0 and qdrant-edge-v0.7.3 binaries were built at 16.0. Both are safe under the 15.0 floor — every undefined symbol in them predates iOS 13, and vtool normalises minos to 13.0 either way — so this changes nothing until the next build. Both scripts carry a NOTE saying so; delete those notes once a tag after each has been built.

When

The next time a rebuild happens for another reason — a LiteRT-LM bump, most likely. Standalone it costs seven platforms, a new native-v* tag, fresh SHA256s, the manifest gate and the full smoke matrix, for hardening that is currently unreachable.

@think2execute offered to verify on the hardware that reproduced #447 — worth taking up when a pre-release exists; it reproduces reliably there and the instrumentation is still in place.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions