lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:   Wed, 20 Jun 2018 10:25:26 +0200
From:   Jan Kara <jack@...e.cz>
To:     Arnd Bergmann <arnd@...db.de>
Cc:     Al Viro <viro@...iv.linux.org.uk>,
        Andrew Morton <akpm@...ux-foundation.org>,
        y2038@...ts.linaro.org, Jan Kara <jack@...e.cz>,
        Thomas Gleixner <tglx@...utronix.de>,
        reiserfs-devel@...r.kernel.org, linux-kernel@...r.kernel.org
Subject: Re: [PATCH 2/3] reiserfs: use monotonic time for j_trans_start_time

On Tue 19-06-18 17:43:14, Arnd Bergmann wrote:
> Using CLOCK_REALTIME time_t timestamps breaks on 32-bit systems
> in 2038, and gives surprising results with a concurrent settimeofday().
> 
> This changes the reiserfs journal timestamps to use ktime_get_seconds()
> instead, which makes it use a 64-bit CLOCK_MONOTONIC stamp.
> 
> In the procfs output, the monotonic timestamp needs to be converted
> back to CLOCK_REALTIME to keep the existing ABI.
> 
> Signed-off-by: Arnd Bergmann <arnd@...db.de>
...
> diff --git a/fs/reiserfs/procfs.c b/fs/reiserfs/procfs.c
> index e39b3910d24d..520f9003c13a 100644
> --- a/fs/reiserfs/procfs.c
> +++ b/fs/reiserfs/procfs.c
> @@ -303,6 +303,10 @@ static int show_journal(struct seq_file *m, void *unused)
>  	struct reiserfs_sb_info *r = REISERFS_SB(sb);
>  	struct reiserfs_super_block *rs = r->s_rs;
>  	struct journal_params *jp = &rs->s_v1.s_journal;
> +	ktime_t j_trans_start_ktime = ktime_set(JF(j_trans_start_time), 0);
> +
> +	/* print as CLOCK_REALTIME */
> +	j_trans_start_ktime = ktime_mono_to_real(j_trans_start_ktime);
>  
>  	seq_printf(m,		/* on-disk fields */
>  		   "jp_journal_1st_block: \t%i\n"
> @@ -325,7 +329,7 @@ static int show_journal(struct seq_file *m, void *unused)
>  		   "j_bcount: \t%lu\n"
>  		   "j_first_unflushed_offset: \t%lu\n"
>  		   "j_last_flush_trans_id: \t%u\n"
> -		   "j_trans_start_time: \t%li\n"
> +		   "j_trans_start_time: \t%lli\n"
>  		   "j_list_bitmap_index: \t%i\n"
>  		   "j_must_wait: \t%i\n"
>  		   "j_next_full_flush: \t%i\n"
> @@ -366,7 +370,7 @@ static int show_journal(struct seq_file *m, void *unused)
>  		   JF(j_bcount),
>  		   JF(j_first_unflushed_offset),
>  		   JF(j_last_flush_trans_id),
> -		   JF(j_trans_start_time),
> +		   ktime_divns(j_trans_start_ktime, NSEC_PER_SEC),

Hum, this looks cumbersome - maybe have a helper function converting
MONOTONIC to REALTIME seconds? Regardless the code looks correct and
reiserfs is old enough that I'm happy someone improves anything there so
I'm OK even with the current code. Feel free to add:

Reviewed-by: Jan Kara <jack@...e.cz>

								Honza

-- 
Jan Kara <jack@...e.com>
SUSE Labs, CR

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