github-actions[bot] commented on code in PR #69819:
URL: https://github.com/apache/doris/pull/69819#discussion_r4422480037


##########
be/test/jemalloc_hook/jemalloc_hook_test.cpp:
##########
@@ -0,0 +1,128 @@
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements.  See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership.  The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License.  You may obtain a copy of the License at
+//
+//   http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied.  See the License for the
+// specific language governing permissions and limitations
+// under the License.
+
+#include <dlfcn.h>
+#include <gtest/gtest.h>
+
+#include <array>
+#include <cerrno>
+#include <cstdint>
+#include <cstdlib>
+#include <cstring>
+#include <limits>
+#include <memory>
+#include <thread>
+
+namespace doris {
+
+class JemallocHookTest : public testing::Test {
+protected:
+    using MemalignFunction = void* (*)(size_t, size_t);
+
+    void SetUp() override {
+        void* symbol = dlsym(RTLD_DEFAULT, "__libc_memalign");

Review Comment:
   [P2] Ensure this test actually calls the hook defined by this PR. 
`jemalloc_hook_test` intentionally leaves `ENABLE_EXPORTS` off, but `SetUp()` 
obtains `__libc_memalign` only through `dlsym(RTLD_DEFAULT)`. That lookup 
searches the dynamic symbol scope and can select libc's implementation (or vary 
with the linker), while the ordinary alias in the executable is not guaranteed 
to be visible. In that case the allocation/free assertions and the TLS test can 
pass without exercising the new alias. Call the linked hook directly or assert 
with `dladdr`/the executable's dynamic symbol table that the resolved address 
is the hook, and keep the DSO path tied to that verified interposition.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to