Skip to contentSkip to conversation

tools/xenstore: don't apply write limiting for privileged domain

PATCH In review Juergen Gross 2 participants 4 messages Jan 31, 2020

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 tools/xenstore: don't apply write limiting for privileged domain

Xenstore write limiting should not be applied to dom0. Unfortunately write limiting is disabled only for connections via sockets. When running in a stubdom Xenstore will apply write limiting to dom0, too. Change that by testing for the domain to be privileged as well.

---
 tools/xenstore/xenstored_domain.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
tools/xenstore/xenstored_domain.c +2 -2
index 1a83097952..c7c6c574df 100644
@@ -918,8 +918,8 @@ void wrl_apply_debit_actual(struct domain *domain)
 {
 	struct wrl_timestampt now;
 
-	if (!domain)
-		/* sockets escape the write rate limit */
+	if (!domain || !domid_is_unprivileged(domain->domid))
+		/* sockets and dom0 escape the write rate limit */
 		return;
 
 	wrl_gettime_now(&now);
Signature · 7 lines
2.16.4


_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel
Acked-by on v1 1/1
#1 lore raw
Quoted 6 lines · Juergen Gross

Xenstore write limiting should not be applied to dom0. Unfortunately write limiting is disabled only for connections via sockets. When running in a stubdom Xenstore will apply write limiting to dom0, too. Change that by testing for the domain to be privileged as well.

Quoted 22 lines
---
 tools/xenstore/xenstored_domain.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
tools/xenstore/xenstored_domain.c +2 -2
index 1a83097952..c7c6c574df 100644
@@ -918,8 +918,8 @@ void wrl_apply_debit_actual(struct domain *domain)
 {
 	struct wrl_timestampt now;
 
-	if (!domain)
-		/* sockets escape the write rate limit */
+	if (!domain || !domid_is_unprivileged(domain->domid))
+		/* sockets and dom0 escape the write rate limit */
 		return;
 
 	wrl_gettime_now(&now);
Signature · 1 line
2.16.4

_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel

#2 lore raw
Quoted 22 lines · Wei Liu
Quoted 6 lines · Juergen Gross

Xenstore write limiting should not be applied to dom0. Unfortunately write limiting is disabled only for connections via sockets. When running in a stubdom Xenstore will apply write limiting to dom0, too. Change that by testing for the domain to be privileged as well.

Quoted 12 lines
---
 tools/xenstore/xenstored_domain.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
tools/xenstore/xenstored_domain.c +0 -0
index 1a83097952..c7c6c574df 100644
@@ -918,8 +918,8 @@ void wrl_apply_debit_actual(struct domain *domain)
 {
 	struct wrl_timestampt now;
 
Quoted 4 lines

tools/xenstore/xenstored_domain.c void wrl_apply_debit_actual(struct domain *domain) · line 922

Quoted 4 lines
tools/xenstore/xenstored_domain.c +2 -2
-	if (!domain)
-		/* sockets escape the write rate limit */
+	if (!domain || !domid_is_unprivileged(domain->domid))
+		/* sockets and dom0 escape the write rate limit */

Actually I think changing dom0 to "privileged domain" makes more sense here because you're allowed to specify a non-0 domain ID as privileged domid.

If you agree I can fix it while committing.

Wei.

Quoted 6 lines
Quoted 6 lines
tools/xenstore/xenstored_domain.c +0 -0
 		return;
 
 	wrl_gettime_now(&now);
Signature · 1 line
2.16.4

_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel

#3 lore raw
Quoted 32 lines · Wei Liu
Quoted 22 lines · Wei Liu
Quoted 6 lines · Juergen Gross

Xenstore write limiting should not be applied to dom0. Unfortunately write limiting is disabled only for connections via sockets. When running in a stubdom Xenstore will apply write limiting to dom0, too. Change that by testing for the domain to be privileged as well.

Quoted 12 lines
---
  tools/xenstore/xenstored_domain.c | 4 ++--
  1 file changed, 2 insertions(+), 2 deletions(-)
tools/xenstore/xenstored_domain.c +0 -0
index 1a83097952..c7c6c574df 100644
@@ -918,8 +918,8 @@ void wrl_apply_debit_actual(struct domain *domain)
  {
  	struct wrl_timestampt now;
 
Quoted 4 lines

tools/xenstore/xenstored_domain.c void wrl_apply_debit_actual(struct domain *domain) · line 922

Quoted 4 lines
tools/xenstore/xenstored_domain.c +2 -2
-	if (!domain)
-		/* sockets escape the write rate limit */
+	if (!domain || !domid_is_unprivileged(domain->domid))
+		/* sockets and dom0 escape the write rate limit */

Actually I think changing dom0 to "privileged domain" makes more sense here because you're allowed to specify a non-0 domain ID as privileged domid.

Quoted 1 line

If you agree I can fix it while committing.

Yes, sure.

Juergen

_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel