From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-dl1-f53.google.com (mail-dl1-f53.google.com [74.125.82.53]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 779DB1D63E4 for ; Sun, 3 May 2026 19:16:24 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=74.125.82.53 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1777835785; cv=none; b=clUyzX34YWt00R0mom5srjHq6/6+p9hdAxv6zEcQ9Ld7M7nHWIUsObcQP3bMYggO6eaZDJHrGudeX+RqHXsJgfx9cxTS7zGu50FfV5Yv+0G9Xl1PnK4Fi/DFt4y8jPSV6+ATCFZVFeKMfvSIrbJgWH/RLDn/Cnxm2eXuIB1ccWA= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1777835785; c=relaxed/simple; bh=Gzr/9hoApoPjE+iOd2oacl9rnsnxZ8mfdbROgd/dlcU=; h=From:To:Cc:Subject:Date:Message-ID:MIME-Version; b=FhxvHhL6UUM0jfeQ8TVqSrbuiCPJli8jl0B8U9cjkVa2Y/iNUD7X4t3cJaFWY1r7Mc5XuoDpWzEO/4VCr4BRmHw4mWwvkYvSibVrCf+azijXhS9+fD547/yKKBS/2FrDnuPsDEyEMTBxjFkAMZ7OS/x2N9BkyKzYyzQEwiQJGFk= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=s7GwlWzc; arc=none smtp.client-ip=74.125.82.53 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="s7GwlWzc" Received: by mail-dl1-f53.google.com with SMTP id a92af1059eb24-12dfbcc0703so2267203c88.1 for ; Sun, 03 May 2026 12:16:24 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20251104; t=1777835783; x=1778440583; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=N9HoKoE94yHIyMJc+3K7SaJvsbH2DQfU7gUwfDYrgEE=; b=s7GwlWzcaGpZEX8PIvjisJj093dH+Ij76iAEs6DjLcfIH0PVcaTyxzq24Gxd7rWahQ sLtYGCrvT8Cxem+bw45SEukEfFIrI2A0ummUXhPwM7y6My+FAJ3vfnVJIx4f15eppGeS 0zIi8SLkk8sj+U8vdyTsgyLNAEFRcgUg9p105UGW6IVGG6suICg4qbCO2b4dKlGav2lq WGub8gU6M2LWQvdab0k9k0ZKjO4t1mcpYlPc59bLWCxIlO7swU2Coxo4vGXcLNSc7rS7 6yju1unSaSkMPxi9h3eGDvP4WVtc0CYK57gKOp2kTNu3aYnoAWKnGilXyXRFOPJwprPZ 3F9w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1777835783; x=1778440583; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-gg:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=N9HoKoE94yHIyMJc+3K7SaJvsbH2DQfU7gUwfDYrgEE=; b=rGTIzMCZEUjUah6AP/TvIG5yQDPxTLDoJaeMPA/o7lOML/4PyGJ94q70mRKV3Quzae luXc4MhZqYL8UJVCrzPgwJkDOaQzQfOcCUivwJuMnM9rCMQUxlLDNER/TRbHlrpjc8JA ivkerLVO35FI3JRoDtrtrbwJz+3MKY3bQJgCBGk3x2awd4RoN8PYOQOvsVYbS7fIs90T B4tXKzd+1d2lPIDVBMNi+QdKdmh6tSP9csIswKz0AsyPZqEnfZCKcjTg8lHnzyMcBnMZ +oWEvXMFz8AnbqROxi4HpfS6GHliy8cB/N1e5r2FHMSYwe/g6Fi8mQSGZz2YrXPOGSMi Hpow== X-Forwarded-Encrypted: i=1; AFNElJ+8Drpm8FSO/rUF6blB5fHHcev2oZS1g9OE7qoiCjrAEPQWMRqc1TTjAjg71ldyptnyi14v/XAdIoLRsI0=@vger.kernel.org X-Gm-Message-State: AOJu0YwJZwbqdMfGgKj281xJRFIDTNEPXAR2ePAu4b+OxK19Ce0lVSs0 YnXfzzZrS1ieihZ5roHyGfTD46ODazCKrudavPFiVG+M1MbLZ2E3OC4q X-Gm-Gg: AeBDievdO82xeBcRRd6XnzDEFuPYNze/7MtMRxd25bl54guBYFsIUju/caHKncqbpso d5ej4/N9Km7SVXt/pLkkBZTuiXDKfBETp6M7PTLB9qBZUpp/eN2Dc85hoMVonxSFdg5EEUKTGY3 G4f7y+PxMM2m0MY74zWx8z/w5ZAAeCorw/azgfGnVBNaxApQu5/K0Wf0JoNtICuDRZQyo9IMIH7 fNiD2HrimLYyhCuNxCTCLwM/ge1IUePrq8uRYvwSKX8Oi2ytLWCMdTqJ/U47v81kztJ4rYQwRA6 +5BxAeb3UYRH+VLSV3ySHDFVJvx3N7/Rw/9kABSZtcOMkbHgtunbb3mlcHLvcj4/hT9DISwulEH tL0OI5Pn7ASPcuFVh5rJ+9rC1sKfrDhWy7jxaCnrEAyEf8Zwi+0II8EFJAqR6okzZcngsg7cmM2 Ziw1yxPSSupvdVeC6Qoz0jwxx7VjBaHeKYRkuwIfdgbcGp X-Received: by 2002:a05:7022:660c:b0:12d:b993:c68f with SMTP id a92af1059eb24-12dfd7a0f5cmr3295115c88.4.1777835783228; Sun, 03 May 2026 12:16:23 -0700 (PDT) Received: from fedora ([187.120.154.237]) by smtp.gmail.com with ESMTPSA id a92af1059eb24-12df827a73fsm11230415c88.1.2026.05.03.12.16.20 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 03 May 2026 12:16:22 -0700 (PDT) From: Guilherme Giacomo Simoes To: luto@kernel.org, tglx@kernel.org, mingo@redhat.com, bp@alien8.de, dave.hansen@linux.intel.com, hpa@zytor.com Cc: x86@kernel.org, linux-kernel@vger.kernel.org, Guilherme Giacomo Simoes Subject: [PATCH] x86/vdso: fix incorrect size in munmap during map_vdso failure Date: Sun, 3 May 2026 16:16:09 -0300 Message-ID: <20260503191609.551817-1-trintaeoitogc@gmail.com> X-Mailer: git-send-email 2.52.0 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit In the map_vdso function, if a failure occurs during the installation of the VVAR mappings, the error path attempts to clean up previously allocated mappings using do_munmap. However, the cleanup for the VVAR mapping was incorrectly using image->size (the size of the vDSO text) instead of the actual size allocated for the VVAR area. Replace the incorrect image->size parameter with the constant VDSO_NR_PAGES * PAGE_SIZE in the do_munmap call. Ensure the unmap size exactly matches the size used during the vdso_install_vvar_mapping() phase to provide a symmetrical and complete teardown of the memory region. Signed-off-by: Guilherme Giacomo Simoes --- arch/x86/entry/vdso/vma.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/arch/x86/entry/vdso/vma.c b/arch/x86/entry/vdso/vma.c index a6bfcc8243cd..d903bce24f15 100644 --- a/arch/x86/entry/vdso/vma.c +++ b/arch/x86/entry/vdso/vma.c @@ -178,7 +178,7 @@ static int map_vdso(const struct vdso_image *image, unsigned long addr) if (IS_ERR(vma)) { ret = PTR_ERR(vma); do_munmap(mm, text_start, image->size, NULL); - do_munmap(mm, addr, image->size, NULL); + do_munmap(mm, addr, VDSO_NR_PAGES * PAGE_SIZE, NULL); goto up_fail; } -- 2.52.0