mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH[ fix duplicate console-efi entries in pstore
@ 2014-10-13  3:09 Valdis Kletnieks
  2014-10-14 15:41 ` Kees Cook
  0 siblings, 1 reply; 2+ messages in thread
From: Valdis Kletnieks @ 2014-10-13  3:09 UTC (permalink / raw)
  To: Anton Vorontsov, Colin Cross, Kees Cook, Tony Luck; +Cc: linux-kernel

The pstore filesystem still creates duplicate filename/inode pairs for
some pstore types.  Add the id to the filename to prevent that.

Before patch:

[/sys/fs/pstore] ls -li
total 0
1250 -r--r--r--. 1 root root 67 Sep 29 17:09 console-efi
1250 -r--r--r--. 1 root root 67 Sep 29 17:09 console-efi
1250 -r--r--r--. 1 root root 67 Sep 29 17:09 console-efi
1250 -r--r--r--. 1 root root 67 Sep 29 17:09 console-efi
1250 -r--r--r--. 1 root root 67 Sep 29 17:09 console-efi
1250 -r--r--r--. 1 root root 67 Sep 29 17:09 console-efi
1250 -r--r--r--. 1 root root 67 Sep 29 17:09 console-efi
1250 -r--r--r--. 1 root root 67 Sep 29 17:09 console-efi
1250 -r--r--r--. 1 root root 67 Sep 29 17:09 console-efi


After:

[/sys/fs/pstore] ls -li
total 0
1232 -r--r--r--. 1 root root 148 Sep 29 17:09 console-efi-141202499100000
1231 -r--r--r--. 1 root root  67 Sep 29 17:09 console-efi-141202499200000
1230 -r--r--r--. 1 root root 148 Sep 29 17:44 console-efi-141202705400000
1229 -r--r--r--. 1 root root  67 Sep 29 17:44 console-efi-141202705500000
1228 -r--r--r--. 1 root root  67 Sep 29 20:42 console-efi-141203772600000
1227 -r--r--r--. 1 root root 148 Sep 29 23:42 console-efi-141204854900000
1226 -r--r--r--. 1 root root  67 Sep 29 23:42 console-efi-141204855000000
1225 -r--r--r--. 1 root root 148 Sep 29 23:59 console-efi-141204954200000
1224 -r--r--r--. 1 root root  67 Sep 29 23:59 console-efi-141204954400000

Signed-off-by: Valdis Kletnieks <valdis.kletnieks@vt.edu>

--- linux-next/fs/pstore/inode.c.orig	2014-10-03 23:58:00.440386528 -0400
+++ linux-next/fs/pstore/inode.c	2014-10-09 17:50:50.613829841 -0400
@@ -320,10 +320,10 @@ int pstore_mkfile(enum pstore_type_id ty
 						compressed ? ".enc.z" : "");
 		break;
 	case PSTORE_TYPE_CONSOLE:
-		sprintf(name, "console-%s", psname);
+		sprintf(name, "console-%s-%lld", psname, id);
 		break;
 	case PSTORE_TYPE_FTRACE:
-		sprintf(name, "ftrace-%s", psname);
+		sprintf(name, "ftrace-%s-%lld", psname, id);
 		break;
 	case PSTORE_TYPE_MCE:
 		sprintf(name, "mce-%s-%lld", psname, id);


^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [PATCH[ fix duplicate console-efi entries in pstore
  2014-10-13  3:09 [PATCH[ fix duplicate console-efi entries in pstore Valdis Kletnieks
@ 2014-10-14 15:41 ` Kees Cook
  0 siblings, 0 replies; 2+ messages in thread
From: Kees Cook @ 2014-10-14 15:41 UTC (permalink / raw)
  To: Valdis Kletnieks; +Cc: Anton Vorontsov, Colin Cross, Tony Luck, LKML

On Sun, Oct 12, 2014 at 8:09 PM, Valdis Kletnieks
<Valdis.Kletnieks@vt.edu> wrote:
> The pstore filesystem still creates duplicate filename/inode pairs for
> some pstore types.  Add the id to the filename to prevent that.

Looks good to me, thanks!

Acked-by: Kees Cook <keescook@chromium.org>

-Kees

>
> Before patch:
>
> [/sys/fs/pstore] ls -li
> total 0
> 1250 -r--r--r--. 1 root root 67 Sep 29 17:09 console-efi
> 1250 -r--r--r--. 1 root root 67 Sep 29 17:09 console-efi
> 1250 -r--r--r--. 1 root root 67 Sep 29 17:09 console-efi
> 1250 -r--r--r--. 1 root root 67 Sep 29 17:09 console-efi
> 1250 -r--r--r--. 1 root root 67 Sep 29 17:09 console-efi
> 1250 -r--r--r--. 1 root root 67 Sep 29 17:09 console-efi
> 1250 -r--r--r--. 1 root root 67 Sep 29 17:09 console-efi
> 1250 -r--r--r--. 1 root root 67 Sep 29 17:09 console-efi
> 1250 -r--r--r--. 1 root root 67 Sep 29 17:09 console-efi
>
>
> After:
>
> [/sys/fs/pstore] ls -li
> total 0
> 1232 -r--r--r--. 1 root root 148 Sep 29 17:09 console-efi-141202499100000
> 1231 -r--r--r--. 1 root root  67 Sep 29 17:09 console-efi-141202499200000
> 1230 -r--r--r--. 1 root root 148 Sep 29 17:44 console-efi-141202705400000
> 1229 -r--r--r--. 1 root root  67 Sep 29 17:44 console-efi-141202705500000
> 1228 -r--r--r--. 1 root root  67 Sep 29 20:42 console-efi-141203772600000
> 1227 -r--r--r--. 1 root root 148 Sep 29 23:42 console-efi-141204854900000
> 1226 -r--r--r--. 1 root root  67 Sep 29 23:42 console-efi-141204855000000
> 1225 -r--r--r--. 1 root root 148 Sep 29 23:59 console-efi-141204954200000
> 1224 -r--r--r--. 1 root root  67 Sep 29 23:59 console-efi-141204954400000
>
> Signed-off-by: Valdis Kletnieks <valdis.kletnieks@vt.edu>
>
> --- linux-next/fs/pstore/inode.c.orig   2014-10-03 23:58:00.440386528 -0400
> +++ linux-next/fs/pstore/inode.c        2014-10-09 17:50:50.613829841 -0400
> @@ -320,10 +320,10 @@ int pstore_mkfile(enum pstore_type_id ty
>                                                 compressed ? ".enc.z" : "");
>                 break;
>         case PSTORE_TYPE_CONSOLE:
> -               sprintf(name, "console-%s", psname);
> +               sprintf(name, "console-%s-%lld", psname, id);
>                 break;
>         case PSTORE_TYPE_FTRACE:
> -               sprintf(name, "ftrace-%s", psname);
> +               sprintf(name, "ftrace-%s-%lld", psname, id);
>                 break;
>         case PSTORE_TYPE_MCE:
>                 sprintf(name, "mce-%s-%lld", psname, id);
>



-- 
Kees Cook
Chrome OS Security

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2014-10-14 15:41 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-10-13  3:09 [PATCH[ fix duplicate console-efi entries in pstore Valdis Kletnieks
2014-10-14 15:41 ` Kees Cook

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®