Skip to contentSkip to conversation

xenstored: Interaction bettwen SET_PERMS and transaction

DISCUSSION Julien Grall 2 participants 5 messages Feb 24, 2023

lore
Share & tools
lore
#0 lore raw

Hi Juergen,

For some internal purpose, I need to write a script that would do the following:

1) Start a transaction
2) Call GET_PERMS
3) Call SET_PERMS with the permission just retrieved
4) Commit the transaction

(Don't ask why :))

This was executed from dom0 on every nodes. In some cases, we noticed that 4) would return -ENOSPC.

When digging through the code, it looks like this is because transaction_fix_domains() (now called acc_fix_domains()) will check that the quota is correct.

The domain is question were over its limit, but given this is called by dom0, I would have expected that it should not never return -ENOSPC (note that a SET_PERMS outside of a transaction would work, but this can't be used our case).

Furthermore, the transaction is not changing any accounting. So I find a bit strange that we would prevent it even if this was run from an unprivileged domain.

Do you know if this issues would be fixed by your current rework?

If not, then I think we at least want to skip the quota check if the domain is privileged.

For non-privileged domain, I am not entirely sure what to do. I was originally thinking to check if cd->nbentry is 0 and then skip the quota check. But this would allow a domain to remove a node and then replace by a new one (I think we still want to forbid that).

What do you think?

Cheers,

Signature · 1 line
Julien Grall
#1 lore raw
Quoted 11 lines · Julien Grall

Hi Juergen,

For some internal purpose, I need to write a script that would do the following:

  1) Start a transaction
  2) Call GET_PERMS
  3) Call SET_PERMS with the permission just retrieved
  4) Commit the transaction

(Don't ask why :))

Quoted 7 lines

This was executed from dom0 on every nodes. In some cases, we noticed that 4) would return -ENOSPC.

When digging through the code, it looks like this is because transaction_fix_domains() (now called acc_fix_domains()) will check that the quota is correct.

The domain is question were over its limit, but given this is called by dom0, I would have expected that it should not never return -ENOSPC (note that a SET_PERMS outside of a transaction would work, but this can't be used our case).

Furthermore, the transaction is not changing any accounting. So I find a bit strange that we would prevent it even if this was run from an unprivileged domain.

You are right. It should only be rejected if nodes are added in the transaction.

Quoted 2 lines

Do you know if this issues would be fixed by your current rework?

I don't think so.

Quoted 2 lines

If not, then I think we at least want to skip the quota check if the domain is privileged.

I'll add something to check quota only for unprivileged domains AND only if nodes have been added in the transaction.

Quoted 2 lines

For non-privileged domain, I am not entirely sure what to do. I was originally thinking to check if cd->nbentry is 0 and then skip the quota check. But this would allow a domain to remove a node and then replace by a new one (I think we still want to forbid that).

Correct. Node creation is the trigger we want.

BTW, current code is really bad, as it would even reject removing a node in a transaction for a domain being above quota after that remove.

Juergen

#2 lore raw
In reply to Julien Grall
Quoted 19 lines · Julien Grall

Hi Juergen,

For some internal purpose, I need to write a script that would do the following:

  1) Start a transaction
  2) Call GET_PERMS
  3) Call SET_PERMS with the permission just retrieved
  4) Commit the transaction

(Don't ask why :))

This was executed from dom0 on every nodes. In some cases, we noticed that 4) would return -ENOSPC.

When digging through the code, it looks like this is because transaction_fix_domains() (now called acc_fix_domains()) will check that the quota is correct.

The domain is question were over its limit, but given this is called by dom0, I would have expected that it should not never return -ENOSPC (note that a SET_PERMS outside of a transaction would work, but this can't be used our case).

Furthermore, the transaction is not changing any accounting. So I find a bit strange that we would prevent it even if this was run from an unprivileged domain.

Quoted 7 lines

Do you know if this issues would be fixed by your current rework?

If not, then I think we at least want to skip the quota check if the domain is privileged.

For non-privileged domain, I am not entirely sure what to do. I was originally thinking to check if cd->nbentry is 0 and then skip the quota check. But this would allow a domain to remove a node and then replace by a new one (I think we still want to forbid that).

What do you think?

Patch sent. Could you please test it with your script?

Juergen

#3 lore raw

Hi Juergen,

Quoted 22 lines · Juergen Gross
Quoted 21 lines · Julien Grall

Hi Juergen,

For some internal purpose, I need to write a script that would do the following:

   1) Start a transaction
   2) Call GET_PERMS
   3) Call SET_PERMS with the permission just retrieved
   4) Commit the transaction

(Don't ask why :))

This was executed from dom0 on every nodes. In some cases, we noticed that 4) would return -ENOSPC.

When digging through the code, it looks like this is because transaction_fix_domains() (now called acc_fix_domains()) will check that the quota is correct.

The domain is question were over its limit, but given this is called by dom0, I would have expected that it should not never return -ENOSPC (note that a SET_PERMS outside of a transaction would work, but this can't be used our case).

Furthermore, the transaction is not changing any accounting. So I find a bit strange that we would prevent it even if this was run from an unprivileged domain.

Do you know if this issues would be fixed by your current rework?

Quoted 7 lines
Quoted 5 lines

If not, then I think we at least want to skip the quota check if the domain is privileged.

For non-privileged domain, I am not entirely sure what to do. I was originally thinking to check if cd->nbentry is 0 and then skip the quota check. But this would allow a domain to remove a node and then replace by a new one (I think we still want to forbid that).

What do you think?

Patch sent. Could you please test it with your script?

Thanks! I will give a try next week and let you know the result.

Cheers,

Signature · 1 line
Julien Grall
#4 lore raw
Quoted 27 lines · Julien Grall

Hi Juergen,

Quoted 24 lines · Juergen Gross
Quoted 23 lines · Julien Grall

Hi Juergen,

For some internal purpose, I need to write a script that would do the following:

   1) Start a transaction
   2) Call GET_PERMS
   3) Call SET_PERMS with the permission just retrieved
   4) Commit the transaction

(Don't ask why :))

This was executed from dom0 on every nodes. In some cases, we noticed that 4) would return -ENOSPC.

When digging through the code, it looks like this is because transaction_fix_domains() (now called acc_fix_domains()) will check that the quota is correct.

The domain is question were over its limit, but given this is called by dom0, I would have expected that it should not never return -ENOSPC (note that a SET_PERMS outside of a transaction would work, but this can't be used our case).

Furthermore, the transaction is not changing any accounting. So I find a bit strange that we would prevent it even if this was run from an unprivileged domain.

Do you know if this issues would be fixed by your current rework?

If not, then I think we at least want to skip the quota check if the domain is privileged.

Quoted 7 lines
Quoted 5 lines
Quoted 3 lines

For non-privileged domain, I am not entirely sure what to do. I was originally thinking to check if cd->nbentry is 0 and then skip the quota check. But this would allow a domain to remove a node and then replace by a new one (I think we still want to forbid that).

What do you think?

Patch sent. Could you please test it with your script?

Thanks! I will give a try next week and let you know the result.

Thanks.

No need to hurry, as I'll be away most of next week (after Monday).

Juergen