|
@@ -151,6 +151,8 @@ static int sysctl_ipc_data(ctl_table *table, int __user *name, int nlen,
|
|
#ifdef CONFIG_PROC_SYSCTL
|
|
#ifdef CONFIG_PROC_SYSCTL
|
|
static int proc_do_cad_pid(ctl_table *table, int write, struct file *filp,
|
|
static int proc_do_cad_pid(ctl_table *table, int write, struct file *filp,
|
|
void __user *buffer, size_t *lenp, loff_t *ppos);
|
|
void __user *buffer, size_t *lenp, loff_t *ppos);
|
|
|
|
+static int proc_dointvec_taint(ctl_table *table, int write, struct file *filp,
|
|
|
|
+ void __user *buffer, size_t *lenp, loff_t *ppos);
|
|
#endif
|
|
#endif
|
|
|
|
|
|
static ctl_table root_table[];
|
|
static ctl_table root_table[];
|
|
@@ -174,6 +176,7 @@ extern ctl_table inotify_table[];
|
|
int sysctl_legacy_va_layout;
|
|
int sysctl_legacy_va_layout;
|
|
#endif
|
|
#endif
|
|
|
|
|
|
|
|
+
|
|
static void *get_uts(ctl_table *table, int write)
|
|
static void *get_uts(ctl_table *table, int write)
|
|
{
|
|
{
|
|
char *which = table->data;
|
|
char *which = table->data;
|
|
@@ -344,14 +347,16 @@ static ctl_table kern_table[] = {
|
|
.proc_handler = &proc_dostring,
|
|
.proc_handler = &proc_dostring,
|
|
.strategy = &sysctl_string,
|
|
.strategy = &sysctl_string,
|
|
},
|
|
},
|
|
|
|
+#ifdef CONFIG_PROC_SYSCTL
|
|
{
|
|
{
|
|
.ctl_name = KERN_TAINTED,
|
|
.ctl_name = KERN_TAINTED,
|
|
.procname = "tainted",
|
|
.procname = "tainted",
|
|
.data = &tainted,
|
|
.data = &tainted,
|
|
.maxlen = sizeof(int),
|
|
.maxlen = sizeof(int),
|
|
- .mode = 0444,
|
|
|
|
- .proc_handler = &proc_dointvec,
|
|
|
|
|
|
+ .mode = 0644,
|
|
|
|
+ .proc_handler = &proc_dointvec_taint,
|
|
},
|
|
},
|
|
|
|
+#endif
|
|
{
|
|
{
|
|
.ctl_name = KERN_CAP_BSET,
|
|
.ctl_name = KERN_CAP_BSET,
|
|
.procname = "cap-bound",
|
|
.procname = "cap-bound",
|
|
@@ -1927,6 +1932,7 @@ int proc_dointvec(ctl_table *table, int write, struct file *filp,
|
|
|
|
|
|
#define OP_SET 0
|
|
#define OP_SET 0
|
|
#define OP_AND 1
|
|
#define OP_AND 1
|
|
|
|
+#define OP_OR 2
|
|
|
|
|
|
static int do_proc_dointvec_bset_conv(int *negp, unsigned long *lvalp,
|
|
static int do_proc_dointvec_bset_conv(int *negp, unsigned long *lvalp,
|
|
int *valp,
|
|
int *valp,
|
|
@@ -1938,6 +1944,7 @@ static int do_proc_dointvec_bset_conv(int *negp, unsigned long *lvalp,
|
|
switch(op) {
|
|
switch(op) {
|
|
case OP_SET: *valp = val; break;
|
|
case OP_SET: *valp = val; break;
|
|
case OP_AND: *valp &= val; break;
|
|
case OP_AND: *valp &= val; break;
|
|
|
|
+ case OP_OR: *valp |= val; break;
|
|
}
|
|
}
|
|
} else {
|
|
} else {
|
|
int val = *valp;
|
|
int val = *valp;
|
|
@@ -1970,6 +1977,22 @@ int proc_dointvec_bset(ctl_table *table, int write, struct file *filp,
|
|
do_proc_dointvec_bset_conv,&op);
|
|
do_proc_dointvec_bset_conv,&op);
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+/*
|
|
|
|
+ * Taint values can only be increased
|
|
|
|
+ */
|
|
|
|
+static int proc_dointvec_taint(ctl_table *table, int write, struct file *filp,
|
|
|
|
+ void __user *buffer, size_t *lenp, loff_t *ppos)
|
|
|
|
+{
|
|
|
|
+ int op;
|
|
|
|
+
|
|
|
|
+ if (!capable(CAP_SYS_ADMIN))
|
|
|
|
+ return -EPERM;
|
|
|
|
+
|
|
|
|
+ op = OP_OR;
|
|
|
|
+ return do_proc_dointvec(table,write,filp,buffer,lenp,ppos,
|
|
|
|
+ do_proc_dointvec_bset_conv,&op);
|
|
|
|
+}
|
|
|
|
+
|
|
struct do_proc_dointvec_minmax_conv_param {
|
|
struct do_proc_dointvec_minmax_conv_param {
|
|
int *min;
|
|
int *min;
|
|
int *max;
|
|
int *max;
|