Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 94e63e1a authored by Steven Moreland's avatar Steven Moreland
Browse files

libbinder: restrict non-Android kernel binder use

Bringing this up in new environments, we need to make sure
they use different headers, so we never copy transactions
from one environment or another by accident.

Bug: 313702213
Test: build
Change-Id: I0cae4a149267862092030c00d239e93155f70143
parent aa627355
Loading
Loading
Loading
Loading
+11 −0
Original line number Diff line number Diff line
@@ -845,6 +845,9 @@ void Parcel::updateWorkSourceRequestHeaderPosition() const {
}

#ifdef BINDER_WITH_KERNEL_IPC

#if defined(__ANDROID__)

#if defined(__ANDROID_VNDK__)
constexpr int32_t kHeader = B_PACK_CHARS('V', 'N', 'D', 'R');
#elif defined(__ANDROID_RECOVERY__)
@@ -852,6 +855,14 @@ constexpr int32_t kHeader = B_PACK_CHARS('R', 'E', 'C', 'O');
#else
constexpr int32_t kHeader = B_PACK_CHARS('S', 'Y', 'S', 'T');
#endif

#else // ANDROID not defined

// If kernel binder is used in new environments, we need to make sure it's separated
// out and has a separate header.
constexpr int32_t kHeader = B_PACK_CHARS('U', 'N', 'K', 'N');
#endif

#endif // BINDER_WITH_KERNEL_IPC

// Write RPC headers.  (previously just the interface token)