diff options
-rw-r--r-- | fs/exec.c | 2 | ||||
-rw-r--r-- | fs/namespace.c | 2 | ||||
-rw-r--r-- | include/linux/binfmts.h | 1 | ||||
-rw-r--r-- | scripts/selinux/genheaders/genheaders.c | 29 |
4 files changed, 11 insertions, 23 deletions
diff --git a/fs/exec.c b/fs/exec.c index fc281b738a98..b6c9e5f9f330 100644 --- a/fs/exec.c +++ b/fs/exec.c @@ -1399,7 +1399,7 @@ EXPORT_SYMBOL(finalize_exec); * Or, if exec fails before, free_bprm() should release ->cred and * and unlock. */ -int prepare_bprm_creds(struct linux_binprm *bprm) +static int prepare_bprm_creds(struct linux_binprm *bprm) { if (mutex_lock_interruptible(¤t->signal->cred_guard_mutex)) return -ERESTARTNOINTR; diff --git a/fs/namespace.c b/fs/namespace.c index 98d27da43304..9cd4fcc0de94 100644 --- a/fs/namespace.c +++ b/fs/namespace.c @@ -1360,7 +1360,7 @@ static void namespace_unlock(void) if (likely(hlist_empty(&head))) return; - synchronize_rcu(); + synchronize_rcu_expedited(); group_pin_kill(&head); } diff --git a/include/linux/binfmts.h b/include/linux/binfmts.h index e9f5fe69df31..6a9e43d98c3d 100644 --- a/include/linux/binfmts.h +++ b/include/linux/binfmts.h @@ -138,7 +138,6 @@ extern int transfer_args_to_stack(struct linux_binprm *bprm, extern int bprm_change_interp(const char *interp, struct linux_binprm *bprm); extern int copy_strings_kernel(int argc, const char *const *argv, struct linux_binprm *bprm); -extern int prepare_bprm_creds(struct linux_binprm *bprm); extern void install_exec_creds(struct linux_binprm *bprm); extern void set_binfmt(struct linux_binfmt *new); extern ssize_t read_code(struct file *, unsigned long, loff_t, size_t); diff --git a/scripts/selinux/genheaders/genheaders.c b/scripts/selinux/genheaders/genheaders.c index fa48fabcb330..1ceedea847dd 100644 --- a/scripts/selinux/genheaders/genheaders.c +++ b/scripts/selinux/genheaders/genheaders.c @@ -19,8 +19,6 @@ struct security_class_mapping { #include "classmap.h" #include "initial_sid_to_string.h" -#define max(x, y) (((int)(x) > (int)(y)) ? x : y) - const char *progname; static void usage(void) @@ -46,11 +44,9 @@ static char *stoupperx(const char *s) int main(int argc, char *argv[]) { - int i, j, k; + int i, j; int isids_len; FILE *fout; - const char *needle = "SOCKET"; - char *substr; progname = argv[0]; @@ -80,20 +76,14 @@ int main(int argc, char *argv[]) for (i = 0; secclass_map[i].name; i++) { struct security_class_mapping *map = &secclass_map[i]; - fprintf(fout, "#define SECCLASS_%s", map->name); - for (j = 0; j < max(1, 40 - strlen(map->name)); j++) - fprintf(fout, " "); - fprintf(fout, "%2d\n", i+1); + fprintf(fout, "#define SECCLASS_%-39s %2d\n", map->name, i+1); } fprintf(fout, "\n"); for (i = 1; i < isids_len; i++) { const char *s = initial_sid_to_string[i]; - fprintf(fout, "#define SECINITSID_%s", s); - for (j = 0; j < max(1, 40 - strlen(s)); j++) - fprintf(fout, " "); - fprintf(fout, "%2d\n", i); + fprintf(fout, "#define SECINITSID_%-39s %2d\n", s, i); } fprintf(fout, "\n#define SECINITSID_NUM %d\n", i-1); fprintf(fout, "\nstatic inline bool security_is_socket_class(u16 kern_tclass)\n"); @@ -101,9 +91,10 @@ int main(int argc, char *argv[]) fprintf(fout, "\tbool sock = false;\n\n"); fprintf(fout, "\tswitch (kern_tclass) {\n"); for (i = 0; secclass_map[i].name; i++) { + static char s[] = "SOCKET"; struct security_class_mapping *map = &secclass_map[i]; - substr = strstr(map->name, needle); - if (substr && strcmp(substr, needle) == 0) + int len = strlen(map->name), l = sizeof(s) - 1; + if (len >= l && memcmp(map->name + len - l, s, l) == 0) fprintf(fout, "\tcase SECCLASS_%s:\n", map->name); } fprintf(fout, "\t\tsock = true;\n"); @@ -129,17 +120,15 @@ int main(int argc, char *argv[]) for (i = 0; secclass_map[i].name; i++) { struct security_class_mapping *map = &secclass_map[i]; + int len = strlen(map->name); for (j = 0; map->perms[j]; j++) { if (j >= 32) { fprintf(stderr, "Too many permissions to fit into an access vector at (%s, %s).\n", map->name, map->perms[j]); exit(5); } - fprintf(fout, "#define %s__%s", map->name, - map->perms[j]); - for (k = 0; k < max(1, 40 - strlen(map->name) - strlen(map->perms[j])); k++) - fprintf(fout, " "); - fprintf(fout, "0x%08xU\n", (1<<j)); + fprintf(fout, "#define %s__%-*s 0x%08xU\n", map->name, + 39-len, map->perms[j], 1U<<j); } } |