From nobody Sun Dec 22 01:39:23 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) client-ip=192.237.175.120; envelope-from=xen-devel-bounces@lists.xenproject.org; helo=lists.xenproject.org; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; dmarc=pass(p=reject dis=none) header.from=citrix.com ARC-Seal: i=1; a=rsa-sha256; t=1727253807; cv=none; d=zohomail.com; s=zohoarc; b=SEyN6rlW93fMbsMKZJ4UH8Tnt7bO26ae3FDbR5gwNOOZPtEvxRDvTfSO+Ms7K63SMwLe8PMhTi2pqgB0RN2qvA4FuMtYqBPY1ftBwA677Fb8ngk5+EA/aU5BsFy4J8T+aW8w8IckCMLzsXxD+kUN+unIzDqGArG+qRLG4RLMuKU= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1727253807; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=nnMSClB/JlHEd0hi+6Yy8qVmR2fgY2lFCm5wFEZMF2U=; b=M8h+DEIyamXp4+q8qIP2X9Nvfn0NUFGjscVDum5InN5PexVFMcns/nncNvzAPXQSBknvPPUswbHkvNd6qpfGh8ePCtYwkl4nljKOjMlfaqWrVwrXuG2tinlP92pSab9ru+mT78e3vIxXZZKWb201hJqCWIcXo03oVmJYTvqiyfY= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; dmarc=pass header.from= (p=reject dis=none) Return-Path: Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) by mx.zohomail.com with SMTPS id 1727253807540684.6634885931178; Wed, 25 Sep 2024 01:43:27 -0700 (PDT) Received: from list by lists.xenproject.org with outflank-mailman.803574.1214245 (Exim 4.92) (envelope-from ) id 1stNc4-0005dz-W7; Wed, 25 Sep 2024 08:43:08 +0000 Received: by outflank-mailman (output) from mailman id 803574.1214245; Wed, 25 Sep 2024 08:43:08 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1stNc4-0005dS-Nl; Wed, 25 Sep 2024 08:43:08 +0000 Received: by outflank-mailman (input) for mailman id 803574; Wed, 25 Sep 2024 08:43:07 +0000 Received: from se1-gles-flk1-in.inumbo.com ([94.247.172.50] helo=se1-gles-flk1.inumbo.com) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1stNc3-0005NX-R3 for xen-devel@lists.xenproject.org; Wed, 25 Sep 2024 08:43:07 +0000 Received: from mail-ej1-x62b.google.com (mail-ej1-x62b.google.com [2a00:1450:4864:20::62b]) by se1-gles-flk1.inumbo.com (Halon) with ESMTPS id 2f257778-7b1a-11ef-99a2-01e77a169b0f; Wed, 25 Sep 2024 10:43:06 +0200 (CEST) Received: by mail-ej1-x62b.google.com with SMTP id a640c23a62f3a-a8a7596b7dfso116107866b.0 for ; Wed, 25 Sep 2024 01:43:06 -0700 (PDT) Received: from localhost ([213.195.124.163]) by smtp.gmail.com with ESMTPSA id a640c23a62f3a-a9392f54141sm183645366b.83.2024.09.25.01.43.04 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 25 Sep 2024 01:43:05 -0700 (PDT) X-Outflank-Mailman: Message body and most headers restored to incoming version X-BeenThere: xen-devel@lists.xenproject.org List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Errors-To: xen-devel-bounces@lists.xenproject.org Precedence: list Sender: "Xen-devel" X-Inumbo-ID: 2f257778-7b1a-11ef-99a2-01e77a169b0f DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=citrix.com; s=google; t=1727253785; x=1727858585; darn=lists.xenproject.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=nnMSClB/JlHEd0hi+6Yy8qVmR2fgY2lFCm5wFEZMF2U=; b=Ry1waOanimGHbuARzKfPApeBxAfggLOEPjPPb1d2EsX9fo0UIda61dp/k63/MVcsSN aGLHxs4pGdkGX8bgjGyJIHQB+ONFGecH/0VH/nXBtVoL7uJMZMQSavtN01Oer4/wi1kg tULrjZrn+b4rxT7ILRMF2ehtIs8QRz0RAbJCQ= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1727253785; x=1727858585; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=nnMSClB/JlHEd0hi+6Yy8qVmR2fgY2lFCm5wFEZMF2U=; b=AF3y6Z4TpkiG0PwsdZMv7TL0Inl/AVrM2rhnJt/jWB1H3LdEHtEtLC4byqJ2Q0vvhN 6xlIv9ueOQIdvK2PiIioSYwRgaAouO4NU3xKVffYY6yGZH9PZeX2HSgfFv7xWlX3+7bA hvQ/jjXowDxrWMiPj22NyDJZusxWShFuAw27nQIvxh2pJwmpWw2Glyp/cYvI5WbvGe0Y u59p8pxDEEhRfiMWPixC4ZiiWOUTrEd1FA+tUiiuAMx/LjbWw2n9X/7Dh5TeO4xLUqqX RtQsOpL98FtKJ87uorlv9FVheeLFF60vQcXdyVzF4+ylg7xSdQGgIfAf9syzYzIKf37M ypiA== X-Gm-Message-State: AOJu0Yz8ZBVOak6HvOXlWdyAuy3B7x7GxOb9AhOZeaXWfieQbDXs3Xk8 Ros2AsmfaJ7tIYByZYTZeTQ3Byf7ZArmYkNMjZ69rtrjT6Iq6PZCzW0WpkjAetg9uoEFCeRNyg/ q X-Google-Smtp-Source: AGHT+IHkJDPHmXBuT9psZKCEzzfYDng6uBeOeq+mOZpku0Vg3D7V/SVe9mQu0aXanUQbwH0gbitggg== X-Received: by 2002:a17:907:6094:b0:a8a:6db7:665d with SMTP id a640c23a62f3a-a93a170470cmr158573766b.17.1727253785521; Wed, 25 Sep 2024 01:43:05 -0700 (PDT) From: Roger Pau Monne To: xen-devel@lists.xenproject.org Cc: Roger Pau Monne , Ross Lagerwall Subject: [PATCH v2 2/6] xen/livepatch: zero pointer to temporary load buffer Date: Wed, 25 Sep 2024 10:42:35 +0200 Message-ID: <20240925084239.85649-3-roger.pau@citrix.com> X-Mailer: git-send-email 2.46.0 In-Reply-To: <20240925084239.85649-1-roger.pau@citrix.com> References: <20240925084239.85649-1-roger.pau@citrix.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @citrix.com) X-ZM-MESSAGEID: 1727253808149116600 The livepatch_elf_sec data field points to the temporary load buffer, it's = the load_addr field that points to the stable loaded section data. Zero the da= ta field once load_addr is set, as it would otherwise become a dangling pointer once the load buffer is freed. No functional change intended. Signed-off-by: Roger Pau Monn=C3=A9 --- Changes since v1: - New in this version. --- xen/common/livepatch.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/xen/common/livepatch.c b/xen/common/livepatch.c index df41dcce970a..87b3db03e26d 100644 --- a/xen/common/livepatch.c +++ b/xen/common/livepatch.c @@ -383,6 +383,9 @@ static int move_payload(struct payload *payload, struct= livepatch_elf *elf) } else memset(elf->sec[i].load_addr, 0, elf->sec[i].sec->sh_size); + + /* Avoid leaking pointers to temporary load buffers. */ + elf->sec[i].data =3D NULL; } } =20 --=20 2.46.0