diff mbox series

[5/9] y2038: introduce CONFIG_64BIT_TIME

Message ID 20171110224259.15930-6-deepa.kernel@gmail.com
State New
Headers show
Series None | expand

Commit Message

Deepa Dinamani Nov. 10, 2017, 10:42 p.m. UTC
From: Arnd Bergmann <arnd@arndb.de>


There are a total of 53 system calls (aside from ioctl) that pass a time_t
or derived data structure as an argument, and in order to extend time_t
to 64-bit, we have to replace them with new system calls and keep providing
backwards compatibility.

To avoid adding completely new and untested code for this purpose, we
introduce a new CONFIG_64BIT_TIME symbol. Every architecture that supports
new 64 bit time_t syscalls enables this config via ARCH_HAS_64BIT_TIME.

After this is done for all architectures, the CONFIG_64BIT_TIME symbol
can be made a user-selected option, to enable users to build a kernel
that only provides y2038-safe system calls by making 32 time_t syscalls
conditionally included based on the above config.

Signed-off-by: Arnd Bergmann <arnd@arndb.de>

Signed-off-by: Deepa Dinamani <deepa.kernel@gmail.com>

---
 arch/Kconfig | 11 +++++++++++
 1 file changed, 11 insertions(+)

-- 
2.11.0

Comments

Ben Hutchings Dec. 8, 2017, 4:53 p.m. UTC | #1
On Fri, 2017-11-10 at 14:42 -0800, Deepa Dinamani wrote:
> From: Arnd Bergmann <arnd@arndb.de>

> 

> There are a total of 53 system calls (aside from ioctl) that pass a time_t

> or derived data structure as an argument, and in order to extend time_t

> to 64-bit, we have to replace them with new system calls and keep providing

> backwards compatibility.

> 

> To avoid adding completely new and untested code for this purpose, we

> introduce a new CONFIG_64BIT_TIME symbol. Every architecture that supports

> new 64 bit time_t syscalls enables this config via ARCH_HAS_64BIT_TIME.

> 

> After this is done for all architectures, the CONFIG_64BIT_TIME symbol

> can be made a user-selected option, to enable users to build a kernel

> that only provides y2038-safe system calls by making 32 time_t syscalls

> conditionally included based on the above config.


I don't understand why we would want to change the semantics of
CONFIG_64BIT_TIME symbol from "enable 64-bit time support" to "disable
32-bit time support".

Why not add two config symbols:

config 32BIT_TIME
	def_bool COMPAT || !64BIT

config 64BIT_TIME
	def_bool ARCH_HAS_64BIT_TIME

and then make 32BIT_TIME user-configurable later?

> Signed-off-by: Arnd Bergmann <arnd@arndb.de>

> Signed-off-by: Deepa Dinamani <deepa.kernel@gmail.com>

> ---

>  arch/Kconfig | 11 +++++++++++

>  1 file changed, 11 insertions(+)

> 

> diff --git a/arch/Kconfig b/arch/Kconfig

> index 8911ff37335a..3266ac1a4ff7 100644

> --- a/arch/Kconfig

> +++ b/arch/Kconfig

> @@ -875,6 +875,17 @@ config OLD_SIGACTION

>  config COMPAT_OLD_SIGACTION

>  	bool

>  

> +config ARCH_HAS_64BIT_TIME

> +	def_bool n

> +

> +config CONFIG_64BIT_TIME


The CONFIG_ prefix is added by kconfig scripts and shouldn't be used in
the Kconfig file.

Ben.

> +	def_bool ARCH_HAS_64BIT_TIME

> +	help

> +	  This should be selected by all architectures that need to support

> +	  new system calls with a 64-bit time_t. This is relevant on all 32-bit

> +	  architectures, and 64-bit architectures as part of compat syscall

> +	  handling.

> +

>  config ARCH_NO_COHERENT_DMA_MMAP

>  	bool

>  


-- 
Ben Hutchings
Software Developer, Codethink Ltd.
Deepa Dinamani Dec. 8, 2017, 5:01 p.m. UTC | #2
On Fri, Dec 8, 2017 at 8:53 AM, Ben Hutchings
<ben.hutchings@codethink.co.uk> wrote:
> On Fri, 2017-11-10 at 14:42 -0800, Deepa Dinamani wrote:

>> From: Arnd Bergmann <arnd@arndb.de>

>>

>> There are a total of 53 system calls (aside from ioctl) that pass a time_t

>> or derived data structure as an argument, and in order to extend time_t

>> to 64-bit, we have to replace them with new system calls and keep providing

>> backwards compatibility.

>>

>> To avoid adding completely new and untested code for this purpose, we

>> introduce a new CONFIG_64BIT_TIME symbol. Every architecture that supports

