diff mbox series

[v8,19/20] pstore: fs superblock limits

Message ID 20190818165817.32634-20-deepa.kernel@gmail.com (mailing list archive)
State New, archived
Headers show
Series vfs: Add support for timestamp limits | expand

Commit Message

Deepa Dinamani Aug. 18, 2019, 4:58 p.m. UTC
Leaving granularity at 1ns because it is dependent on the specific
attached backing pstore module. ramoops has microsecond resolution.

Fix the readback of ramoops fractional timestamp microseconds,
which has incorrectly been reporting the value as nanoseconds since
3f8f80f0 ("pstore/ram: Read and write to the 'compressed' flag of pstore").

Signed-off-by: Deepa Dinamani <deepa.kernel@gmail.com>
Acked-by: Kees Cook <keescook@chromium.org>
Cc: anton@enomsg.org
Cc: ccross@android.com
Cc: keescook@chromium.org
Cc: tony.luck@intel.com
---
 fs/pstore/ram.c | 2 ++
 1 file changed, 2 insertions(+)

Comments

Kees Cook Aug. 20, 2019, 7:20 a.m. UTC | #1
On Sun, Aug 18, 2019 at 09:58:16AM -0700, Deepa Dinamani wrote:
> Leaving granularity at 1ns because it is dependent on the specific
> attached backing pstore module. ramoops has microsecond resolution.
> 
> Fix the readback of ramoops fractional timestamp microseconds,
> which has incorrectly been reporting the value as nanoseconds since
> 3f8f80f0 ("pstore/ram: Read and write to the 'compressed' flag of pstore").

As such, this should also have:

Fixes: 3f8f80f0cfeb ("pstore/ram: Read and write to the 'compressed' flag of pstore")

> Signed-off-by: Deepa Dinamani <deepa.kernel@gmail.com>
> Acked-by: Kees Cook <keescook@chromium.org>

Also: this is going via some other tree, yes? (Or should I pick this up
for the pstore tree?)

Thanks!

-Kees

> Cc: anton@enomsg.org
> Cc: ccross@android.com
> Cc: keescook@chromium.org
> Cc: tony.luck@intel.com
> ---
>  fs/pstore/ram.c | 2 ++
>  1 file changed, 2 insertions(+)
> 
> diff --git a/fs/pstore/ram.c b/fs/pstore/ram.c
> index 2bb3468fc93a..8caff834f002 100644
> --- a/fs/pstore/ram.c
> +++ b/fs/pstore/ram.c
> @@ -144,6 +144,7 @@ static int ramoops_read_kmsg_hdr(char *buffer, struct timespec64 *time,
>  	if (sscanf(buffer, RAMOOPS_KERNMSG_HDR "%lld.%lu-%c\n%n",
>  		   (time64_t *)&time->tv_sec, &time->tv_nsec, &data_type,
>  		   &header_length) == 3) {
> +		time->tv_nsec *= 1000;
>  		if (data_type == 'C')
>  			*compressed = true;
>  		else
> @@ -151,6 +152,7 @@ static int ramoops_read_kmsg_hdr(char *buffer, struct timespec64 *time,
>  	} else if (sscanf(buffer, RAMOOPS_KERNMSG_HDR "%lld.%lu\n%n",
>  			  (time64_t *)&time->tv_sec, &time->tv_nsec,
>  			  &header_length) == 2) {
> +		time->tv_nsec *= 1000;
>  		*compressed = false;
>  	} else {
>  		time->tv_sec = 0;
> -- 
> 2.17.1
>
Deepa Dinamani Aug. 21, 2019, 12:03 a.m. UTC | #2
On Tue, Aug 20, 2019 at 12:20 AM Kees Cook <keescook@chromium.org> wrote:
>
> On Sun, Aug 18, 2019 at 09:58:16AM -0700, Deepa Dinamani wrote:
> > Leaving granularity at 1ns because it is dependent on the specific
> > attached backing pstore module. ramoops has microsecond resolution.
> >
> > Fix the readback of ramoops fractional timestamp microseconds,
> > which has incorrectly been reporting the value as nanoseconds since
> > 3f8f80f0 ("pstore/ram: Read and write to the 'compressed' flag of pstore").
>
> As such, this should also have:
>
> Fixes: 3f8f80f0cfeb ("pstore/ram: Read and write to the 'compressed' flag of pstore")

Will add that in. Thanks.

> > Signed-off-by: Deepa Dinamani <deepa.kernel@gmail.com>
> > Acked-by: Kees Cook <keescook@chromium.org>
>
> Also: this is going via some other tree, yes? (Or should I pick this up
> for the pstore tree?)

I am hoping Al can take the series as a whole.

-Deepa
diff mbox series

Patch

diff --git a/fs/pstore/ram.c b/fs/pstore/ram.c
index 2bb3468fc93a..8caff834f002 100644
--- a/fs/pstore/ram.c
+++ b/fs/pstore/ram.c
@@ -144,6 +144,7 @@  static int ramoops_read_kmsg_hdr(char *buffer, struct timespec64 *time,
 	if (sscanf(buffer, RAMOOPS_KERNMSG_HDR "%lld.%lu-%c\n%n",
 		   (time64_t *)&time->tv_sec, &time->tv_nsec, &data_type,
 		   &header_length) == 3) {
+		time->tv_nsec *= 1000;
 		if (data_type == 'C')
 			*compressed = true;
 		else
@@ -151,6 +152,7 @@  static int ramoops_read_kmsg_hdr(char *buffer, struct timespec64 *time,
 	} else if (sscanf(buffer, RAMOOPS_KERNMSG_HDR "%lld.%lu\n%n",
 			  (time64_t *)&time->tv_sec, &time->tv_nsec,
 			  &header_length) == 2) {
+		time->tv_nsec *= 1000;
 		*compressed = false;
 	} else {
 		time->tv_sec = 0;