Skip to contentSkip to conversation

xenstored: EACCESS error accessing control/feature-balloon 1

DISCUSSION zithro 5 participants 10 messages Apr 12, 2023 – May 9, 2023

lore
Share & tools
lore

zithro

author
#0 lore raw

Hi all,

this is what I have in "xenstored-access.log" in dom0 :

[20230411T23:48:27.917Z]  D5         write     control/feature-balloon 1
[20230411T23:48:27.917Z]  D5         error     EACCES
[20230411T23:48:27.923Z]  D5         write     data/updated Wed Apr 12 01:48:27 CEST 2023

It happens once each minute, on two different hosts, both amd64. (both hosts using the same config, only the hardware differs).

I tried looking up for a similar bug, but didn't find one. I apologize in advance if this error is known, and if this is not the place to report this !

-----------------------
Technical infos
-----------------------
dom0s:

Debian stable, kernel 5.10.0-21-amd64
Xen 4.14.5
xl.conf has : autoballoon="0"
GRUB_CMDLINE_XEN="dom0_mem=2048M,max:2048M dom0_max_vcpus=4 dom0_vcpus_pin loglvl=all guest_loglvl=all ucode=scan iommu=verbose" Running "xenstore-ls -f -p | grep balloon" returns no result
-----------------------
domUs (D5 in above logs):

HVM TrueNAS Core, based on FreeBSD 13.1-RELEASE-p7
(it happened also on previous FreeBSD realeases, but don't remember when
it started, logs have been filled and rotated).
In cfg files, using either the same value for "memory" and "maxmem" or only setting "memory" give the same results.

What's strange is that I have xen* commands in FreeNAS :

xen-detect        xenstore-control  xenstore-ls       xenstore-watch
xenstore          xenstore-exists   xenstore-read     xenstore-write
xenstore-chmod    xenstore-list     xenstore-rm
root@truenas[~]# xenstore-ls
xenstore-ls: xs_directory (/): Permission denied
root@truenas[~]# ps aux
root   [...]     0:36.98 [xenwatch]
root   [...]     0:01.01 [xenstore_rcv]
root   [...]     0:00.00 [balloon]
root   [...]     0:01.74 /bin/sh /usr/local/sbin/xe-daemon -p /var/run/xe-daemon.pid
[...]

The xe-daemon looks strange also, I don't use XenServer/XCP-ng, only "raw" Xen.
And this script which hand

I also use PFsense domUs (based on FreeBSD), but they don't exhibit this behaviour (ie. no xenstore access error in dom0, no xen* commands in domU).

So is this a problem with TrueNAS rather than with Xen ? If so I apologize for wasting your time.

