[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH] xen/sched: fix potential NULL dereference in sched_move_domain()
- To: Jan Beulich <jbeulich@xxxxxxxx>
- From: Jürgen Groß <jgross@xxxxxxxx>
- Date: Tue, 24 Nov 2026 16:05:26 +0100
- Authentication-results: eu.smtp.expurgate.cloud; dkim=pass header.s=google header.d=suse.com header.i="@suse.com" header.h="Content-Type:In-Reply-To:Autocrypt:From:Content-Language:References:Cc:To:Subject:User-Agent:MIME-Version:Date:Message-ID"
- Autocrypt: addr=jgross@xxxxxxxx; keydata= xsBNBFOMcBYBCACgGjqjoGvbEouQZw/ToiBg9W98AlM2QHV+iNHsEs7kxWhKMjrioyspZKOB ycWxw3ie3j9uvg9EOB3aN4xiTv4qbnGiTr3oJhkB1gsb6ToJQZ8uxGq2kaV2KL9650I1SJve dYm8Of8Zd621lSmoKOwlNClALZNew72NjJLEzTalU1OdT7/i1TXkH09XSSI8mEQ/ouNcMvIJ NwQpd369y9bfIhWUiVXEK7MlRgUG6MvIj6Y3Am/BBLUVbDa4+gmzDC9ezlZkTZG2t14zWPvx XP3FAp2pkW0xqG7/377qptDmrk42GlSKN4z76ELnLxussxc7I2hx18NUcbP8+uty4bMxABEB AAHNH0p1ZXJnZW4gR3Jvc3MgPGpncm9zc0BzdXNlLmNvbT7CwHkEEwECACMFAlOMcK8CGwMH CwkIBwMCAQYVCAIJCgsEFgIDAQIeAQIXgAAKCRCw3p3WKL8TL8eZB/9G0juS/kDY9LhEXseh mE9U+iA1VsLhgDqVbsOtZ/S14LRFHczNd/Lqkn7souCSoyWsBs3/wO+OjPvxf7m+Ef+sMtr0 G5lCWEWa9wa0IXx5HRPW/ScL+e4AVUbL7rurYMfwCzco+7TfjhMEOkC+va5gzi1KrErgNRHH kg3PhlnRY0Udyqx++UYkAsN4TQuEhNN32MvN0Np3WlBJOgKcuXpIElmMM5f1BBzJSKBkW0Jc Wy3h2Wy912vHKpPV/Xv7ZwVJ27v7KcuZcErtptDevAljxJtE7aJG6WiBzm+v9EswyWxwMCIO RoVBYuiocc51872tRGywc03xaQydB+9R7BHPzsBNBFOMcBYBCADLMfoA44MwGOB9YT1V4KCy vAfd7E0BTfaAurbG+Olacciz3yd09QOmejFZC6AnoykydyvTFLAWYcSCdISMr88COmmCbJzn sHAogjexXiif6ANUUlHpjxlHCCcELmZUzomNDnEOTxZFeWMTFF9Rf2k2F0Tl4E5kmsNGgtSa aMO0rNZoOEiD/7UfPP3dfh8JCQ1VtUUsQtT1sxos8Eb/HmriJhnaTZ7Hp3jtgTVkV0ybpgFg w6WMaRkrBh17mV0z2ajjmabB7SJxcouSkR0hcpNl4oM74d2/VqoW4BxxxOD1FcNCObCELfIS auZx+XT6s+CE7Qi/c44ibBMR7hyjdzWbABEBAAHCwF8EGAECAAkFAlOMcBYCGwwACgkQsN6d 1ii/Ey9D+Af/WFr3q+bg/8v5tCknCtn92d5lyYTBNt7xgWzDZX8G6/pngzKyWfedArllp0Pn fgIXtMNV+3t8Li1Tg843EXkP7+2+CQ98MB8XvvPLYAfW8nNDV85TyVgWlldNcgdv7nn1Sq8g HwB2BHdIAkYce3hEoDQXt/mKlgEGsLpzJcnLKimtPXQQy9TxUaLBe9PInPd+Ohix0XOlY+Uk QFEx50Ki3rSDl2Zt2tnkNYKUCvTJq7jvOlaPd6d/W0tZqpyy7KVay+K4aMobDsodB3dvEAs6 ScCnh03dDAFgIq5nsB11j3KPKdVoPlfucX2c7kGNH+LUMbzqV6beIENfNexkOfxHfw==
- Cc: Dario Faggioli <dfaggioli@xxxxxxxx>, George Dunlap <gwd@xxxxxxxxxxxxxx>, Roger Pau Monné <roger.pau@xxxxxxx>, xen-devel@xxxxxxxxxxxxxxxxxxxx
- Delivery-date: Tue, 24 Nov 2026 15:05:36 +0000
- List-id: Xen developer discussion <xen-devel.lists.xenproject.org>
On 24.11.26 15:55, Jan Beulich wrote:
On 24.11.2026 15:45, Jürgen Groß wrote:
On 24.11.26 15:37, Jan Beulich wrote:
On 24.11.2026 15:07, Jürgen Groß wrote:
On 24.11.26 14:57, Jan Beulich wrote:
On 24.11.2026 13:20, Juergen Gross wrote:
If a dying domain has not all of its vcpus filled and it is moved from
a cpupool with gran=socket to one with gran=core,
Why would a dying domain need moving in this way in the first place?
This is for avoiding a zombie domain blocking removal of a cpupool.
Ah, I see. Maybe say "zombie" then in place of just "dying"?
But the moving is done for all dying domains as part of the domain's destroy
process.
Then I guess I'm lost. It's hard to see why for something which is to go
away a complex operation needs doing, always.
Possibly connected to this, ...
--- a/xen/common/sched/core.c
+++ b/xen/common/sched/core.c
@@ -830,10 +830,13 @@ int sched_move_domain(struct domain *d, struct cpupool *c)
if ( unit->unit_id + gran == v->vcpu_id )
unit = unit->next_in_list;
- unit->state_entry_time = old_unit->state_entry_time;
- unit->runstate_cnt[v->runstate.state]++;
- /* Temporarily use old resource assignment */
- unit->res = get_sched_res(new_cpu);
+ if ( unit )
+ {
+ unit->state_entry_time = old_unit->state_entry_time;
+ unit->runstate_cnt[v->runstate.state]++;
+ /* Temporarily use old resource assignment */
+ unit->res = get_sched_res(new_cpu);
+ }
v->sched_unit = unit;
... is this field becoming NULL really okay? Perhaps just for dying domains
it is, but then the original question remains why they would need moving in
the first place.
Not setting it would leave a potential UAF, as the old unit will be freed.
Sure, it needs setting, but setting to NULL when NULL may not work everywhere
wouldn't be much better than leaving a dangling pointer.
If the domain is not dying, the function will return with a negative return
value as soon as the missing vcpu is detected.
But the vCPU / domain / system is in a bad state then, isn't it? Won't this
hit us (hard) later?
This is the reason why I want a domain which could not create all vcpus to
never enter the running state, so the case you are mentioning would never
happen (same goes for the dying domain case, of course).
I don't see how we could enforce that other than creating the vcpus directly
from domain_create(), though. I'm working on a series doing that, but it is
not trivial.
Juergen
Attachment:
OpenPGP_signature.asc
Description: OpenPGP digital signature
|