[vserver] sysinfo leaks of host uptime

From: Ghislain Adnet <gadnet_at_aqueos.com>
Date: Mon 10 Dec 2018 - 17:22:22 GMT
Message-ID: <77c7f28c-5179-75e1-f2c1-d55336b11e10@aqueos.com>

Hi,

  For guest all program using sysinfo leaks the thread numbers and the uptime of the complete host. For the thread i
sent a little patch that seems to do the job. For the uptime i am unable to make one.

from:

https://elixir.bootlin.com/linux/latest/source/kernel/sys.c#L2503

do_sysinfo
=> calls ktime_get_boottime_ts64(&tp);
=>that calls ktime_get_boottime();

so "in-fine" all the 'uptime fuinctions need to call these 2 functions that leaks the host uptime , they are:

https://elixir.bootlin.com/linux/latest/ident/ktime_get_boottime
https://elixir.bootlin.com/linux/latest/ident/ktime_get_coarse_boottime

i tried something like

  static inline ktime_t ktime_get_boottime(void)
  {
- return ktime_get_with_offset(TK_OFFS_BOOT);
+ if (!vx_flags(VXF_VIRT_TIME, 0))
+ return ktime_get_with_offset(TK_OFFS_BOOT);
+
+ timespec64 boottime;
+ vx_vsi_boottime64(&boottime);
+
+ return timespec64_to_ktime(&boottime);
  }

but it fails.

Any ideas ?

Reagrds,
Ghislain.

of course if we change those we need to remove the uptime modifier in uptime.c because it also calls
ktime_get_boottime_ts64:

--- ../linux-4.9.135/fs/proc/uptime.c 2018-10-21 11:45:32.168493146 +0200
+++ fs/proc/uptime.c 2018-12-09 15:50:34.023848023 +0100
@@ -23,8 +23,9 @@ static int uptime_proc_show(struct seq_f
         idle.tv_sec = div_u64_rem(nsec, NSEC_PER_SEC, &rem);
         idle.tv_nsec = rem;

- if (vx_flags(VXF_VIRT_UPTIME, 0))
- vx_vsi_uptime(&uptime, &idle);

         seq_printf(m, "%lu.%02lu %lu.%02lu\n",
                         (unsigned long) uptime.tv_sec,
Received on Mon Dec 10 17:11:36 2018

[Next/Previous Months] [Main vserver Project Homepage] [Howto Subscribe/Unsubscribe] [Paul Sladen's vserver stuff]
Generated on Mon 10 Dec 2018 - 17:11:36 GMT by hypermail 2.1.8