head 1.3; access; symbols pkgsrc-2020Q1:1.2.0.8 pkgsrc-2020Q1-base:1.2 pkgsrc-2019Q4:1.2.0.10 pkgsrc-2019Q4-base:1.2 pkgsrc-2019Q3:1.2.0.6 pkgsrc-2019Q3-base:1.2 pkgsrc-2019Q2:1.2.0.4 pkgsrc-2019Q2-base:1.2 pkgsrc-2019Q1:1.2.0.2 pkgsrc-2019Q1-base:1.2 pkgsrc-2018Q4:1.1.0.6 pkgsrc-2018Q4-base:1.1 pkgsrc-2018Q3:1.1.0.4 pkgsrc-2018Q3-base:1.1 pkgsrc-2018Q2:1.1.0.2 pkgsrc-2018Q2-base:1.1; locks; strict; comment @// @; 1.3 date 2020.06.07.10.34.43; author nia; state dead; branches; next 1.2; commitid aCtCVv72vCKuqhbC; 1.2 date 2019.02.26.11.23.53; author ryoon; state Exp; branches; next 1.1; commitid BMTleQsTSXM2IgdB; 1.1 date 2018.06.28.14.04.10; author ryoon; state Exp; branches; next ; commitid FLpZD0GqQ3Vkp3IA; desc @@ 1.3 log @www: Remove firefox60 - EOL @ text @$NetBSD: patch-ipc_glue_CrossProcessSemaphore__posix.cpp,v 1.2 2019/02/26 11:23:53 ryoon Exp $ --- ipc/glue/CrossProcessSemaphore_posix.cpp.orig 2019-02-13 14:19:38.000000000 +0000 +++ ipc/glue/CrossProcessSemaphore_posix.cpp @@@@ -9,6 +9,11 @@@@ #include "nsDebug.h" #include "nsISupportsImpl.h" #include +#if defined(__NetBSD__) +#include +#include +#include +#endif static const uint64_t kNsPerMs = 1000000; static const uint64_t kNsPerSec = 1000000000; @@@@ -16,7 +21,13 @@@@ static const uint64_t kNsPerSec = 100000 namespace { struct SemaphoreData { +#if defined(__NetBSD__) + pthread_mutex_t mMutex; + pthread_cond_t mNotZero; + uint32_t mValue; +#else sem_t mSemaphore; +#endif mozilla::Atomic mRefCount; uint32_t mInitialValue; }; @@@@ -42,13 +53,27 @@@@ namespace mozilla { return nullptr; } +#if defined(__NetBSD__) + data->mValue = aInitialValue; + if (pthread_mutex_init(&data->mMutex, NULL) || + pthread_cond_init(&data->mNotZero, NULL) ) { + return nullptr; + } +#else if (sem_init(&data->mSemaphore, 1, aInitialValue)) { return nullptr; } +#endif CrossProcessSemaphore* sem = new CrossProcessSemaphore; sem->mSharedBuffer = sharedBuffer; +#if defined(__NetBSD__) + sem->mMutex = &data->mMutex; + sem->mNotZero = &data->mNotZero; + sem->mValue = &data->mValue; +#else sem->mSemaphore = &data->mSemaphore; +#endif sem->mRefCount = &data->mRefCount; *sem->mRefCount = 1; @@@@ -83,23 +108,44 @@@@ namespace mozilla { int32_t oldCount = data->mRefCount++; if (oldCount == 0) { +#if defined(__NetBSD__) + if (pthread_mutex_init(&data->mMutex, NULL) || + pthread_cond_init(&data->mNotZero, NULL) ) { + data->mRefCount--; + return nullptr; + } +#else // The other side has already let go of their CrossProcessSemaphore, so now // mSemaphore is garbage. We need to re-initialize it. if (sem_init(&data->mSemaphore, 1, data->mInitialValue)) { data->mRefCount--; return nullptr; } +#endif } CrossProcessSemaphore* sem = new CrossProcessSemaphore; sem->mSharedBuffer = sharedBuffer; +#if defined(__NetBSD__) + sem->mMutex = &data->mMutex; + sem->mNotZero = &data->mNotZero; + sem->mValue = &data->mValue; +#else sem->mSemaphore = &data->mSemaphore; +#endif sem->mRefCount = &data->mRefCount; return sem; } CrossProcessSemaphore::CrossProcessSemaphore() - : mSemaphore(nullptr), mRefCount(nullptr) { +#if defined(__NetBSD__) + : mMutex (nullptr) + , mNotZero (nullptr) + , mValue (nullptr) +#else + : mSemaphore(nullptr) +#endif + , mRefCount(nullptr) { MOZ_COUNT_CTOR(CrossProcessSemaphore); } @@@@ -108,16 +154,57 @@@@ CrossProcessSemaphore::~CrossProcessSema if (oldCount == 0) { // Nothing can be done if the destroy fails so ignore return code. +#if defined(__NetBSD__) + (void)pthread_cond_destroy(mNotZero); + (void)pthread_mutex_destroy(mMutex); +#else Unused << sem_destroy(mSemaphore); +#endif } MOZ_COUNT_DTOR(CrossProcessSemaphore); } +#if defined(__NetBSD__) +static struct timespec +makeAbsTime(const Maybe& aWaitTime) { + struct timespec ts; + if (aWaitTime.isSome()) { + clock_gettime(CLOCK_REALTIME, &ts); + ts.tv_nsec += (kNsPerMs * aWaitTime->ToMilliseconds()); + ts.tv_sec += ts.tv_nsec / kNsPerSec; + ts.tv_nsec %= kNsPerSec; + } + else { + ts.tv_sec = std::numeric_limits::max(); + ts.tv_nsec = 0; + } + return ts; +} +#endif + bool CrossProcessSemaphore::Wait(const Maybe& aWaitTime) { MOZ_ASSERT(*mRefCount > 0, "Attempting to wait on a semaphore with zero ref count"); int ret; +#if defined(__NetBSD__) + struct timespec ts = makeAbsTime(aWaitTime); + + ret = pthread_mutex_lock(mMutex); + + if (ret == 0) { + while (ret == 0 && mValue == 0) { + ret = pthread_cond_timedwait(mNotZero, mMutex, &ts); + while (ret == -1 && errno == EINTR) { + ret = pthread_cond_timedwait(mNotZero, mMutex, &ts); + } + } + if (ret == 0) { + --(*mValue); + } + pthread_mutex_unlock(mMutex); + } +#else if (aWaitTime.isSome()) { struct timespec ts; if (clock_gettime(CLOCK_REALTIME, &ts) == -1) { @@@@ -134,13 +221,24 @@@@ bool CrossProcessSemaphore::Wait(const M while ((ret = sem_wait(mSemaphore)) == -1 && errno == EINTR) { } } +#endif return ret == 0; } void CrossProcessSemaphore::Signal() { MOZ_ASSERT(*mRefCount > 0, "Attempting to signal a semaphore with zero ref count"); +#if defined(__NetBSD__) + int ret; + ret = pthread_mutex_lock(mMutex); + if (ret == 0) { + ++(*mValue); + pthread_cond_signal(mNotZero); + pthread_mutex_unlock(mMutex); + } +#else sem_post(mSemaphore); +#endif } CrossProcessSemaphoreHandle CrossProcessSemaphore::ShareToProcess( @ 1.2 log @Update to 60.5.2 Changelog: 60.5.2 Fixed a frequent crash when reading various Reuters news articles (bug 1505844) 60.5.1 #CVE-2018-18356: Use-after-free in Skia #CVE-2019-5785: Integer overflow in Skia #CVE-2018-18335: Buffer overflow in Skia with accelerated Canvas 2D 60.5.0 #CVE-2018-18500: Use-after-free parsing HTML5 stream #CVE-2018-18505: Privilege escalation through IPC channel messages #CVE-2018-18501: Memory safety bugs fixed in Firefox 65 and Firefox ESR 60.5 @ text @d1 1 a1 1 $NetBSD: patch-ipc_glue_CrossProcessSemaphore__posix.cpp,v 1.1 2018/12/16 08:12:15 ryoon Exp $ @ 1.1 log @www/firefox60: import firefox60-60.1.0 Mozilla Firefox is a free, open-source and cross-platform web browser for Windows, Linux, MacOS X and many other operating systems. It is fast and easy to use, and offers many advantages over other web browsers, such as tabbed browsing and the ability to block pop-up windows. Firefox also offers excellent bookmark and history management, and it can be extended by developers using industry standards such as XML, CSS, JavaScript, C++, etc. Many extensions are available. This package provides Firefox 60 ESR. Securty fixes: #CVE-2018-12359: Buffer overflow using computed size of canvas element #CVE-2018-12360: Use-after-free when using focus() #CVE-2018-12361: Integer overflow in SwizzleData #CVE-2018-12362: Integer overflow in SSSE3 scaler #CVE-2018-5156: Media recorder segmentation fault when track type is changed during capture #CVE-2018-12363: Use-after-free when appending DOM nodes #CVE-2018-12364: CSRF attacks through 307 redirects and NPAPI plugins #CVE-2018-12365: Compromised IPC child process can list local filenames #CVE-2018-12371: Integer overflow in Skia library during edge builder allocation #CVE-2018-12366: Invalid data handling during QCMS transformations #CVE-2018-12367: Timing attack mitigation of PerformanceNavigationTiming #CVE-2018-12368: No warning when opening executable SettingContent-ms files #CVE-2018-12369: WebExtension security permission checks bypassed by embedded experiments #CVE-2018-5187: Memory safety bugs fixed in Firefox 60 and Firefox ESR 60.1 #CVE-2018-5188: Memory safety bugs fixed in Firefox 60, Firefox ESR 60.1, and Firefox ESR 52.9 @ text @d1 1 a1 1 $NetBSD: patch-ipc_glue_CrossProcessSemaphore__posix.cpp,v 1.3 2017/09/30 05:34:12 ryoon Exp $ d3 1 a3 4 - avoid use of sem_t on NetBSD http://mail-index.netbsd.org/pkgsrc-bugs/2017/06/23/msg062225.html --- ipc/glue/CrossProcessSemaphore_posix.cpp.orig 2017-09-14 20:16:01.000000000 +0000 d17 2 a18 2 @@@@ -17,7 +22,13 @@@@ namespace { d31 1 a31 1 @@@@ -44,13 +55,27 @@@@ CrossProcessSemaphore::Create(const char d59 1 a59 1 @@@@ -84,24 +109,44 @@@@ CrossProcessSemaphore::Create(CrossProce a91 1 d93 1 d95 3 a97 3 + : mMutex (nullptr) + , mNotZero (nullptr) + , mValue (nullptr) d99 1 a99 1 : mSemaphore(nullptr) d101 1 a101 2 , mRefCount(nullptr) { d103 3 a105 1 @@@@ -113,17 +158,58 @@@@ CrossProcessSemaphore::~CrossProcessSema d138 3 a140 4 bool CrossProcessSemaphore::Wait(const Maybe& aWaitTime) { MOZ_ASSERT(*mRefCount > 0, "Attempting to wait on a semaphore with zero ref count"); d163 1 a163 1 @@@@ -140,6 +226,7 @@@@ CrossProcessSemaphore::Wait(const Maybe< d171 3 a173 4 @@@@ -147,7 +234,17 @@@@ void CrossProcessSemaphore::Signal() { MOZ_ASSERT(*mRefCount > 0, "Attempting to signal a semaphore with zero ref count"); d187 1 a187 1 CrossProcessSemaphoreHandle @