Thanks, have a nice day !
(and as it's my first post here: thx for Xen, it rocks)

zithro

#1 lore raw
Quoted 8 lines · zithro

Hi all,

this is what I have in "xenstored-access.log" in dom0 :

[20230411T23:48:27.917Z]  D5         write     control/feature-balloon 1 [20230411T23:48:27.917Z]  D5         error     EACCES [20230411T23:48:27.923Z]  D5         write     data/updated Wed Apr 12 01:48:27 CEST 2023

Quoted 6 lines

It happens once each minute, on two different hosts, both amd64. (both hosts using the same config, only the hardware differs).

I tried looking up for a similar bug, but didn't find one. I apologize in advance if this error is known, and if this is not the place to report this !

This is normal behavior. A guest isn't allowed to create random new nodes below "control", and "feature-balloon" isn't created by the Xen tools, so the guest can't write "control/feature-balloon".

Juergen

#2 lore raw
In reply to zithro
Quoted 61 lines · zithro

Hi all,

this is what I have in "xenstored-access.log" in dom0 :

[20230411T23:48:27.917Z]  D5         write     control/feature-balloon 1 [20230411T23:48:27.917Z]  D5         error     EACCES [20230411T23:48:27.923Z]  D5         write     data/updated Wed Apr 12 01:48:27 CEST 2023

It happens once each minute, on two different hosts, both amd64. (both hosts using the same config, only the hardware differs).

I tried looking up for a similar bug, but didn't find one. I apologize in advance if this error is known, and if this is not the place to report this !

-----------------------
Technical infos
-----------------------
dom0s:

Debian stable, kernel 5.10.0-21-amd64
Xen 4.14.5
xl.conf has : autoballoon="0" GRUB_CMDLINE_XEN="dom0_mem=2048M,max:2048M dom0_max_vcpus=4 dom0_vcpus_pin loglvl=all guest_loglvl=all ucode=scan iommu=verbose" Running "xenstore-ls -f -p | grep balloon" returns no result
-----------------------
domUs (D5 in above logs):

HVM TrueNAS Core, based on FreeBSD 13.1-RELEASE-p7
(it happened also on previous FreeBSD realeases, but don't remember when it started, logs have been filled and rotated).
In cfg files, using either the same value for "memory" and "maxmem" or only setting "memory" give the same results.

What's strange is that I have xen* commands in FreeNAS :

xen-detect        xenstore-control  xenstore-ls       xenstore-watch xenstore          xenstore-exists   xenstore-read     xenstore-write xenstore-chmod    xenstore-list     xenstore-rm

root@truenas[~]# xenstore-ls
xenstore-ls: xs_directory (/): Permission denied
root@truenas[~]# ps aux
root   [...]     0:36.98 [xenwatch]
root   [...]     0:01.01 [xenstore_rcv]
root   [...]     0:00.00 [balloon]
root   [...]     0:01.74 /bin/sh /usr/local/sbin/xe-daemon -p
/var/run/xe-daemon.pid
[...]

The xe-daemon looks strange also, I don't use XenServer/XCP-ng, only "raw" Xen.
And this script which hand

I also use PFsense domUs (based on FreeBSD), but they don't exhibit this behaviour (ie. no xenstore access error in dom0, no xen* commands in domU).

Quoted 5 lines

So is this a problem with TrueNAS rather than with Xen ? If so I apologize for wasting your time.

Thanks, have a nice day !
(and as it's my first post here: thx for Xen, it rocks)

Hello,

(Leaving the full report intact so CC'd people can see it whole)

Yes, it is TrueNAS trying to re-write that file every minute.  It appears that TrueNAS has inherited (from debian?) a rather old version of https://github.com/xenserver/xe-guest-utilities/

https://xenbits.xen.org/docs/unstable/misc/xenstore-paths.html doesn't list feature-balloon as a permitted feature node.

But, I suspect that it used to be the case that guests could write arbitrary feature nodes, and I suspect we tightened the permissions in a security fix to reduce worst-case memory usage of xenstored.

I suspect the best (/least bad) thing to do here is formally introduce feature-ballon as a permitted node, and have the toolstack initialise it to "" like we do with all other nodes, after which TrueNAS ought to be able to set it successfully and not touch it a second time.

~Andrew

#3 lore raw

Hi all,

Quoted 67 lines · Andrew Cooper
Quoted 61 lines · zithro

Hi all,

this is what I have in "xenstored-access.log" in dom0 :

[20230411T23:48:27.917Z]  D5         write     control/feature-balloon 1 [20230411T23:48:27.917Z]  D5         error     EACCES [20230411T23:48:27.923Z]  D5         write     data/updated Wed Apr 12 01:48:27 CEST 2023

It happens once each minute, on two different hosts, both amd64. (both hosts using the same config, only the hardware differs).

I tried looking up for a similar bug, but didn't find one. I apologize in advance if this error is known, and if this is not the place to report this !

-----------------------
Technical infos
-----------------------
dom0s:

Debian stable, kernel 5.10.0-21-amd64
Xen 4.14.5
xl.conf has : autoballoon="0" GRUB_CMDLINE_XEN="dom0_mem=2048M,max:2048M dom0_max_vcpus=4 dom0_vcpus_pin loglvl=all guest_loglvl=all ucode=scan iommu=verbose" Running "xenstore-ls -f -p | grep balloon" returns no result
-----------------------
domUs (D5 in above logs):

HVM TrueNAS Core, based on FreeBSD 13.1-RELEASE-p7
(it happened also on previous FreeBSD realeases, but don't remember when it started, logs have been filled and rotated).
In cfg files, using either the same value for "memory" and "maxmem" or only setting "memory" give the same results.

What's strange is that I have xen* commands in FreeNAS :

xen-detect        xenstore-control  xenstore-ls       xenstore-watch xenstore          xenstore-exists   xenstore-read     xenstore-write xenstore-chmod    xenstore-list     xenstore-rm

root@truenas[~]# xenstore-ls
xenstore-ls: xs_directory (/): Permission denied
root@truenas[~]# ps aux
root   [...]     0:36.98 [xenwatch]
root   [...]     0:01.01 [xenstore_rcv]
root   [...]     0:00.00 [balloon]
root   [...]     0:01.74 /bin/sh /usr/local/sbin/xe-daemon -p
/var/run/xe-daemon.pid
[...]

The xe-daemon looks strange also, I don't use XenServer/XCP-ng, only "raw" Xen.
And this script which hand

I also use PFsense domUs (based on FreeBSD), but they don't exhibit this behaviour (ie. no xenstore access error in dom0, no xen* commands in domU).

Quoted 5 lines

So is this a problem with TrueNAS rather than with Xen ? If so I apologize for wasting your time.

Thanks, have a nice day !
(and as it's my first post here: thx for Xen, it rocks)

Quoted 7 lines

Hello,

(Leaving the full report intact so CC'd people can see it whole)

Yes, it is TrueNAS trying to re-write that file every minute.  It appears that TrueNAS has inherited (from debian?) a rather old version of https://github.com/xenserver/xe-guest-utilities/

TrueNAS being FreeBSD-based probably inherits this from the sysutils/xe-guest-utilities port, which installs a fork of the shell version which predates this golang repository.

Quoted 11 lines

https://xenbits.xen.org/docs/unstable/misc/xenstore-paths.html doesn't list feature-balloon as a permitted feature node.

But, I suspect that it used to be the case that guests could write arbitrary feature nodes, and I suspect we tightened the permissions in a security fix to reduce worst-case memory usage of xenstored.

I suspect the best (/least bad) thing to do here is formally introduce feature-ballon as a permitted node, and have the toolstack initialise it to "" like we do with all other nodes, after which TrueNAS ought to be able to set it successfully and not touch it a second time.

Is there anything besides XAPI using this node, or the other data published by xe-daemon?

Maybe the original issue is just that there is no reason to have xe-guest-utilities installed in this setup?

Best regards,

--
Yann Dirson | Vates Platform Developer
XCP-ng & Xen Orchestra - Vates solutions
w: vates.tech | xcp-ng.org | xen-orchestra.com

Yann Dirson | Vates Platform Developer

XCP-ng & Xen Orchestra - Vates solutions
w: vates.fr | xcp-ng.org | xen-orchestra.com

author
#4 lore raw

Hi,

[ snipped for brevity, report summary:
XAPI daemon in domU tries to write to a non-existent xenstore node in a non-XAPI dom0 ]

Quoted 2 lines · Yann Dirson

Is there anything besides XAPI using this node, or the other data published by xe-daemon?

On my vanilla Xen (ie. non-XAPI), I have no node about "balloon"-ing in xenstore (either dom0 or domU nodes, but I'm not using ballooning in both).

Quoted 2 lines

Maybe the original issue is just that there is no reason to have xe-guest-utilities installed in this setup?

That's what I thought as I'm not using XAPI, so maybe the problem should only be addressed to the truenas team ? I posted on their forum but got no answer. I killed the 'xe-daemon' in both setups without loss of functionality.

My wild guess is that 'xe-daemon', 'xe-update-guest-attrs' and all 'xenstore* commands' are leftovers from when Xen was working as a dom0 under FreeBSD (why would a *domU* have them ?).

But Julien Grall went further by reacting to a suggestion by Yann Dirson (no snip here so you have the full patch details) :

Quoted 48 lines · Julien Grall

From a brief look, this is very similar to the patch below that was
sent 3 years ago. I bet no-one ever tested the driver against libxl.

commit 30a970906038

Author: Vitaly Kuznetsov <[email protected]>
Date:   Tue Sep 4 13:39:29 2018 +0200

libxl: create control/sysrq xenstore node

'xl sysrq' command doesn't work with modern Linux guests with the
following
message in guest's log:

xen:manage: sysrq_handler: Error -13 writing sysrq in control/sysrq

xenstore trace confirms:

IN 0x24bd9a0 20180904 04:36:32 WRITE (control/sysrq ) OUT 0x24bd9a0 20180904 04:36:32 ERROR (EACCES )

The problem seems to be in the fact that we don't pre-create
control/sysrq
xenstore node and libxl_send_sysrq() doing libxl__xs_printf()
creates it as
read-only. As we want to allow guests to clean 'control/sysrq'
after the
requested action is performed, we need to make this node writable.

tools/libxl/libxl_create.c +3 -0
index 60676304e9b5..dcfde7787e2c 100644
@@ -695,6 +695,9 @@ retry_transaction:
                          GCSPRINTF("%s/control/feature-s4", dom_path),
                          rwperm, ARRAY_SIZE(rwperm));
      }
+    libxl__xs_mknod(gc, t,
+                    GCSPRINTF("%s/control/sysrq", dom_path),
+                    rwperm, ARRAY_SIZE(rwperm));
      libxl__xs_mknod(gc, t,
                      GCSPRINTF("%s/device/suspend/event-channel", 
 dom_path),
                      rwperm, ARRAY_SIZE(rwperm));
Quoted 1 line
Quoted 6 lines
Quoted 4 lines

I suspect the best (/least bad) thing to do here is formally introduce feature-ballon as a permitted node, and have the toolstack initialise it to "" like we do with all other nodes, after which TrueNAS ought to be able to set it successfully and not touch it a second time.

+1. This would match how libxl already deal "feature-s3" & co.

So, I will file a bug against truenas anyways, but are you going to alter the xenstore/toolstack ? In that case it may be good to tell them at the same time.

Thanks all,

Kind regards,

zithro/Cyril

#5 lore raw
Quoted 17 lines · zithro

Hi,

[ snipped for brevity, report summary:
XAPI daemon in domU tries to write to a non-existent xenstore node in a non-XAPI dom0 ]

Quoted 2 lines · Yann Dirson

Is there anything besides XAPI using this node, or the other data published by xe-daemon?

On my vanilla Xen (ie. non-XAPI), I have no node about "balloon"-ing in xenstore (either dom0 or domU nodes, but I'm not using ballooning in both).

Quoted 2 lines

Maybe the original issue is just that there is no reason to have xe-guest-utilities installed in this setup?

Quoted 8 lines

That's what I thought as I'm not using XAPI, so maybe the problem should only be addressed to the truenas team ? I posted on their forum but got no answer.
I killed the 'xe-daemon' in both setups without loss of functionality.

My wild guess is that 'xe-daemon', 'xe-update-guest-attrs' and all 'xenstore* commands' are leftovers from when Xen was working as a dom0 under FreeBSD (why would a *domU* have them ?).

That would not be correct: xenstore* are useful in guests, should you want to read/write to the XenStore manually or from scripts; xe-deamon and xe-update-guest-attrs both come from xe-guest-utilities 6.x, which is really a domU tool as well, but is there to support XAPI in dom0.

Best regards,

Signature · 10 lines
Yann Dirson | Vates Platform Developer
XCP-ng & Xen Orchestra - Vates solutions
w: vates.tech | xcp-ng.org | xen-orchestra.com



Yann Dirson | Vates Platform Developer

XCP-ng & Xen Orchestra - Vates solutions
w: vates.fr | xcp-ng.org | xen-orchestra.com
author
#6 lore raw
Quoted 24 lines · Yann Dirson
Quoted 22 lines · zithro

Hi,

[ snipped for brevity, report summary:
XAPI daemon in domU tries to write to a non-existent xenstore node in a non-XAPI dom0 ]

Quoted 2 lines · Yann Dirson

Is there anything besides XAPI using this node, or the other data published by xe-daemon?

On my vanilla Xen (ie. non-XAPI), I have no node about "balloon"-ing in xenstore (either dom0 or domU nodes, but I'm not using ballooning in both).

Quoted 2 lines

Maybe the original issue is just that there is no reason to have xe-guest-utilities installed in this setup?

That's what I thought as I'm not using XAPI, so maybe the problem should only be addressed to the truenas team ? I posted on their forum but got no answer.
I killed the 'xe-daemon' in both setups without loss of functionality.

Quoted 6 lines
Quoted 3 lines

My wild guess is that 'xe-daemon', 'xe-update-guest-attrs' and all 'xenstore* commands' are leftovers from when Xen was working as a dom0 under FreeBSD (why would a *domU* have them ?).

That would not be correct: xenstore* are useful in guests, should you want to read/write to the XenStore manually or from scripts;

Didn't know that, can you give some use cases (or URLs) for which it is useful, with or without XAPI ?
I've read xenstore* man pages and could not infer a use case.
Although I may already see some : updating ballooned memory values, or as Julien Grall pointed out, updating "feature-s3/4" values ?

PS: small mistake in "man/xenstore-write.1.html" (from at least 4.14, and onward), the synopsis reads "xenstore-read" ieof "xenstore-read". Also, the -s option disappeared from unstable, although it may be expected. I don't know it's purpose either.

Quoted 2 lines

xe-deamon and xe-update-guest-attrs both come from xe-guest-utilities 6.x, which is really a domU tool as well, but is there to support XAPI in dom0.

I checked on freshports, this is effectively the last version in FreeBSD, hence FreeNAS (although the version number hasn't been updated since 2020, despite updates, so it's not clear which version I'm using).

So next question is: shouldn't the installer detect if running on a XAPI Xen or not ? I imagine it's feasible, maybe via XAPI-specific xenstore nodes ?

Have a nice evening

#7 lore raw
Quoted 29 lines · zithro
Quoted 28 lines · Yann Dirson
Quoted 25 lines · zithro

Hi,

[ snipped for brevity, report summary:
XAPI daemon in domU tries to write to a non-existent xenstore node in a non-XAPI dom0 ]

Quoted 2 lines · Yann Dirson

Is there anything besides XAPI using this node, or the other data published by xe-daemon?

On my vanilla Xen (ie. non-XAPI), I have no node about "balloon"-ing in xenstore (either dom0 or domU nodes, but I'm not using ballooning in both).

Quoted 2 lines

Maybe the original issue is just that there is no reason to have xe-guest-utilities installed in this setup?

That's what I thought as I'm not using XAPI, so maybe the problem should only be addressed to the truenas team ? I posted on their forum but got no answer.
I killed the 'xe-daemon' in both setups without loss of functionality.

My wild guess is that 'xe-daemon', 'xe-update-guest-attrs' and all 'xenstore* commands' are leftovers from when Xen was working as a dom0 under FreeBSD (why would a *domU* have them ?).

Quoted 8 lines
Quoted 2 lines

That would not be correct: xenstore* are useful in guests, should you want to read/write to the XenStore manually or from scripts;

Didn't know that, can you give some use cases (or URLs) for which it is useful, with or without XAPI ?
I've read xenstore* man pages and could not infer a use case. Although I may already see some : updating ballooned memory values, or as Julien Grall pointed out, updating "feature-s3/4" values ?

You can get other examples in
https://xenbits.xen.org/docs/unstable/misc/xenstore-paths.html#domain-controlled-paths

Quoted 3 lines

PS: small mistake in "man/xenstore-write.1.html" (from at least 4.14, and onward), the synopsis reads "xenstore-read" ieof "xenstore-read".

Patch sent, thanks.

Quoted 2 lines

Also, the -s option disappeared from unstable, although it may be expected. I don't know it's purpose either.

See
https://github.com/xen-project/xen/commit/c65687ed16d2289ec91036ec2862a4b4bd34ea4f

Best regards,

Signature · 10 lines
Yann Dirson | Vates Platform Developer
XCP-ng & Xen Orchestra - Vates solutions
w: vates.tech | xcp-ng.org | xen-orchestra.com



Yann Dirson | Vates Platform Developer

XCP-ng & Xen Orchestra - Vates solutions
w: vates.fr | xcp-ng.org | xen-orchestra.com
author
#8 lore raw
Quoted 30 lines · Yann Dirson
Quoted 29 lines · zithro
Quoted 28 lines · Yann Dirson
Quoted 25 lines · zithro

Hi,

[ snipped for brevity, report summary:
XAPI daemon in domU tries to write to a non-existent xenstore node in a non-XAPI dom0 ]

Quoted 2 lines · Yann Dirson

Is there anything besides XAPI using this node, or the other data published by xe-daemon?

On my vanilla Xen (ie. non-XAPI), I have no node about "balloon"-ing in xenstore (either dom0 or domU nodes, but I'm not using ballooning in both).

Quoted 2 lines

Maybe the original issue is just that there is no reason to have xe-guest-utilities installed in this setup?

That's what I thought as I'm not using XAPI, so maybe the problem should only be addressed to the truenas team ? I posted on their forum but got no answer.
I killed the 'xe-daemon' in both setups without loss of functionality.

My wild guess is that 'xe-daemon', 'xe-update-guest-attrs' and all 'xenstore* commands' are leftovers from when Xen was working as a dom0 under FreeBSD (why would a *domU* have them ?).

Quoted 8 lines
Quoted 5 lines
Quoted 2 lines

That would not be correct: xenstore* are useful in guests, should you want to read/write to the XenStore manually or from scripts;

Didn't know that, can you give some use cases (or URLs) for which it is useful, with or without XAPI ?

You can get other examples in
https://xenbits.xen.org/docs/unstable/misc/xenstore-paths.html#domain-controlled-paths

Thanks, I should pay more attention to headings ;)
From the comparison between the docs and the xe-daemon, I saw some inconsistencies.
I decided to post a bug report in TrueNAS bug tracker :
https://ixsystems.atlassian.net/browse/NAS-121872
(It's a bit messy though, /me not proud).
I didn't check if FreeBSD and TrueNAS do some changes from upstream, but it may be of interest for Citrix devs too ? Apologizes in advance for mistakes due to misunderstanding/noobiness.

Quoted 3 lines
Quoted 2 lines

PS: small mistake in "man/xenstore-write.1.html" (from at least 4.14, and onward), the synopsis reads "xenstore-read" ieof "xenstore-read".

Patch sent, thanks.

No prob and happy to help back !
(@Yann: please tell that to your colleague C. Schultz, so he's more inclined to lemme write articles for the Xen docs ^_^).

Quoted 5 lines
Quoted 2 lines

Also, the -s option disappeared from unstable, although it may be expected. I don't know it's purpose either.

See
https://github.com/xen-project/xen/commit/c65687ed16d2289ec91036ec2862a4b4bd34ea4f

Ah yes, understood.
To complete the commit, I found a few other places where "-s" has not been removed from "xenstore_client.c", in func "usage()" :

Example for line 97, diff style:
- errx(1, "Usage: %s %s[-h] [-p] [-s] [-R] key [...]", progname, mstr);
+ errx(1, "Usage: %s %s[-h] [-p] [-R] key [...]", progname, mstr);

Same deletions needed for lines: 100, 103, 109, 112, 115.

KR,
zithro/Cyril

Acked-by Wei Liu
#9 lore raw
In reply to Andrew Cooper

Hi Andrew,

Quoted 76 lines · Andrew Cooper
Quoted 61 lines · zithro

Hi all,

this is what I have in "xenstored-access.log" in dom0 :

[20230411T23:48:27.917Z]  D5         write     control/feature-balloon 1 [20230411T23:48:27.917Z]  D5         error     EACCES [20230411T23:48:27.923Z]  D5         write     data/updated Wed Apr 12 01:48:27 CEST 2023

It happens once each minute, on two different hosts, both amd64. (both hosts using the same config, only the hardware differs).

I tried looking up for a similar bug, but didn't find one. I apologize in advance if this error is known, and if this is not the place to report this !

-----------------------
Technical infos
-----------------------
dom0s:

Debian stable, kernel 5.10.0-21-amd64
Xen 4.14.5
xl.conf has : autoballoon="0" GRUB_CMDLINE_XEN="dom0_mem=2048M,max:2048M dom0_max_vcpus=4 dom0_vcpus_pin loglvl=all guest_loglvl=all ucode=scan iommu=verbose" Running "xenstore-ls -f -p | grep balloon" returns no result
-----------------------
domUs (D5 in above logs):

HVM TrueNAS Core, based on FreeBSD 13.1-RELEASE-p7
(it happened also on previous FreeBSD realeases, but don't remember when it started, logs have been filled and rotated).
In cfg files, using either the same value for "memory" and "maxmem" or only setting "memory" give the same results.

What's strange is that I have xen* commands in FreeNAS :

xen-detect        xenstore-control  xenstore-ls       xenstore-watch xenstore          xenstore-exists   xenstore-read     xenstore-write xenstore-chmod    xenstore-list     xenstore-rm

root@truenas[~]# xenstore-ls
xenstore-ls: xs_directory (/): Permission denied
root@truenas[~]# ps aux
root   [...]     0:36.98 [xenwatch]
root   [...]     0:01.01 [xenstore_rcv]
root   [...]     0:00.00 [balloon]
root   [...]     0:01.74 /bin/sh /usr/local/sbin/xe-daemon -p
/var/run/xe-daemon.pid
[...]

The xe-daemon looks strange also, I don't use XenServer/XCP-ng, only "raw" Xen.
And this script which hand

I also use PFsense domUs (based on FreeBSD), but they don't exhibit this behaviour (ie. no xenstore access error in dom0, no xen* commands in domU).

Quoted 5 lines

So is this a problem with TrueNAS rather than with Xen ? If so I apologize for wasting your time.

Thanks, have a nice day !
(and as it's my first post here: thx for Xen, it rocks)

Hello,

(Leaving the full report intact so CC'd people can see it whole)

Yes, it is TrueNAS trying to re-write that file every minute.  It appears that TrueNAS has inherited (from debian?) a rather old version of https://github.com/xenserver/xe-guest-utilities/

Quoted 6 lines

https://xenbits.xen.org/docs/unstable/misc/xenstore-paths.html doesn't list feature-balloon as a permitted feature node.

But, I suspect that it used to be the case that guests could write arbitrary feature nodes, and I suspect we tightened the permissions in a security fix to reduce worst-case memory usage of xenstored.

From a brief look, this is very similar to the patch below that was sent 3 years ago. I bet no-one ever tested the driver against libxl.

commit 30a970906038

Author: Vitaly Kuznetsov <[email protected]>
Date:   Tue Sep 4 13:39:29 2018 +0200

libxl: create control/sysrq xenstore node

'xl sysrq' command doesn't work with modern Linux guests with the
following
message in guest's log:

xen:manage: sysrq_handler: Error -13 writing sysrq in control/sysrq

xenstore trace confirms:

IN 0x24bd9a0 20180904 04:36:32 WRITE (control/sysrq ) OUT 0x24bd9a0 20180904 04:36:32 ERROR (EACCES )

The problem seems to be in the fact that we don't pre-create
control/sysrq
xenstore node and libxl_send_sysrq() doing libxl__xs_printf()
creates it as
read-only. As we want to allow guests to clean 'control/sysrq'
after the
requested action is performed, we need to make this node writable.

tools/libxl/libxl_create.c +3 -0
index 60676304e9b5..dcfde7787e2c 100644
@@ -695,6 +695,9 @@ retry_transaction:
                         GCSPRINTF("%s/control/feature-s4", dom_path),
                         rwperm, ARRAY_SIZE(rwperm));
     }
+    libxl__xs_mknod(gc, t,
+                    GCSPRINTF("%s/control/sysrq", dom_path),
+                    rwperm, ARRAY_SIZE(rwperm));
     libxl__xs_mknod(gc, t,
                     GCSPRINTF("%s/device/suspend/event-channel", 

dom_path),

                     rwperm, ARRAY_SIZE(rwperm));
Quoted 5 lines

I suspect the best (/least bad) thing to do here is formally introduce feature-ballon as a permitted node, and have the toolstack initialise it to "" like we do with all other nodes, after which TrueNAS ought to be able to set it successfully and not touch it a second time.

+1. This would match how libxl already deal "feature-s3" & co.

Cheers,

Signature · 1 line
Julien Grall