Revert "ANDROID: Revert "module: Do not expose section addresses to non-CAP_SYSLOG""

This reverts commit d837f090a6  as the
ramdump tooling is now fixed.

Bug: 163100336
Cc: Saravana Kannan <saravanak@google.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
Change-Id: I4d0917beb848563270343515c49e0d6ad055c917
This commit is contained in:
Greg Kroah-Hartman 2020-09-03 14:22:21 +02:00
commit 44c13f4537

View file

@ -1526,8 +1526,8 @@ static ssize_t module_sect_read(struct file *file, struct kobject *kobj,
if (pos != 0)
return -EINVAL;
return sprintf(buf, "0x%px\n", kptr_restrict < 2 ?
(void *)sattr->address : NULL);
return sprintf(buf, "0x%px\n",
kallsyms_show_value(file->f_cred) ? (void *)sattr->address : NULL);
}
static void free_sect_attrs(struct module_sect_attrs *sect_attrs)
@ -4420,7 +4420,7 @@ static int modules_open(struct inode *inode, struct file *file)
if (!err) {
struct seq_file *m = file->private_data;
m->private = kallsyms_show_value(current_cred()) ? NULL : (void *)8ul;
m->private = kallsyms_show_value(file->f_cred) ? NULL : (void *)8ul;
}
return err;