[Devel] [PATCH RHEL7 COMMIT] ve/time/ntp: allow CT ntp adjustment time tuning under VE_FEATURE_TIME feature
Konstantin Khorenko
khorenko at virtuozzo.com
Fri May 24 18:21:36 MSK 2019
The commit is pushed to "branch-rh7-3.10.0-957.12.2.vz7.96.x-ovz" and will appear at https://src.openvz.org/scm/ovz/vzkernel.git
after rh7-3.10.0-957.12.2.vz7.96.4
------>
commit d8f0ae8ce68f174fe150fcde233e56c7de8a0267
Author: Konstantin Khorenko <khorenko at virtuozzo.com>
Date: Fri May 24 12:11:15 2019 +0300
ve/time/ntp: allow CT ntp adjustment time tuning under VE_FEATURE_TIME feature
ntp service uses clock adjustment algorithm (sys_adjtimex()),
so allow it in a Container with VE_FEATURE_TIME feature assigned.
https://jira.sw.ru/browse/PSBM-94635
Signed-off-by: Konstantin Khorenko <khorenko at virtuozzo.com>
---
kernel/time/ntp.c | 10 +++++++---
1 file changed, 7 insertions(+), 3 deletions(-)
diff --git a/kernel/time/ntp.c b/kernel/time/ntp.c
index 026d94e96df4..0552d58d27d6 100644
--- a/kernel/time/ntp.c
+++ b/kernel/time/ntp.c
@@ -17,6 +17,8 @@
#include <linux/module.h>
#include <linux/rtc.h>
+#include <uapi/linux/vzcalluser.h>
+
#include "tick-internal.h"
#include "ntp_internal.h"
@@ -642,11 +644,12 @@ int ntp_validate_timex(struct timex *txc)
if (!(txc->modes & ADJ_OFFSET_SINGLESHOT))
return -EINVAL;
if (!(txc->modes & ADJ_OFFSET_READONLY) &&
- !capable(CAP_SYS_TIME))
+ !feature_capable(VE_FEATURE_TIME, CAP_SYS_TIME))
return -EPERM;
} else {
/* In order to modify anything, you gotta be super-user! */
- if (txc->modes && !capable(CAP_SYS_TIME))
+ if (txc->modes &&
+ !feature_capable(VE_FEATURE_TIME, CAP_SYS_TIME))
return -EPERM;
/*
* if the quartz is off by more than 10% then
@@ -658,7 +661,8 @@ int ntp_validate_timex(struct timex *txc)
return -EINVAL;
}
- if ((txc->modes & ADJ_SETOFFSET) && (!capable(CAP_SYS_TIME)))
+ if ((txc->modes & ADJ_SETOFFSET) &&
+ (!feature_capable(VE_FEATURE_TIME, CAP_SYS_TIME)))
return -EPERM;
return 0;
More information about the Devel
mailing list