[08/12] kdat: Config for loginuid

Submitted by Pavel Emelianov on April 24, 2017, 8:08 p.m.

Details

Message ID 58FE5B3A.4060704@virtuozzo.com
State New
Series "Speed up kdat checks"
Headers show

Commit Message

Pavel Emelianov April 24, 2017, 8:08 p.m.
The write- or readability of /proc/pid/loginuid can be determined
compile-time.

Signed-off-by: Pavel Emelyanov <xemul@virtuozzo.com>
---
 criu/kerndat.c | 16 ++++++++++++++++
 1 file changed, 16 insertions(+)

Patch hide | download patch | download mbox

diff --git a/criu/kerndat.c b/criu/kerndat.c
index 837ddee..90fca22 100644
--- a/criu/kerndat.c
+++ b/criu/kerndat.c
@@ -471,6 +471,21 @@  int check_loginuid_op(bool full)
 	return 1;
 }
 
+#ifdef CONFIG_KERNEL_LOGINUID
+static inline int kerndat_loginuid(bool for_restore)
+{
+# if CONFIG_KERNEL_LOGINUID == 0
+	kdat.has_loginuid = false;
+# elif CONFIG_KERNEL_LOGINUID == 1
+	kdat.has_loginuid = !for_restore;
+# elif CONFIG_KERNEL_LOGINUID == 2
+	kdat.has_loginuid = true;
+# else
+#       error "Bad CONFIG_KERNEL_LOGINUID config value"
+# endif
+	return 0;
+}
+#else
 static int kerndat_loginuid(bool for_restore)
 {
 	int ret;
@@ -483,6 +498,7 @@  static int kerndat_loginuid(bool for_restore)
 	}
 	return ret;
 }
+#endif
 
 #ifdef CONFIG_IPTABLES_HAS_XTLOCKS
 static inline int kerndat_iptables_has_xtlocks(void)

Comments

Dmitry Safonov April 25, 2017, 11:17 a.m.
2017-04-24 23:08 GMT+03:00 Pavel Emelyanov <xemul@virtuozzo.com>:
> The write- or readability of /proc/pid/loginuid can be determined
> compile-time.
>
> Signed-off-by: Pavel Emelyanov <xemul@virtuozzo.com>
> ---
>  criu/kerndat.c | 16 ++++++++++++++++
>  1 file changed, 16 insertions(+)
>
> diff --git a/criu/kerndat.c b/criu/kerndat.c
> index 837ddee..90fca22 100644
> --- a/criu/kerndat.c
> +++ b/criu/kerndat.c
> @@ -471,6 +471,21 @@ int check_loginuid_op(bool full)
>         return 1;
>  }
>
> +#ifdef CONFIG_KERNEL_LOGINUID
> +static inline int kerndat_loginuid(bool for_restore)
> +{
> +# if CONFIG_KERNEL_LOGINUID == 0
> +       kdat.has_loginuid = false;
> +# elif CONFIG_KERNEL_LOGINUID == 1
> +       kdat.has_loginuid = !for_restore;
> +# elif CONFIG_KERNEL_LOGINUID == 2
> +       kdat.has_loginuid = true;
> +# else
> +#       error "Bad CONFIG_KERNEL_LOGINUID config value"
> +# endif
> +       return 0;
> +}
> +#else

Ouch!~
*sigh*

>  static int kerndat_loginuid(bool for_restore)
>  {
>         int ret;
> @@ -483,6 +498,7 @@ static int kerndat_loginuid(bool for_restore)
>         }
>         return ret;
>  }
> +#endif
>
>  #ifdef CONFIG_IPTABLES_HAS_XTLOCKS
>  static inline int kerndat_iptables_has_xtlocks(void)
Pavel Emelianov April 25, 2017, 2:11 p.m.
On 04/25/2017 02:17 PM, Dmitry Safonov wrote:
> 2017-04-24 23:08 GMT+03:00 Pavel Emelyanov <xemul@virtuozzo.com>:
>> The write- or readability of /proc/pid/loginuid can be determined
>> compile-time.
>>
>> Signed-off-by: Pavel Emelyanov <xemul@virtuozzo.com>
>> ---
>>  criu/kerndat.c | 16 ++++++++++++++++
>>  1 file changed, 16 insertions(+)
>>
>> diff --git a/criu/kerndat.c b/criu/kerndat.c
>> index 837ddee..90fca22 100644
>> --- a/criu/kerndat.c
>> +++ b/criu/kerndat.c
>> @@ -471,6 +471,21 @@ int check_loginuid_op(bool full)
>>         return 1;
>>  }
>>
>> +#ifdef CONFIG_KERNEL_LOGINUID
>> +static inline int kerndat_loginuid(bool for_restore)
>> +{
>> +# if CONFIG_KERNEL_LOGINUID == 0
>> +       kdat.has_loginuid = false;
>> +# elif CONFIG_KERNEL_LOGINUID == 1
>> +       kdat.has_loginuid = !for_restore;
>> +# elif CONFIG_KERNEL_LOGINUID == 2
>> +       kdat.has_loginuid = true;
>> +# else
>> +#       error "Bad CONFIG_KERNEL_LOGINUID config value"
>> +# endif
>> +       return 0;
>> +}
>> +#else
> 
> Ouch!~

Frankly speaking I don't get what the problem here is :)

> *sigh*
> 
>>  static int kerndat_loginuid(bool for_restore)
>>  {
>>         int ret;
>> @@ -483,6 +498,7 @@ static int kerndat_loginuid(bool for_restore)
>>         }
>>         return ret;
>>  }
>> +#endif
>>
>>  #ifdef CONFIG_IPTABLES_HAS_XTLOCKS
>>  static inline int kerndat_iptables_has_xtlocks(void)
> 
>