mirror of
https://github.com/openharmony/kernel_linux_common_modules.git
synced 2026-08-27 01:31:36 -04:00
0afc82cd6f
--------------------------------------- DEC(Dynamic Enhance Control) is a dynamic file access enhancement mechanism. It resolves DAC interception and sharefs security risks, precisely controlling file access via a kernel permission database, ioctl interfaces and LSM framework. DEC will bind the token ID of the application and the paths it can access. The user-level sandboxmanager module and appspawn module will configure the relevant policies. When the application accesses the control paths under the sharefs file system, DEC checks the: create, read, write, remove, rename, move, access of files by the application. Signed-off-by: staralien <chengxin@servicecenter-harmonytsc.com>
38 lines
791 B
C
38 lines
791 B
C
// SPDX-License-Identifier: GPL-2.0-or-later
|
|
/*
|
|
* Copyright (c) 2026 Huawei Device Co., Ltd.
|
|
*/
|
|
|
|
#include <linux/sysctl.h>
|
|
|
|
#include "sysctl.h"
|
|
#include "dec_log.h"
|
|
|
|
int dec_mode = 1;
|
|
#define dec_console_loglevel dec_mode
|
|
|
|
static int dec_proc_dointvec(struct ctl_table *table, int write,
|
|
void __user *buffer, size_t *lenp, loff_t *ppos)
|
|
{
|
|
dec_logi("dec_mode changed to %d", dec_console_loglevel);
|
|
return proc_dointvec(table, write, buffer, lenp, ppos);
|
|
}
|
|
|
|
static struct ctl_table dec_sysctls[] = {
|
|
{
|
|
.procname = "dec_mode",
|
|
.data = &dec_console_loglevel,
|
|
.maxlen = sizeof(int),
|
|
.mode = 0644,
|
|
.proc_handler = dec_proc_dointvec,
|
|
},
|
|
{}
|
|
};
|
|
|
|
void __init dec_sysctl_init(void)
|
|
{
|
|
#ifdef CONFIG_SECURITY_DEC_DEVELOP
|
|
register_sysctl_init("kernel", dec_sysctls);
|
|
#endif
|
|
}
|