From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 89DA22459C4; Tue, 20 May 2025 13:56:21 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1747749381; cv=none; b=I5+U+Qo3ZFuudmqIirizUdSuVScWKACmCB+VvVPibzg14hjSpq1a4dHMAGZohWRb/P5w4HY9wQy4j23ikMcKRVLn2B0I3hH86SaMsVHeDPWhXmj/2AU5ZLhS/yxe49o3jNx+PKHtv3eMuYPVvY7LdwscC58xxTqH2GiG0ofzmWo= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1747749381; c=relaxed/simple; bh=4ubUthK49Sp3mkO7AL+/eHYpZMlPHY4R02bVOtJrYCA=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=nRRupivHq5IBrogbeZnN3toH90UMxtt7pzWM6cWpqXmR40+qBvgBNPiBE+3HNzJNqKg1lBiaS71BUDNB7vDANE8OXIh7YTnxof8x5f24dyDhq/1b5yS4WZ3AscQ6o0iA44twgYsn+kGhlwbyPeAlK0DOVTonj8t5fTGEw9IwvTk= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=IzQaXQ3O; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b="IzQaXQ3O" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 1B043C4CEEB; Tue, 20 May 2025 13:56:20 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1747749381; bh=4ubUthK49Sp3mkO7AL+/eHYpZMlPHY4R02bVOtJrYCA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=IzQaXQ3O2KGu3o7/TBPDSZfF6JA/Z32HCSdXYlYpv7dsEpLVV0rvFwNnoTYq7w/2P /Jl1BIkLn7470rZsOKTOVTC/kQRBfzdJLOEaU5l9PGDIogavNfkn2WYtYsgDnLYrgj csDibiWF269PSXqigdv0m4wTTQutC8Hf7BVZDeFA= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, Eric Biederman , Alexander Viro , Christian Brauner , linux-fsdevel@vger.kernel.org, linux-mm@kvack.org, Pedro Falcato , Sebastian Ott , Kees Cook , Sasha Levin Subject: [PATCH 6.1 03/97] binfmt_elf: elf_bss no longer used by load_elf_binary() Date: Tue, 20 May 2025 15:49:28 +0200 Message-ID: <20250520125800.798369981@linuxfoundation.org> X-Mailer: git-send-email 2.49.0 In-Reply-To: <20250520125800.653047540@linuxfoundation.org> References: <20250520125800.653047540@linuxfoundation.org> User-Agent: quilt/0.68 X-stable: review X-Patchwork-Hint: ignore Precedence: bulk X-Mailing-List: stable@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 6.1-stable review patch. If anyone has any objections, please let me know. ------------------ From: Kees Cook [ Upstream commit 8ed2ef21ff564cf4a25c098ace510ee6513c9836 ] With the BSS handled generically via the new filesz/memsz mismatch handling logic in elf_load(), elf_bss no longer needs to be tracked. Drop the variable. Cc: Eric Biederman Cc: Alexander Viro Cc: Christian Brauner Cc: linux-fsdevel@vger.kernel.org Cc: linux-mm@kvack.org Suggested-by: Eric Biederman Tested-by: Pedro Falcato Signed-off-by: Sebastian Ott Link: https://lore.kernel.org/r/20230929032435.2391507-2-keescook@chromium.org Signed-off-by: Kees Cook Stable-dep-of: 11854fe263eb ("binfmt_elf: Move brk for static PIE even if ASLR disabled") Signed-off-by: Sasha Levin --- fs/binfmt_elf.c | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/fs/binfmt_elf.c b/fs/binfmt_elf.c index ea2968d343bb6..2672b9dca1af0 100644 --- a/fs/binfmt_elf.c +++ b/fs/binfmt_elf.c @@ -855,7 +855,7 @@ static int load_elf_binary(struct linux_binprm *bprm) unsigned long error; struct elf_phdr *elf_ppnt, *elf_phdata, *interp_elf_phdata = NULL; struct elf_phdr *elf_property_phdata = NULL; - unsigned long elf_bss, elf_brk; + unsigned long elf_brk; int retval, i; unsigned long elf_entry; unsigned long e_entry; @@ -1047,7 +1047,6 @@ static int load_elf_binary(struct linux_binprm *bprm) if (retval < 0) goto out_free_dentry; - elf_bss = 0; elf_brk = 0; start_code = ~0UL; @@ -1210,8 +1209,6 @@ static int load_elf_binary(struct linux_binprm *bprm) k = elf_ppnt->p_vaddr + elf_ppnt->p_filesz; - if (k > elf_bss) - elf_bss = k; if ((elf_ppnt->p_flags & PF_X) && end_code < k) end_code = k; if (end_data < k) @@ -1223,7 +1220,6 @@ static int load_elf_binary(struct linux_binprm *bprm) e_entry = elf_ex->e_entry + load_bias; phdr_addr += load_bias; - elf_bss += load_bias; elf_brk += load_bias; start_code += load_bias; end_code += load_bias; -- 2.39.5