Exploit databaseDownload repository ZIP
GH-87d78a8273b7c916c0f9f9ca25ca743e
trinadh465/frameworks_base_aosp10_r33_cve-2022-20007
Sources for CVE-2022-20007
2 sourcesPreferred order: Exploit-DB, Metasploit, then GitHub repositories by stars. Open preferred source
Repository files39
trinadh465/frameworks_base_aosp10_r33_cve-2022-20007Revision d046b4eb34eb
- ↑..Parent directory
- BroadcastRadio/
- Android.bp
- com_android_server_AlarmManagerService.cpp
- com_android_server_ConsumerIrService.cpp
- com_android_server_GraphicsStatsService.cpp
- com_android_server_HardwarePropertiesManagerService.cpp
- com_android_server_PersistentDataBlockService.cpp
- com_android_server_SerialService.cpp
- com_android_server_SystemServer.cpp
- com_android_server_TestNetworkService.cpp
- com_android_server_UsbAlsaJackDetector.cpp
- com_android_server_UsbDescriptorParser.cpp
- com_android_server_UsbDeviceManager.cpp
- com_android_server_UsbHostManager.cpp
- com_android_server_UsbMidiDevice.cpp
- com_android_server_VibratorService.cpp
- com_android_server_am_AppCompactor.cpp
- com_android_server_am_BatteryStatsService.cpp
- com_android_server_am_LowMemDetector.cpp
- com_android_server_connectivity_Vpn.cpp
- com_android_server_connectivity_tethering_OffloadHardwareInterface.cpp
- com_android_server_devicepolicy_CryptoTestHelper.cpp
- com_android_server_fingerprint_FingerprintService.cpp
- com_android_server_hdmi_HdmiCecController.cpp
- com_android_server_input_InputManagerService.cpp
- com_android_server_lights_LightsService.cpp
- com_android_server_location_GnssLocationProvider.cpp
- com_android_server_locksettings_SyntheticPasswordManager.cpp
- com_android_server_net_NetworkStatsFactory.cpp
- com_android_server_net_NetworkStatsService.cpp
- com_android_server_power_PowerManagerService.cpp
- com_android_server_power_PowerManagerService.h
- com_android_server_security_VerityUtils.cpp
- com_android_server_storage_AppFuseBridge.cpp
- com_android_server_tv_TvInputHal.cpp
- com_android_server_tv_TvKeys.h
- com_android_server_tv_TvUinputBridge.cpp
- com_android_server_vr_VrManagerService.cpp
- onload.cpp
Files from this repository share one source choice. Supporting files may cover other vulnerabilities.
services/core/jni/com_android_server_am_AppCompactor.cpp
C++ · 2,994 bytes/*
* Copyright (C) 2019 The Android Open Source Project
*
* Licensed 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.
*/
#define LOG_TAG "AppCompactor"
//#define LOG_NDEBUG 0
#include <dirent.h>
#include <stddef.h>
#include <stdio.h>
#include <sys/stat.h>
#include <sys/types.h>
#include <unistd.h>
#include <android-base/stringprintf.h>
#include <android-base/file.h>
#include <nativehelper/JNIHelp.h>
#include <android_runtime/AndroidRuntime.h>
#include <jni.h>
using android::base::StringPrintf;
using android::base::WriteStringToFile;
namespace android {
// This performs per-process reclaim on all processes belonging to non-app UIDs.
// For the most part, these are non-zygote processes like Treble HALs, but it
// also includes zygote-derived processes that run in system UIDs, like bluetooth
// or potentially some mainline modules. The only process that should definitely
// not be compacted is system_server, since compacting system_server around the
// time of BOOT_COMPLETE could result in perceptible issues.
static void com_android_server_am_AppCompactor_compactSystem(JNIEnv *, jobject) {
std::unique_ptr<DIR, decltype(&closedir)> proc(opendir("/proc"), closedir);
struct dirent* current;
while ((current = readdir(proc.get()))) {
if (current->d_type != DT_DIR) {
continue;
}
// don't compact system_server, rely on persistent compaction during screen off
// in order to avoid mmap_sem-related stalls
if (atoi(current->d_name) == getpid()) {
continue;
}
std::string status_name = StringPrintf("/proc/%s/status", current->d_name);
struct stat status_info;
if (stat(status_name.c_str(), &status_info) != 0) {
// must be some other directory that isn't a pid
continue;
}
// android.os.Process.FIRST_APPLICATION_UID
if (status_info.st_uid >= 10000) {
continue;
}
std::string reclaim_path = StringPrintf("/proc/%s/reclaim", current->d_name);
WriteStringToFile(std::string("all"), reclaim_path);
}
}
static const JNINativeMethod sMethods[] = {
/* name, signature, funcPtr */
{"compactSystem", "()V", (void*)com_android_server_am_AppCompactor_compactSystem},
};
int register_android_server_am_AppCompactor(JNIEnv* env)
{
return jniRegisterNativeMethods(env, "com/android/server/am/AppCompactor",
sMethods, NELEM(sMethods));
}
}