Repository navigation
Tags
Tags
Make signal stack-trace test TSAN-compatible Summary: [🤖 Metamate] Make `StackTraceTest.Signal` signal-safe so it can run under TSAN rather than report a runtime skip or be compiled out. The handler captures only `getStackTraceSafe()` into fixed storage and publishes its count with a statically verified lock-free atomic. Preserve `errno` in the handler and restore the previous signal action after the test. Perform symbolization and assertions after `raise()` returns, checking errno preservation and that the captured trace includes the handler and interrupted caller in order. `Simple` continues comparing all three stack-trace APIs outside signal context. ___ landed-with-radar-review Differential Revision: D127472550 fbshipit-source-id: da7c1eb3b5bdc5bdf8fd6a12c88492aa6a8747c4
Cherry-pick: "Eliminate exit-time destructor in TypedTestSuitePState." Summary: This is a cherry-pick of commit hash b66cffcd5f5d6ee34a4f96d57bf016d9a22cb023 from googletest upstream. Github: google/googletest@b66cffc The original commit summary is: `TYPED_TEST_SUITE_P` defines a static `TypedTestSuitePState` variable at namespace scope. Storing registered tests in a `std::map<std::string, CodeLocation>` required dynamic initialization, heap allocations, and an exit-time destructor, triggering `-Wexit-time-destructors` warnings in builds that enforce trivial exit. Store registered tests in an intrusive sorted singly-linked list of static POD `RegisteredTest` nodes defined by `TYPED_TEST_P`. `TypedTestSuitePState` is now `constexpr`-constructible and trivially destructible without heap allocations. PiperOrigin-RevId: 998634744 Change-Id: I0c833ffeebdf21b155038b7e95e497637e68564a ### Manual Fix Upstream replaced the internal `TypedTestSuitePState::AddTestName()` with `AddTest(RegisteredTest*, const char*)`, which takes a caller-owned static `RegisteredTest` node. Four Meta-side copies of the old `TYPED_TEST_P` macro still call `AddTestName()` and fail to compile: ``` error: no member named 'AddTestName' in 'testing::internal::TypedTestSuitePState' ``` - `xplat/follyfex/gtest/GTestHelpers.h`: `CO_TYPED_TEST_P` declares a static `RegisteredTest` and registers it with `AddTest()`, matching the new upstream `TYPED_TEST_P`. Fixes `xplat/follyfex/gtest/tests:gtestAndroid`, the `xplat/assistant/oacr/contacts` warm-start tests, and `xplat/rtc/crucible/tests:callSetupFoundation` / `:callSetupRsys`. - `fbcode/folly/coro/GtestHelpers.h`, `xplat/folly/coro/GtestHelpers.h` (identical copies): `CO_TYPED_TEST_P_` registers through the new `folly::detail::gtestAddTypedTest()`, which calls `AddTest()` when `TypedTestSuitePState::RegisteredTest` exists and falls back to `AddTestName()` otherwise. folly is open source and its getdeps build uses googletest v1.17.0, which predates this change. Fixes `folly/coro/test:gtest_helpers_test` in fbcode and xplat. - `fbcode/paxi/common/AsyncTest.h`: `TYPED_ASYNC_TEST_P` gets the same change as follyfex. Fixes `fbcode//paxi/api/test:dummy_paxi_log_test`. CI only flagged the follyfex and contacts targets; the crucible, folly and paxi breaks came from local builds. Test behavior is unchanged. #build-all allow-large-files allow-many-files ### Upstream comparison All 4 changed googletest files are byte-identical to upstream -- no Meta patches. The Manual Fix files are Meta-side changes and need a normal review. ___ landed-with-radar-review Differential Revision: D125187238 fbshipit-source-id: 9fb208c40ec0be388bb3f5908d3ccf883d52f767
Make cert utils build against OpenSSL 4.0 (#2706) Summary: Pull Request resolved: #2706 OpenSSL 4.0 makes ASN1_STRING opaque and const-corrects the X509 accessors (X509_get_subject_name/issuer_name, X509_get_ext, X509_EXTENSION_get_object/get_data). Switch the affected call sites in OpenSSLUtils and OpenSSLCertUtils to the const-correct API, using ASN1_STRING_get0_data/length instead of direct struct access. The const_casts bridge pre-4.0 getters that still take non-const parameters; they are no-ops there and keep the code compiling against 1.1.1 and 3.x as well. Note on the const_casts: fbcode builds folly against OpenSSL 1.1.1, where e.g. X509_NAME_get_index_by_NID(X509_NAME *name, ...) is still non-const (openssl/1.1.1 x509.h:816); removing the cast fails the build, so it is required there and a no-op on 3.x/4.0 where the parameter is const. Verified by building with and without the cast. Upstream issue: #2705 Reviewed By: yfeldblum Differential Revision: D120544956 fbshipit-source-id: 6f239c7395b6c6f7b9cbaf1750fe7b537c2c2f09
Add RequestData::clearable() opt-out Summary: `clearContextData()` (and overwrite / duplicate `setContextData()`) can remove a `RequestData` from a context while other threads still reference it, thus it is almost impossible to use safely. Furthermore, some `RequestData` implementations might rely on not being clearable by the business logic, for example to ensure that thread-local state is always cleaned up by pairing each `onSet()` with an `onUnset()` (which is not guaranteed right now if the object is cleared). These objects generally try to achieve this by hiding the request token, but that is just a string that can be hardcoded. Add a `clearable()` opt-out (default `true`). A `RequestData` that returns `false` cannot be removed from a context that may be shared: `clearContextData()`, a duplicate `setContextData()`, and `overwriteContextData()` with `safe = false` throw `std::invalid_argument`. It can still be replaced or removed with `ShallowCopyRequestContextScopeGuard`, which overwrites it with `safe = true` in a copy of the context that is not shared yet. The opt-out is meant to be the new default by convention, since it would be a large effort to retroactively fix all the existing implementations. Reviewed By: uvdn7 Differential Revision: D108613243 fbshipit-source-id: 4ba72901490ad89b402eb5768a7cff0a696b958a
Define the installed rule root with $HOME
Summary:
Quoted `{FA}` paths do not expand a leading `~`. Define `{FA}` as
`$HOME/folly_agents` in both installer templates, and include that definition in
the loader hash so any harness using the installed loader gets the existing
migration warning.
Drive-by fixes:
- Another failure to expand `~` was in `--preamble-dir=~/...`. The old
parser rejected space-separated options. Fix that bug, and instead expressly
forbid duplicate options (the intent is to prevent overrides).
- Reject relative `TMPDIR` before creating reviewer paths.
- Allow reviewer to retry cheap startup failures.
- `stale_rule_alert.py` now detect divergent definitions of `{FA}`.
___
Differential Revision: D122104077
fbshipit-source-id: 8e0923581babdd99bbcc871e8e7cf34bc730f7af
Fix Arena::merge returning already-allocated memory from an empty des… …tination Summary: ## What goes wrong ```cpp SysArena src; auto* live = static_cast<char*>(src.allocate(1)); *live = 'x'; SysArena dst; // never allocated dst.merge(std::move(src)); // dst takes ownership of src's blocks dst.allocate(1); // returns `live` again: an address already allocated ``` ## Why ```cpp blocks_.splice_after(blocks_.before_begin(), other.blocks_); ``` `blocks_` is a `boost::intrusive::slist` of `Block` headers, each at the head of one malloc'd chunk. `splice_after(prev, x)` moves **every** element of `x` into this list immediately after `prev` and leaves `x` empty, relinking next-pointers only — no allocation, no copy, node addresses unchanged, which is what makes it a legitimate ownership transfer. It is `_after` because a singly-linked list has no back-pointers, so positions are expressed via the predecessor; `before_begin()` is the sentinel root before the first element, so this means **insert at the front**. `allocate()` only ever advances its cursor to the next block, toward the tail. So the invariant is: *any block behind `currentBlock_` is unreachable and can never be handed out again.* Front-splicing is deliberately putting the merged blocks out of reach. - **Destination has already allocated** — `currentBlock_` is anchored on one of its own blocks, which sit *after* the spliced-in ones, so it can only ever advance into its own reusable blocks. `last_` is not updated either, correctly: inserting at the front does not change the tail. - **Destination has never allocated** — a fresh `Arena` sets `currentBlock_ = blocks_.last()`, and for an empty `cache_last` slist `last_` **is** the root node, so `currentBlock_ == before_begin()`. That is the one position in the list *before* the merged blocks. `splice_after` moves `last_` to the merged tail (its `cache_last` bookkeeping fires only when `prev` is the tail, i.e. only when the list was empty) and nothing rewinds `currentBlock_`. `canReuseExistingBlock()` then sees `currentBlock_ != blocks_.last()`, so `allocate()` advances the cursor to the next block — the first merged one — and hands it out. https://pxl.cl/ddJKx ## Fix Park `currentBlock_` on the tail when the destination was empty, restoring the invariant that the cursor is at or after every merged block. The next allocation then falls through to `allocateSlow()` and appends a fresh block. ## Impact Latent today. The only in-tree caller is `ThreadCachedArena::zombify`, whose destination arena only accumulates merged blocks and is never allocated from. It bites as soon as anything merges into an arena it then allocates from. Reviewed By: vitaut Differential Revision: D120221054 fbshipit-source-id: 80382d2e1b42daed5cad8afb3509ef72c11ed711
Remove unnecessary map lookup in RequestContext::State::insertNewData() Summary: The lookup is always false, as verified by the `DCHECK(inserted);` below. Reviewed By: IosifSpulber Differential Revision: D116023688 fbshipit-source-id: cb011414350bc1c74814334fae44da3618e62cdd
AsyncSocket: clear errMessageCallback_ before delayed zero copy drain Summary: Fixes a similar problem to D118665976. The delayed zero copy drain may cause AsyncSocket to outlive errMessageCallback_, so it isn't safe to call from within the the delayed drain callback. Clear it when scheduling the drain. Reviewed By: dmm-fb Differential Revision: D118666023 fbshipit-source-id: 4b47200d03a9e3d1aff0ad2a41e6de202d256fa8
folly/lang: guard the -Wcast-function-type-mismatch pragma Summary: `reinterpret_function_cast` suppresses `-Wcast-function-type-mismatch` with an unconditional `FOLLY_CLANG_DISABLE_WARNING`. That warning group did not exist before clang 19, and clang diagnoses an unknown group in a `#pragma clang diagnostic ignored` as `-Wunknown-warning-option` -- a warning normally, an error under `-Werror`. Any clang older than 19 that reaches `Cast.h` in a `-Werror` build fails to compile it. Nothing hits this today because `Cast.h` has a narrow include closure. It is a latent trap for whoever widens that closure, so guard the pragma with `FOLLY_HAS_WARNING`, which is `__has_warning` on clang and 0 everywhere else. ___ Differential Revision: D118025808 fbshipit-source-id: db6ba0d798e3d6431b05a99d951dc1d49990d41f
Updating hashes Summary: GitHub commits: meta/CacheLib@7fa1ae1 meta/fb303@eb24751 meta/fbthrift@d9d48f1 653d0b3 meta/mvfst@660f570 meta/proxygen@ba1313a pyrefly-org/pyrefly@298d3ba meta/wangle@276b06e facebookexperimental/edencommon@08c4ea5 facebookexperimental/rust-shed@fa939a0 facebookincubator/fizz@c8e92e1 Reviewed By: bigfootjon fbshipit-source-id: 6bc26be1e2af72cacb527dbaf4e9ed6e35c21268
PreviousNext