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]
Message-Id: <20161119161036.12679-15-nicstange@gmail.com>
Date:   Sat, 19 Nov 2016 17:10:34 +0100
From:   Nicolai Stange <nicstange@...il.com>
To:     Thomas Gleixner <tglx@...utronix.de>
Cc:     John Stultz <john.stultz@...aro.org>, linux-kernel@...r.kernel.org,
        Nicolai Stange <nicstange@...il.com>
Subject: [RFC v8 26/28] clockevents: degrade ->retries to unsigned int

Being of type unsigned long, the struct clock_event_device's ->retries
member is incremented in clockevents_program_min_delta() and used for
diagnostic purposes in /proc/timer_list only.

Turning ->retries' type into unsigned int avoids the introduction of
some padding with future reorderings of struct clock_event_device for the
case of sizeof(unsigned long) == sizeof(void*) == 8. This is turn prevents
these reorganizations from making sizeof(struct clock_event_device) cross
a multiple of the cacheline size, assumed to be equal to 64 bytes.

For the case of HZ=1000, this change still allows for
2^32 / HZ / (3600*24) = 49 days without overwrap, even in the highly
unrealistic case of one clockevents_program_min_delta() invocation per
tick.

Thus, change ->retries' type from unsigned long to unsigned int. Adapt
the format specifier or /proc/timer_list accordingly.

Signed-off-by: Nicolai Stange <nicstange@...il.com>
---
 include/linux/clockchips.h | 2 +-
 kernel/time/timer_list.c   | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/include/linux/clockchips.h b/include/linux/clockchips.h
index e07f421..878a802 100644
--- a/include/linux/clockchips.h
+++ b/include/linux/clockchips.h
@@ -115,7 +115,7 @@ struct clock_event_device {
 	u32			shift;
 	enum clock_event_state	state_use_accessors:8;
 	unsigned int		features:24;
-	unsigned long		retries;
+	unsigned int		retries;
 
 	int			(*set_state_periodic)(struct clock_event_device *);
 	int			(*set_state_oneshot)(struct clock_event_device *);
diff --git a/kernel/time/timer_list.c b/kernel/time/timer_list.c
index 9067760..6a8d54f 100644
--- a/kernel/time/timer_list.c
+++ b/kernel/time/timer_list.c
@@ -271,7 +271,7 @@ print_tickdevice(struct seq_file *m, struct tick_device *td, int cpu)
 	SEQ_printf(m, " event_handler:  ");
 	print_name_offset(m, dev->event_handler);
 	SEQ_printf(m, "\n");
-	SEQ_printf(m, " retries:        %lu\n", dev->retries);
+	SEQ_printf(m, " retries:        %u\n", dev->retries);
 	SEQ_printf(m, "\n");
 }
 
-- 
2.10.2

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