|
@@ -856,9 +856,14 @@ err:
|
|
|
|
|
|
|
|
static int load_flat_shared_library(int id, struct lib_info *libs)
|
|
static int load_flat_shared_library(int id, struct lib_info *libs)
|
|
|
{
|
|
{
|
|
|
|
|
+ /*
|
|
|
|
|
+ * This is a fake bprm struct; only the members "buf", "file" and
|
|
|
|
|
+ * "filename" are actually used.
|
|
|
|
|
+ */
|
|
|
struct linux_binprm bprm;
|
|
struct linux_binprm bprm;
|
|
|
int res;
|
|
int res;
|
|
|
char buf[16];
|
|
char buf[16];
|
|
|
|
|
+ loff_t pos = 0;
|
|
|
|
|
|
|
|
memset(&bprm, 0, sizeof(bprm));
|
|
memset(&bprm, 0, sizeof(bprm));
|
|
|
|
|
|
|
@@ -872,25 +877,11 @@ static int load_flat_shared_library(int id, struct lib_info *libs)
|
|
|
if (IS_ERR(bprm.file))
|
|
if (IS_ERR(bprm.file))
|
|
|
return res;
|
|
return res;
|
|
|
|
|
|
|
|
- bprm.cred = prepare_exec_creds();
|
|
|
|
|
- res = -ENOMEM;
|
|
|
|
|
- if (!bprm.cred)
|
|
|
|
|
- goto out;
|
|
|
|
|
-
|
|
|
|
|
- /* We don't really care about recalculating credentials at this point
|
|
|
|
|
- * as we're past the point of no return and are dealing with shared
|
|
|
|
|
- * libraries.
|
|
|
|
|
- */
|
|
|
|
|
- bprm.called_set_creds = 1;
|
|
|
|
|
|
|
+ res = kernel_read(bprm.file, bprm.buf, BINPRM_BUF_SIZE, &pos);
|
|
|
|
|
|
|
|
- res = prepare_binprm(&bprm);
|
|
|
|
|
-
|
|
|
|
|
- if (!res)
|
|
|
|
|
|
|
+ if (res >= 0)
|
|
|
res = load_flat_file(&bprm, libs, id, NULL);
|
|
res = load_flat_file(&bprm, libs, id, NULL);
|
|
|
|
|
|
|
|
- abort_creds(bprm.cred);
|
|
|
|
|
-
|
|
|
|
|
-out:
|
|
|
|
|
allow_write_access(bprm.file);
|
|
allow_write_access(bprm.file);
|
|
|
fput(bprm.file);
|
|
fput(bprm.file);
|
|
|
|
|
|