>> new 64 bit time_t syscalls enables this config via ARCH_HAS_64BIT_TIME.

>>

>> After this is done for all architectures, the CONFIG_64BIT_TIME symbol

>> can be made a user-selected option, to enable users to build a kernel

>> that only provides y2038-safe system calls by making 32 time_t syscalls

>> conditionally included based on the above config.

>

> I don't understand why we would want to change the semantics of

> CONFIG_64BIT_TIME symbol from "enable 64-bit time support" to "disable

> 32-bit time support".

>

> Why not add two config symbols:

>

> config 32BIT_TIME

>         def_bool COMPAT || !64BIT

>

> config 64BIT_TIME

>         def_bool ARCH_HAS_64BIT_TIME

>

> and then make 32BIT_TIME user-configurable later?


This was already discussed on the review and we have an updated version:

https://lkml.org/lkml/2017/11/27/938

>> Signed-off-by: Arnd Bergmann <arnd@arndb.de>

>> Signed-off-by: Deepa Dinamani <deepa.kernel@gmail.com>

>> ---

>>  arch/Kconfig | 11 +++++++++++

>>  1 file changed, 11 insertions(+)

>>

>> diff --git a/arch/Kconfig b/arch/Kconfig

>> index 8911ff37335a..3266ac1a4ff7 100644

>> --- a/arch/Kconfig

>> +++ b/arch/Kconfig

>> @@ -875,6 +875,17 @@ config OLD_SIGACTION

>>  config COMPAT_OLD_SIGACTION

>>       bool

>>

>> +config ARCH_HAS_64BIT_TIME

>> +     def_bool n

>> +

>> +config CONFIG_64BIT_TIME

>

> The CONFIG_ prefix is added by kconfig scripts and shouldn't be used in

> the Kconfig file.


Yes, this was a typo and was fixed by the next revision which has
already been posted:

https://lkml.org/lkml/2017/11/27/938

-Deepa
Ben Hutchings Dec. 8, 2017, 6:23 p.m. UTC | #3
On Fri, 2017-12-08 at 09:01 -0800, Deepa Dinamani wrote:
> On Fri, Dec 8, 2017 at 8:53 AM, Ben Hutchings

> > <ben.hutchings@codethink.co.uk> wrote:

> > On Fri, 2017-11-10 at 14:42 -0800, Deepa Dinamani wrote:

> > > From: Arnd Bergmann <arnd@arndb.de>

> > > 

> > > There are a total of 53 system calls (aside from ioctl) that pass a time_t

> > > or derived data structure as an argument, and in order to extend time_t

> > > to 64-bit, we have to replace them with new system calls and keep providing

> > > backwards compatibility.

> > > 

> > > To avoid adding completely new and untested code for this purpose, we

> > > introduce a new CONFIG_64BIT_TIME symbol. Every architecture that supports

> > > new 64 bit time_t syscalls enables this config via ARCH_HAS_64BIT_TIME.

> > > 

> > > After this is done for all architectures, the CONFIG_64BIT_TIME symbol

> > > can be made a user-selected option, to enable users to build a kernel

> > > that only provides y2038-safe system calls by making 32 time_t syscalls

> > > conditionally included based on the above config.

> > 

> > I don't understand why we would want to change the semantics of

> > CONFIG_64BIT_TIME symbol from "enable 64-bit time support" to "disable

> > 32-bit time support".

> > 

> > Why not add two config symbols:

> > 

> > config 32BIT_TIME

> >         def_bool COMPAT || !64BIT

> > 

> > config 64BIT_TIME

> >         def_bool ARCH_HAS_64BIT_TIME

> > 

> > and then make 32BIT_TIME user-configurable later?

> 

> This was already discussed on the review and we have an updated version:

> 

> https://lkml.org/lkml/2017/11/27/938


Sorry, I'll move on to reviewing that.

Ben.

-- 
Ben Hutchings
Software Developer, Codethink Ltd.
diff mbox series

Patch

diff --git a/arch/Kconfig b/arch/Kconfig
index 8911ff37335a..3266ac1a4ff7 100644
--- a/arch/Kconfig
+++ b/arch/Kconfig
@@ -875,6 +875,17 @@  config OLD_SIGACTION
 config COMPAT_OLD_SIGACTION
 	bool
 
+config ARCH_HAS_64BIT_TIME
+	def_bool n
+
+config CONFIG_64BIT_TIME
+	def_bool ARCH_HAS_64BIT_TIME
+	help
+	  This should be selected by all architectures that need to support
+	  new system calls with a 64-bit time_t. This is relevant on all 32-bit
+	  architectures, and 64-bit architectures as part of compat syscall
+	  handling.
+
 config ARCH_NO_COHERENT_DMA_MMAP
 	bool