fs/coredump.c: log if a core dump is aborted due to changed file permissions
[linux-2.6-microblaze.git] / fs / coredump.c
index c3d8fc1..4b3c757 100644 (file)
@@ -755,8 +755,8 @@ void do_coredump(const kernel_siginfo_t *siginfo)
                        task_lock(&init_task);
                        get_fs_root(init_task.fs, &root);
                        task_unlock(&init_task);
-                       cprm.file = file_open_root(root.dentry, root.mnt,
-                               cn.corename, open_flags, 0600);
+                       cprm.file = file_open_root(&root, cn.corename,
+                                                  open_flags, 0600);
                        path_put(&root);
                } else {
                        cprm.file = filp_open(cn.corename, open_flags, 0600);
@@ -782,10 +782,17 @@ void do_coredump(const kernel_siginfo_t *siginfo)
                 * filesystem.
                 */
                mnt_userns = file_mnt_user_ns(cprm.file);
-               if (!uid_eq(i_uid_into_mnt(mnt_userns, inode), current_fsuid()))
+               if (!uid_eq(i_uid_into_mnt(mnt_userns, inode),
+                           current_fsuid())) {
+                       pr_info_ratelimited("Core dump to %s aborted: cannot preserve file owner\n",
+                                           cn.corename);
                        goto close_fail;
-               if ((inode->i_mode & 0677) != 0600)
+               }
+               if ((inode->i_mode & 0677) != 0600) {
+                       pr_info_ratelimited("Core dump to %s aborted: cannot preserve file permissions\n",
+                                           cn.corename);
                        goto close_fail;
+               }
                if (!(cprm.file->f_mode & FMODE_CAN_WRITE))
                        goto close_fail;
                if (do_truncate(mnt_userns, cprm.file->f_path.dentry,