summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRye <rye@alchemyviewer.org>2025-10-27 01:53:04 -0400
committerRye <rye@alchemyviewer.org>2025-10-27 04:59:17 -0400
commit17fd0f6a50a7838792ca4f15d713a140fec037d5 (patch)
tree0829f07303dbcb4ae6df732a5bb7ed89304647bf
parente803bbc0db695abe73de9797510ba22646528e23 (diff)
Add support for building with address, undefined, and thread sanitizers on linux
Signed-off-by: Rye <rye@alchemyviewer.org>
-rw-r--r--indra/cmake/00-Common.cmake37
-rw-r--r--indra/llcommon/llinstancetracker.h8
-rw-r--r--indra/newview/CMakeLists.txt18
-rwxr-xr-xindra/newview/linux_tools/wrapper.sh2
-rw-r--r--indra/newview/llvoiceclient.cpp121
5 files changed, 171 insertions, 15 deletions
diff --git a/indra/cmake/00-Common.cmake b/indra/cmake/00-Common.cmake
index c03b2d24ea..24402f03ee 100644
--- a/indra/cmake/00-Common.cmake
+++ b/indra/cmake/00-Common.cmake
@@ -143,14 +143,39 @@ if (LINUX)
LL_IGNORE_SIGCHLD
)
- if(ENABLE_ASAN)
- add_compile_options(-U_FORTIFY_SOURCE
- -fsanitize=address
- --param asan-stack=0
+ option(ENABLE_ASAN "Enable Address Sanitizer" OFF)
+ option(ENABLE_UBSAN "Enable Undefined Behavior Sanitizer" OFF)
+ option(ENABLE_THREADSAN "Enable Thread Sanitizer" OFF)
+ if(ENABLE_ASAN OR ENABLE_UBSAN OR ENABLE_THREADSAN)
+ set(GCC_DISABLE_FATAL_WARNINGS ON) # Disable warnings as errors during sanitizer builds due to false positives
+
+ add_compile_options(
+ -U_FORTIFY_SOURCE
+ -fno-omit-frame-pointer
+ -fno-common
+ -fsanitize-recover=all
)
- add_link_options(-fsanitize=address)
+
+ # libwebrtc is incompatible with sanitizers
+ set(DISABLE_WEBRTC ON)
+ add_compile_definitions(DISABLE_WEBRTC=1)
+
+ if(ENABLE_ASAN)
+ add_compile_options(-fsanitize=address)
+ add_link_options(-fsanitize=address)
+ endif()
+
+ if(ENABLE_UBSAN)
+ add_compile_options(-fsanitize=undefined)
+ add_link_options(-fsanitize=undefined)
+ endif()
+
+ if(ENABLE_THREADSAN)
+ add_compile_options(-fsanitize=thread)
+ add_link_options(-fsanitize=thread)
+ endif()
else()
- add_compile_definitions($<$<CONFIG:Release>:_FORTIFY_SOURCE=2>)
+ add_compile_definitions($<$<CONFIG:Release>:_FORTIFY_SOURCE=2>)
endif()
add_compile_options(
diff --git a/indra/llcommon/llinstancetracker.h b/indra/llcommon/llinstancetracker.h
index 92b26354a1..6692d6a697 100644
--- a/indra/llcommon/llinstancetracker.h
+++ b/indra/llcommon/llinstancetracker.h
@@ -28,6 +28,8 @@
#ifndef LL_LLINSTANCETRACKER_H
#define LL_LLINSTANCETRACKER_H
+#include "llpreprocessor.h"
+
#include <map>
#include <set>
#include <vector>
@@ -244,6 +246,9 @@ public:
}
protected:
+#if LL_CLANG || LL_GNUC
+ __attribute__((no_sanitize("vptr")))
+#endif
LLInstanceTracker(const KEY& key)
{
// We do not intend to manage the lifespan of this object with
@@ -482,6 +487,9 @@ public:
using key_snapshot_of = instance_snapshot_of<SUBCLASS>;
protected:
+#if LL_CLANG || LL_GNUC
+ __attribute__((no_sanitize("vptr")))
+#endif
LLInstanceTracker()
{
// Since we do not intend for this shared_ptr to manage lifespan, give
diff --git a/indra/newview/CMakeLists.txt b/indra/newview/CMakeLists.txt
index 211d51ec15..8c39f5f249 100644
--- a/indra/newview/CMakeLists.txt
+++ b/indra/newview/CMakeLists.txt
@@ -718,7 +718,6 @@ set(viewer_SOURCE_FILES
llvoiceclient.cpp
llvoicevisualizer.cpp
llvoicevivox.cpp
- llvoicewebrtc.cpp
llvoinventorylistener.cpp
llvopartgroup.cpp
llvosky.cpp
@@ -1386,7 +1385,6 @@ set(viewer_HEADER_FILES
llvoiceclient.h
llvoicevisualizer.h
llvoicevivox.h
- llvoicewebrtc.h
llvoinventorylistener.h
llvopartgroup.h
llvosky.h
@@ -1424,6 +1422,11 @@ source_group("CMake Rules" FILES ViewerInstall.cmake)
file(WRITE "${CMAKE_CURRENT_BINARY_DIR}/viewer_version.txt"
"${VIEWER_SHORT_VERSION}.${VIEWER_VERSION_REVISION}\n")
+if (NOT DISABLE_WEBRTC)
+ LIST(APPEND viewer_SOURCE_FILES llvoicewebrtc.cpp)
+ LIST(APPEND viewer_HEADER_FILES llvoicewebrtc.h)
+endif()
+
if (DARWIN)
LIST(APPEND viewer_SOURCE_FILES llappviewermacosx.cpp)
LIST(APPEND viewer_SOURCE_FILES llappviewermacosx-objc.mm)
@@ -2014,7 +2017,6 @@ target_link_libraries(${VIEWER_BINARY_NAME}
llcorehttp
llcommon
llmeshoptimizer
- llwebrtc
lllogin
llprimitive
llappearance
@@ -2025,16 +2027,20 @@ target_link_libraries(${VIEWER_BINARY_NAME}
ll::openxr
)
+if (NOT DISABLE_WEBRTC)
+ target_link_libraries(${VIEWER_BINARY_NAME} llwebrtc )
+endif()
+
if (USE_DISCORD)
- target_link_libraries(${VIEWER_BINARY_NAME} ll::discord_sdk )
+ target_link_libraries(${VIEWER_BINARY_NAME} ll::discord_sdk )
endif ()
if( TARGET ll::intel_memops )
- target_link_libraries(${VIEWER_BINARY_NAME} ll::intel_memops )
+ target_link_libraries(${VIEWER_BINARY_NAME} ll::intel_memops )
endif()
if( TARGET ll::nvapi )
- target_link_libraries(${VIEWER_BINARY_NAME} ll::nvapi )
+ target_link_libraries(${VIEWER_BINARY_NAME} ll::nvapi )
endif()
if ( TARGET llconvexdecomposition )
diff --git a/indra/newview/linux_tools/wrapper.sh b/indra/newview/linux_tools/wrapper.sh
index bab5ea8a46..7e7a9a5e49 100755
--- a/indra/newview/linux_tools/wrapper.sh
+++ b/indra/newview/linux_tools/wrapper.sh
@@ -18,6 +18,8 @@ export mesa_glthread=true
## an unstripped binary before you run.
#export LL_WRAPPER='gdb --args'
#export LL_WRAPPER='valgrind --smc-check=all --error-limit=no --log-file=secondlife.vg --leak-check=full --suppressions=/usr/lib/valgrind/glibc-2.5.supp --suppressions=secondlife-i686.supp'
+#export ASAN_OPTIONS="halt_on_error=0 detect_leaks=1 symbolize=1"
+#export UBSAN_OPTIONS="print_stacktrace=1 print_summary=1 halt_on_error=0"
## Nothing worth editing below this line.
##-------------------------------------------------------------------
diff --git a/indra/newview/llvoiceclient.cpp b/indra/newview/llvoiceclient.cpp
index 71a9e71a9f..507154a2a3 100644
--- a/indra/newview/llvoiceclient.cpp
+++ b/indra/newview/llvoiceclient.cpp
@@ -26,7 +26,9 @@
#include "llvoiceclient.h"
#include "llvoicevivox.h"
+#ifndef DISABLE_WEBRTC
#include "llvoicewebrtc.h"
+#endif
#include "llviewernetwork.h"
#include "llviewercontrol.h"
#include "llcommandhandler.h"
@@ -39,6 +41,7 @@
#include "llagent.h"
#include "lltrans.h"
#include "lluiusage.h"
+#include "llmutelist.h"
const F32 LLVoiceClient::OVERDRIVEN_POWER_LEVEL = 0.7f;
@@ -120,10 +123,12 @@ LLVoiceModuleInterface *getVoiceModule(const std::string &voice_server_type)
{
return (LLVoiceModuleInterface *) LLVivoxVoiceClient::getInstance();
}
+#ifndef DISABLE_WEBRTC
else if (voice_server_type == WEBRTC_VOICE_SERVER_TYPE)
{
return (LLVoiceModuleInterface *) LLWebRTCVoiceClient::getInstance();
}
+#endif
else
{
LLNotificationsUtil::add("VoiceVersionMismatch");
@@ -165,7 +170,9 @@ void LLVoiceClient::init(LLPumpIO *pump)
{
// Initialize all of the voice modules
m_servicePump = pump;
+#ifndef DISABLE_WEBRTC
LLWebRTCVoiceClient::getInstance()->init(pump);
+#endif
LLVivoxVoiceClient::getInstance()->init(pump);
}
@@ -176,7 +183,9 @@ void LLVoiceClient::userAuthorized(const std::string& user_id, const LLUUID &age
mRegionChangedCallbackSlot.disconnect();
}
mRegionChangedCallbackSlot = gAgent.addRegionChangedCallback(boost::bind(&LLVoiceClient::onRegionChanged, this));
+#ifndef DISABLE_WEBRTC
LLWebRTCVoiceClient::getInstance()->userAuthorized(user_id, agentID);
+#endif
LLVivoxVoiceClient::getInstance()->userAuthorized(user_id, agentID);
}
@@ -286,16 +295,20 @@ void LLVoiceClient::setNonSpatialVoiceModule(const std::string &voice_server_typ
void LLVoiceClient::setHidden(bool hidden)
{
LL_INFOS("Voice") << "( " << (hidden ? "true" : "false") << " )" << LL_ENDL;
+#ifndef DISABLE_WEBRTC
LLWebRTCVoiceClient::getInstance()->setHidden(hidden);
+#endif
LLVivoxVoiceClient::getInstance()->setHidden(hidden);
}
void LLVoiceClient::terminate()
{
- if (LLVivoxVoiceClient::instanceExists())
+#ifndef DISABLE_WEBRTC
+ if (LLWebRTCVoiceClient::instanceExists())
{
LLWebRTCVoiceClient::getInstance()->terminate();
}
+#endif
if (LLVivoxVoiceClient::instanceExists())
{
LLVivoxVoiceClient::getInstance()->terminate();
@@ -334,7 +347,9 @@ void LLVoiceClient::updateSettings()
updateMicMuteLogic();
+#ifndef DISABLE_WEBRTC
LLWebRTCVoiceClient::getInstance()->updateSettings();
+#endif
LLVivoxVoiceClient::getInstance()->updateSettings();
}
@@ -343,34 +358,50 @@ void LLVoiceClient::updateSettings()
void LLVoiceClient::tuningStart()
{
+#ifndef DISABLE_WEBRTC
LLWebRTCVoiceClient::getInstance()->tuningStart();
+#endif
LLVivoxVoiceClient::getInstance()->tuningStart();
}
void LLVoiceClient::tuningStop()
{
+#ifndef DISABLE_WEBRTC
LLWebRTCVoiceClient::getInstance()->tuningStop();
+#endif
LLVivoxVoiceClient::getInstance()->tuningStop();
}
bool LLVoiceClient::inTuningMode()
{
+#ifndef DISABLE_WEBRTC
return LLWebRTCVoiceClient::getInstance()->inTuningMode();
+#else
+ return false;
+#endif
}
void LLVoiceClient::tuningSetMicVolume(float volume)
{
+#ifndef DISABLE_WEBRTC
LLWebRTCVoiceClient::getInstance()->tuningSetMicVolume(volume);
+#endif
}
void LLVoiceClient::tuningSetSpeakerVolume(float volume)
{
+#ifndef DISABLE_WEBRTC
LLWebRTCVoiceClient::getInstance()->tuningSetSpeakerVolume(volume);
+#endif
}
float LLVoiceClient::tuningGetEnergy(void)
{
+#ifndef DISABLE_WEBRTC
return LLWebRTCVoiceClient::getInstance()->tuningGetEnergy();
+#else
+ return 0.f;
+#endif
}
//------------------------------------------------
@@ -378,40 +409,64 @@ float LLVoiceClient::tuningGetEnergy(void)
bool LLVoiceClient::deviceSettingsAvailable()
{
+#ifndef DISABLE_WEBRTC
return LLWebRTCVoiceClient::getInstance()->deviceSettingsAvailable();
+#else
+ return false;
+#endif
}
bool LLVoiceClient::deviceSettingsUpdated()
{
+#ifndef DISABLE_WEBRTC
return LLWebRTCVoiceClient::getInstance()->deviceSettingsUpdated();
+#else
+ return false;
+#endif
}
void LLVoiceClient::refreshDeviceLists(bool clearCurrentList)
{
+#ifndef DISABLE_WEBRTC
LLWebRTCVoiceClient::getInstance()->refreshDeviceLists(clearCurrentList);
+#endif
}
void LLVoiceClient::setCaptureDevice(const std::string& name)
{
LLVivoxVoiceClient::getInstance()->setCaptureDevice(name);
+#ifndef DISABLE_WEBRTC
LLWebRTCVoiceClient::getInstance()->setCaptureDevice(name);
+#endif
}
void LLVoiceClient::setRenderDevice(const std::string& name)
{
LLVivoxVoiceClient::getInstance()->setRenderDevice(name);
+#ifndef DISABLE_WEBRTC
LLWebRTCVoiceClient::getInstance()->setRenderDevice(name);
+#endif
}
const LLVoiceDeviceList& LLVoiceClient::getCaptureDevices()
{
+#ifndef DISABLE_WEBRTC
return LLWebRTCVoiceClient::getInstance()->getCaptureDevices();
+#else
+ static LLVoiceDeviceList dummy_device_list;
+ return dummy_device_list;
+#endif
}
const LLVoiceDeviceList& LLVoiceClient::getRenderDevices()
{
+#ifndef DISABLE_WEBRTC
return LLWebRTCVoiceClient::getInstance()->getRenderDevices();
+#else
+ static LLVoiceDeviceList dummy_device_list;
+ return dummy_device_list;
+#endif
}
@@ -420,13 +475,18 @@ const LLVoiceDeviceList& LLVoiceClient::getRenderDevices()
void LLVoiceClient::getParticipantList(std::set<LLUUID> &participants) const
{
+#ifndef DISABLE_WEBRTC
LLWebRTCVoiceClient::getInstance()->getParticipantList(participants);
+#endif
LLVivoxVoiceClient::getInstance()->getParticipantList(participants);
}
bool LLVoiceClient::isParticipant(const LLUUID &speaker_id) const
{
- return LLWebRTCVoiceClient::getInstance()->isParticipant(speaker_id) ||
+ return
+#ifndef DISABLE_WEBRTC
+ LLWebRTCVoiceClient::getInstance()->isParticipant(speaker_id) ||
+#endif
LLVivoxVoiceClient::getInstance()->isParticipant(speaker_id);
}
@@ -519,14 +579,22 @@ void LLVoiceClient::activateSpatialChannel(bool activate)
bool LLVoiceClient::isCurrentChannel(const LLSD& channelInfo)
{
+#ifndef DISABLE_WEBRTC
return LLWebRTCVoiceClient::getInstance()->isCurrentChannel(channelInfo) ||
LLVivoxVoiceClient::getInstance()->isCurrentChannel(channelInfo);
+#else
+ return LLVivoxVoiceClient::getInstance()->isCurrentChannel(channelInfo);
+#endif
}
bool LLVoiceClient::compareChannels(const LLSD &channelInfo1, const LLSD &channelInfo2)
{
+#ifndef DISABLE_WEBRTC
return LLWebRTCVoiceClient::getInstance()->compareChannels(channelInfo1, channelInfo2) ||
LLVivoxVoiceClient::getInstance()->compareChannels(channelInfo1, channelInfo2);
+#else
+ return LLVivoxVoiceClient::getInstance()->compareChannels(channelInfo1, channelInfo2);
+#endif
}
LLVoiceP2PIncomingCallInterfacePtr LLVoiceClient::getIncomingCallInterface(const LLSD& voice_call_info)
@@ -567,13 +635,17 @@ LLVoiceP2POutgoingCallInterface *LLVoiceClient::getOutgoingCallInterface(const L
void LLVoiceClient::setVoiceVolume(F32 volume)
{
+#ifndef DISABLE_WEBRTC
LLWebRTCVoiceClient::getInstance()->setVoiceVolume(volume);
+#endif
LLVivoxVoiceClient::getInstance()->setVoiceVolume(volume);
}
void LLVoiceClient::setMicGain(F32 gain)
{
+#ifndef DISABLE_WEBRTC
LLWebRTCVoiceClient::getInstance()->setMicGain(gain);
+#endif
LLVivoxVoiceClient::getInstance()->setMicGain(gain);
}
@@ -620,10 +692,12 @@ bool LLVoiceClient::voiceEnabled()
void LLVoiceClient::setVoiceEnabled(bool enabled)
{
+#ifndef DISABLE_WEBRTC
if (LLWebRTCVoiceClient::instanceExists())
{
LLWebRTCVoiceClient::getInstance()->setVoiceEnabled(enabled);
}
+#endif
if (LLVivoxVoiceClient::instanceExists())
{
LLVivoxVoiceClient::getInstance()->setVoiceEnabled(enabled);
@@ -646,7 +720,9 @@ void LLVoiceClient::updateMicMuteLogic()
// Either of these always overrides any other PTT setting.
new_mic_mute = true;
}
+#ifndef DISABLE_WEBRTC
LLWebRTCVoiceClient::getInstance()->setMuteMic(new_mic_mute);
+#endif
LLVivoxVoiceClient::getInstance()->setMuteMic(new_mic_mute);
}
@@ -741,8 +817,11 @@ bool LLVoiceClient::getVoiceEnabled(const LLUUID& id) const
std::string LLVoiceClient::getDisplayName(const LLUUID& id) const
{
- std::string result = LLWebRTCVoiceClient::getInstance()->getDisplayName(id);
+ std::string result;
+#ifndef DISABLE_WEBRTC
+ result = LLWebRTCVoiceClient::getInstance()->getDisplayName(id);
if (result.empty())
+#endif
{
result = LLVivoxVoiceClient::getInstance()->getDisplayName(id);
}
@@ -751,8 +830,12 @@ std::string LLVoiceClient::getDisplayName(const LLUUID& id) const
bool LLVoiceClient::isVoiceWorking() const
{
+#ifndef DISABLE_WEBRTC
return LLVivoxVoiceClient::getInstance()->isVoiceWorking() ||
LLWebRTCVoiceClient::getInstance()->isVoiceWorking();
+#else
+ return LLVivoxVoiceClient::getInstance()->isVoiceWorking();
+#endif
}
bool LLVoiceClient::isParticipantAvatar(const LLUUID& id)
@@ -767,22 +850,34 @@ bool LLVoiceClient::isOnlineSIP(const LLUUID& id)
bool LLVoiceClient::getIsSpeaking(const LLUUID& id)
{
+#ifndef DISABLE_WEBRTC
return LLWebRTCVoiceClient::getInstance()->getIsSpeaking(id) ||
LLVivoxVoiceClient::getInstance()->getIsSpeaking(id);
+#else
+ return LLVivoxVoiceClient::getInstance()->getIsSpeaking(id);
+#endif
}
bool LLVoiceClient::getIsModeratorMuted(const LLUUID& id)
{
// don't bother worrying about p2p calls, as
// p2p calls don't have mute.
+#ifndef DISABLE_WEBRTC
return LLWebRTCVoiceClient::getInstance()->getIsModeratorMuted(id) ||
LLVivoxVoiceClient::getInstance()->getIsModeratorMuted(id);
+#else
+ return LLVivoxVoiceClient::getInstance()->getIsModeratorMuted(id);
+#endif
}
F32 LLVoiceClient::getCurrentPower(const LLUUID& id)
{
+#ifndef DISABLE_WEBRTC
return std::fmax(LLVivoxVoiceClient::getInstance()->getCurrentPower(id),
LLWebRTCVoiceClient::getInstance()->getCurrentPower(id));
+#else
+ return LLVivoxVoiceClient::getInstance()->getCurrentPower(id);
+#endif
}
bool LLVoiceClient::getOnMuteList(const LLUUID& id)
@@ -794,12 +889,18 @@ bool LLVoiceClient::getOnMuteList(const LLUUID& id)
F32 LLVoiceClient::getUserVolume(const LLUUID& id)
{
+#ifndef DISABLE_WEBRTC
return std::fmax(LLVivoxVoiceClient::getInstance()->getUserVolume(id), LLWebRTCVoiceClient::getInstance()->getUserVolume(id));
+#else
+ return LLVivoxVoiceClient::getInstance()->getUserVolume(id);
+#endif
}
void LLVoiceClient::setUserVolume(const LLUUID& id, F32 volume)
{
+#ifndef DISABLE_WEBRTC
LLWebRTCVoiceClient::getInstance()->setUserVolume(id, volume);
+#endif
LLVivoxVoiceClient::getInstance()->setUserVolume(id, volume);
}
@@ -809,7 +910,9 @@ void LLVoiceClient::setUserVolume(const LLUUID& id, F32 volume)
void LLVoiceClient::addObserver(LLVoiceClientStatusObserver* observer)
{
LLVivoxVoiceClient::getInstance()->addObserver(observer);
+#ifndef DISABLE_WEBRTC
LLWebRTCVoiceClient::getInstance()->addObserver(observer);
+#endif
}
void LLVoiceClient::removeObserver(LLVoiceClientStatusObserver* observer)
@@ -818,16 +921,20 @@ void LLVoiceClient::removeObserver(LLVoiceClientStatusObserver* observer)
{
LLVivoxVoiceClient::getInstance()->removeObserver(observer);
}
+#ifndef DISABLE_WEBRTC
if (LLWebRTCVoiceClient::instanceExists())
{
LLWebRTCVoiceClient::getInstance()->removeObserver(observer);
}
+#endif
}
void LLVoiceClient::addObserver(LLFriendObserver* observer)
{
LLVivoxVoiceClient::getInstance()->addObserver(observer);
+#ifndef DISABLE_WEBRTC
LLWebRTCVoiceClient::getInstance()->addObserver(observer);
+#endif
}
void LLVoiceClient::removeObserver(LLFriendObserver* observer)
@@ -836,16 +943,20 @@ void LLVoiceClient::removeObserver(LLFriendObserver* observer)
{
LLVivoxVoiceClient::getInstance()->removeObserver(observer);
}
+#ifndef DISABLE_WEBRTC
if (LLWebRTCVoiceClient::instanceExists())
{
LLWebRTCVoiceClient::getInstance()->removeObserver(observer);
}
+#endif
}
void LLVoiceClient::addObserver(LLVoiceClientParticipantObserver* observer)
{
LLVivoxVoiceClient::getInstance()->addObserver(observer);
+#ifndef DISABLE_WEBRTC
LLWebRTCVoiceClient::getInstance()->addObserver(observer);
+#endif
}
void LLVoiceClient::removeObserver(LLVoiceClientParticipantObserver* observer)
@@ -854,10 +965,12 @@ void LLVoiceClient::removeObserver(LLVoiceClientParticipantObserver* observer)
{
LLVivoxVoiceClient::getInstance()->removeObserver(observer);
}
+#ifndef DISABLE_WEBRTC
if (LLWebRTCVoiceClient::instanceExists())
{
LLWebRTCVoiceClient::getInstance()->removeObserver(observer);
}
+#endif
}
std::string LLVoiceClient::sipURIFromID(const LLUUID &id) const
@@ -920,10 +1033,12 @@ class LLViewerRequiredVoiceVersion : public LLHTTPNode
{
voiceModule = (LLVoiceModuleInterface *) LLVivoxVoiceClient::getInstance();
}
+#ifndef DISABLE_WEBRTC
else if (voice_server_type == "webrtc")
{
voiceModule = (LLVoiceModuleInterface *) LLWebRTCVoiceClient::getInstance();
}
+#endif
else
{
LL_WARNS("Voice") << "Unknown voice server type " << voice_server_type << LL_ENDL;