[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [XEN PATCH v9 02/24] xen/arm: add TEE teardown to arch_domain_teardown()


  • To: Jens Wiklander <jens.wiklander@xxxxxxxxxx>, xen-devel@xxxxxxxxxxxxxxxxxxxx
  • From: Andrew Cooper <andrew.cooper3@xxxxxxxxxx>
  • Date: Wed, 12 Jul 2023 09:31:35 +0100
  • Arc-authentication-results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=citrix.com; dmarc=pass action=none header.from=citrix.com; dkim=pass header.d=citrix.com; arc=none
  • Arc-message-signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=yiHAcxPrPiVdJ2KScPsOSAUGvxMRX9irUEVSjSMsD5Q=; b=ltOnyxAz/Fz85C1w/y2/iO1xiDJuUJjDLYyS8EnlKDzgK20jgu+tIvvSx7N8K/RuZhj+uAsM9sU8CXuqena5Ip+9xfYesoi4DrATqFa4fITWOjUybYmu6V2B6SmeXnhloGLn4wr1SYL3oGkcbgpUs/GJKgYCX7b6bKTDlQd0Db48tt0sdfgJEKCUTRe3AaIP7oI/2oNvFwbLMV29OLwHqdEack6FNrWhIBAxwqyIlDJkFUBagRX9fn82QZCyOoUupF7MBVxmEtBEqDwThWJyNBjiPYE+09RAdtM7fp1EomNW5qC9yHDjk33aQDwywh/YCqYUvlz/F4/2MGn6urtPmQ==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=nesiVjjz9T67/8sL+qW+m1QuqEg/SpbagNCOiX2OnNn7lGRPBBU6BKDBq2WzUp8pN+GNKnbGBBqaCdPxcbZmtu9fSQlZVJPNuBj/wd4yZtpammseqd1OGZ0sJCkD9GzUu5gKAeV4FKvq64935zimekMEBEZ0Fg4rEPEIlJeNzWVR8v5uPxbPPECMPEkeVD9oCMw1ickAI8b0go1BB0d3cpInT53rgmSKdCj2OKivqy2GvwRoqRlnP2GzKr6B1LS4shtplxJjBNFWPMG9x/jhyFkngP6/baMywsWqtM1LrHKGZjK99t/MZZJ1rT0JHKdzYgW/1I3quixzXaqiAotViA==
  • Authentication-results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=citrix.com;
  • Cc: Stefano Stabellini <sstabellini@xxxxxxxxxx>, Julien Grall <julien@xxxxxxx>, Volodymyr Babchuk <Volodymyr_Babchuk@xxxxxxxx>, Bertrand.Marquis@xxxxxxx, Anthony PERARD <anthony.perard@xxxxxxxxxx>, Juergen Gross <jgross@xxxxxxxx>, Wei Liu <wl@xxxxxxx>, Marc Bonnici <marc.bonnici@xxxxxxx>, Achin Gupta <achin.gupta@xxxxxxx>
  • Delivery-date: Wed, 12 Jul 2023 08:32:07 +0000
  • Ironport-data: A9a23:bYsrgKLiX49OClTTFE+RnpUlxSXFcZb7ZxGr2PjKsXjdYENShWBTx mQaC2iFOv3Za2anLYpza9yz/UtSsJPcnYcwSAZlqX01Q3x08seUXt7xwmUcnc+xBpaaEB84t ZV2hv3odp1coqr0/0/1WlTZhSAgk/rOHvykU7Ss1hlZHWdMUD0mhQ9oh9k3i4tphcnRKw6Ws Jb5rta31GWNglaYCUpKrfrawP9TlK6q4mhA4QVkPaojUGL2zBH5MrpOfcldEFOgKmVkNrbSb /rOyri/4lTY838FYj9yuu+mGqGiaue60Tmm0hK6aYD76vRxjnVaPpIAHOgdcS9qZwChxLid/ jnvWauYEm/FNoWU8AgUvoIx/ytWZcWq85efSZSzXFD6I+QrvBIAzt03ZHzaM7H09c5+WE8W+ +U0dAsUTT+8q8G6zLKLaOxF05FLwMnDZOvzu1lG5BSAV7MKZM6GRK/Ho9hFwD03m8ZCW+7EY NYUYiZuaxKGZABTPlAQC9Q1m+LAanvXKmUE7g7K4/dmpTGNnWSd05C0WDbRUvWMSd9YgQCzo WXe8n6iKhobKMae2XyO9XfEaurnxHqmCNtLRebmnhJsqFed2UUrU0c3bgaypcO9sXO1Cvt5d kNBr0LCqoB3riRHVOLVXRC+uzibvx0YUtxcHvcS7ACLw7DTpQGDCQAsXjNHLdArqsIybTgrz UOS2cPkAyR1t7+YQm7b8a2bxRupIjQcJ2IGYS4CTCMG7sPlrYV1iQjAJv5hDaq0g9vdCTz2h TeQo0AWubIXisIa0rShynrOiTmsu5vhQxY840PcWWfNxil0fpK/boqkr33S9+9dLZ2xR0OE+ nMDnqC27u8UCoqWvDeQW+hLF7asj96aNBXMjFgpGIMunxyo8mSoO4pX5jd/L0ZBO9wBPzTuZ Sf7sAhR5ZkVM2aycaZfapi0Tc8tyMDd+c/NU/nVap9CZ8Z3fQrepiV2PxfOjibqjVQmlrw5N dGDa8GwAH0GCKNhij2rW+Ma1rxtzSc7rY/Oea3GI92c+eL2TBaopX0tYDNisshRAHu4nTjo
  • Ironport-hdrordr: A9a23:efhKEaHAaDAJPZlCpLqELseALOsnbusQ8zAXP0AYc20yTiW9rb HToB17726ItN91Yh0dcL+7Scy9qB/nhPpICMwqTMiftUrdyRiVxeJZnPHfKl/balXDH7VmpN ddmsFFYbWaZzUb/KWKgjVQUexQu+Vvm5rY/Ns2oU0dKj2CjZsA0+5/MGim+0tNKzVuNN4cHJ qY5s1I4x+hY2l/VLXIOpAcZZmzmzTUruOZXSI7
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>

On 05/07/2023 10:34 am, Jens Wiklander wrote:
> diff --git a/xen/arch/arm/domain.c b/xen/arch/arm/domain.c
> index 15d9709a97d2..18171decdc66 100644
> --- a/xen/arch/arm/domain.c
> +++ b/xen/arch/arm/domain.c
> @@ -795,6 +795,42 @@ fail:
>  
>  int arch_domain_teardown(struct domain *d)
>  {
> +    int ret = 0;
> +
> +    BUG_ON(!d->is_dying);
> +
> +    /* See domain_teardown() for an explanation of all of this magic. */
> +    switch ( d->teardown.arch_val )
> +    {
> +#define PROGRESS(x)                             \
> +        d->teardown.arch_val = PROG_ ## x;      \
> +        fallthrough;                            \
> +    case PROG_ ## x
> +
> +        enum {
> +            PROG_none,
> +            PROG_tee,
> +            PROG_done,
> +        };
> +
> +    case PROG_none:
> +        BUILD_BUG_ON(PROG_none != 0);
> +
> +    PROGRESS(tee):
> +        ret = tee_domain_teardown(d);
> +        if ( ret )
> +            return ret;
> +        break;

This unconditional break isn't correct.

The logic functions right now (because upon hitting return 0, you don't
re-enter this function), but will cease working when you add a new
PROG_*, or when the calling code gets more complicated.

> +
> +    PROGRESS(done):
> +        break;

This needs to be the only break in the switch statement, for it to
behave in the intended manner.

~Andrew



 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.