From patchwork Fri Sep 29 03:24:34 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kees Cook X-Patchwork-Id: 13403637 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id 8532AE743C0 for ; Fri, 29 Sep 2023 03:24:52 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 217BC8D00E6; Thu, 28 Sep 2023 23:24:46 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 1577F8D00E5; Thu, 28 Sep 2023 23:24:46 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id F12098D00E6; Thu, 28 Sep 2023 23:24:45 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0015.hostedemail.com [216.40.44.15]) by kanga.kvack.org (Postfix) with ESMTP id D6CDC8D0002 for ; Thu, 28 Sep 2023 23:24:45 -0400 (EDT) Received: from smtpin19.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay07.hostedemail.com (Postfix) with ESMTP id B0C50160231 for ; Fri, 29 Sep 2023 03:24:45 +0000 (UTC) X-FDA: 81288192930.19.94B91C0 Received: from mail-pj1-f52.google.com (mail-pj1-f52.google.com [209.85.216.52]) by imf02.hostedemail.com (Postfix) with ESMTP id C49DC8000E for ; Fri, 29 Sep 2023 03:24:42 +0000 (UTC) Authentication-Results: imf02.hostedemail.com; dkim=pass header.d=chromium.org header.s=google header.b=ERtiT8cH; dmarc=pass (policy=none) header.from=chromium.org; spf=pass (imf02.hostedemail.com: domain of keescook@chromium.org designates 209.85.216.52 as permitted sender) smtp.mailfrom=keescook@chromium.org ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1695957882; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=+wPEhWpvRY896Xnw5Ev1/y00zI5fAQGyVN5RsYugNn8=; b=22YMaVwYV+Ya+Ok2/mx4g964pHgDvH7IyupPGiZZwQPBlnyRMlSTcBUsZpQCRLKgxQk3hc elWQCth2ACshKaW5QvtyC425JTUJIVeWl8HQe2eeZnfn3WaG9ffLwfTKxvP7NY9/z7YmAR KUIRKqzXLTnDla/wucKSXA+MWJ5AE98= ARC-Authentication-Results: i=1; imf02.hostedemail.com; dkim=pass header.d=chromium.org header.s=google header.b=ERtiT8cH; dmarc=pass (policy=none) header.from=chromium.org; spf=pass (imf02.hostedemail.com: domain of keescook@chromium.org designates 209.85.216.52 as permitted sender) smtp.mailfrom=keescook@chromium.org ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1695957882; a=rsa-sha256; cv=none; b=fwIKFMSq8ufLxvlDMU8SIxIAUBwKWZPYdIWJNLZ8v9gtHLXY29CLwSxBCqUDy3CZYIR7fg 4bH2Kbe08GvubdZJTkaran/UsKXw8eUAcBLYbWJV5pwrswuqs/+syQC5CLDPgeZda965W3 BHlhnXJY97+vG9/SHkbYONucLr2HAV0= Received: by mail-pj1-f52.google.com with SMTP id 98e67ed59e1d1-2774aa96947so8199146a91.2 for ; Thu, 28 Sep 2023 20:24:42 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; t=1695957881; x=1696562681; darn=kvack.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=+wPEhWpvRY896Xnw5Ev1/y00zI5fAQGyVN5RsYugNn8=; b=ERtiT8cH0/eQGlDQDt9MVVuC3DsAV+AOsYYmXuIxuV/os//pahTkcGzo2sDg2cqqBt Us2pfQZ/fdkXFZznnbQa/RGRPEDIzvEV1ZDtKNkB1C3uHrv1mYuqu1En07hZJV5X9EYk SaNPA+yWgUkxRaA02NoKL0KuXUyGGJmM3jv8c= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1695957881; x=1696562681; 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=+wPEhWpvRY896Xnw5Ev1/y00zI5fAQGyVN5RsYugNn8=; b=AMe8nvks84JkTCqisgV2Ut85xhz5GGqFiGOfpZTD0mrJEbt8G2liAMyAw4U9ogcdVZ dwvGeOYNP5wRUktCR/+WBJOy7NrAGyiogj+lgr0fLSCotg08Z8hfGh7WY7RqmHyo9Y84 uRsWfDme3MaG3sIv5gr9uCi4sBWW7c9ntNzdvujHOxbtRqDdA8YrYUFWUCVNjVfY+I9x FVjEF8bfGbZSARwVCZOPnyFp5SR9RAO+UeQB7ex85VYHGFZFm6R+ohxV5kjqzMoNoUOi PzoC7mjcMB7/hiCxrL0Q2mW0kXXLQ7wlBx9q0AlRg62C7lZg5B139kQBlI39gthQ/nPI HOsw== X-Gm-Message-State: AOJu0YwmbTcXNtQb6YO2zRZ6ZozfViOHMGRFcw9V5mSt5zVpapUgB8PN C9HpuCT4gwJPKD47wEoBY4Jlgg== X-Google-Smtp-Source: AGHT+IGrJvdYK0UubFjOkgcsulZp4Iwd9Tt7tIAbT+bREXfQrb6kahqghubh3CtXHQN6f3Ye2DXCOA== X-Received: by 2002:a17:90a:ba92:b0:267:ffcf:e9e3 with SMTP id t18-20020a17090aba9200b00267ffcfe9e3mr3087478pjr.46.1695957881706; Thu, 28 Sep 2023 20:24:41 -0700 (PDT) Received: from www.outflux.net (198-0-35-241-static.hfc.comcastbusiness.net. [198.0.35.241]) by smtp.gmail.com with ESMTPSA id x15-20020a17090a530f00b0027654d389casm297683pjh.54.2023.09.28.20.24.37 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 28 Sep 2023 20:24:39 -0700 (PDT) From: Kees Cook To: Eric Biederman Cc: Kees Cook , Andrew Morton , linux-mm@kvack.org, Sebastian Ott , =?utf-8?q?Thomas_Wei=C3=9Fschuh?= , Pedro Falcato , Al Viro , Christian Brauner , linux-kernel@vger.kernel.org, linux-fsdevel@vger.kernel.org, linux-hardening@vger.kernel.org Subject: [PATCH v4 6/6] mm: Remove unused vm_brk() Date: Thu, 28 Sep 2023 20:24:34 -0700 Message-Id: <20230929032435.2391507-6-keescook@chromium.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230929031716.it.155-kees@kernel.org> References: <20230929031716.it.155-kees@kernel.org> MIME-Version: 1.0 X-Developer-Signature: v=1; a=openpgp-sha256; l=2050; i=keescook@chromium.org; h=from:subject; bh=qQgWJ2LfzVKqVSy79Ld0II87Ub3I62svbZlMXS8eqNU=; b=owEBbQKS/ZANAwAKAYly9N/cbcAmAcsmYgBlFkNyozNMKFDP2i80754Px/+ZY/Cx7wBo4sXmZ GfAFEgqokWJAjMEAAEKAB0WIQSlw/aPIp3WD3I+bhOJcvTf3G3AJgUCZRZDcgAKCRCJcvTf3G3A JvugEAC1X9CtGDjUrVOsqG0t9TTnzkbAODtZErc43R+VjV7tM+wgC1YoBq1uGKg3kk/39J5ROiJ rUkABHj3UilMN33EplFoDi9bG/ErY91MQttOzzjtGtjVqWIrEJ/Vl9Txp0Lfb8zYFy9NsK/6FUL MtgFp5sk40k0qU96E6p96fB7SzEc44a33CLYYExFKVE2M08Bylw2aJ9Ee0dsno2XN3kwHuLByFf wcJ9XIEkkKA6ek8B7IuLsRGmbigeQnoNgTo87K5bPOqAGNyvV5AaKea9aX90W7XTFl3Mg767UDU QBSQvaLWv+t6WEIH+DBweDTKSOHJsyAOniUBtf5ZYA37xZuqPVJdtHMHNT5eperaA7H3rjw+UUz Jlq6iSEPSQzB/ur6ucWrK0s4O62amvSspv633OZXBOo6liFA9krixvk0n9DDIpK4izJk9sqIro1 JU8Wshi103umj8FDzYRXujBj+g//VNypVJAxw30ltepS01lpNn33UpY/bazcxEBWtzAI6WzksOn OioMLo/fYEk9tr3WtHRgTsp7V0afPDYJ6aOpeBzZjAdyfqtuIfngMDD8ITow2mnQdSypEQ39K9p Rr6tuk/SEYKG3c/cQmyk7L+/cRTRAgeeYxAnZFNKbHqj7DeGYfmOdb6oTSlHNHgU9S+L8PRk5BL FEozwXjpMVEPE4w== X-Developer-Key: i=keescook@chromium.org; a=openpgp; fpr=A5C3F68F229DD60F723E6E138972F4DFDC6DC026 X-Rspamd-Queue-Id: C49DC8000E X-Rspam-User: X-Rspamd-Server: rspam04 X-Stat-Signature: juok9is5ufwactxid3nukt6xkkbfff49 X-HE-Tag: 1695957882-299186 X-HE-Meta: U2FsdGVkX19frKtev1DN+qQByfAQ+5vH4LQNYJYzsXLKb8cwUSJEqDM8e17xEeke0uqmAy9b/jDQMW/cxR1COxDQroPIXmp2eP1WT0otgJhGVfK0UX3EDuW/gs6J8YDk+CMjULtJanre3O/nRMV8ABJnOF1yEIIfHRGyrsBMEITpyBg7DGTDSDel9rFx4WvtavJaMjyDmbXmjFLRBr5QOJfRE5ZrpUWljqgRJDI/CJOQdlVLy6Vey5aA4gE43n2MQd42pNVlz7R0UU2pXKCA2lWHy+35Ae+YULvlqu+jii5+9EuolqGCSlPqV7dMNwvtdtCt8j9NTqaQHzAowilnAWSNZV0wNoanKas3RPefoz0f5iIZdmkKzb0Xh6k5stmhjWilxBsUWyCRQ3o/gXZnq4dgZhkTmjCoLGrrADJf2o47vagAoXpCDmAZ5KvvYfT8+Whpx78/JDDELGXLqY+LNxEPjuIH0RQxoKV3HZ0/+ZrUE4YKhOOhoYSzoab3uoy4vVqrVmHy9XMofB9hZ46OvyURN+/d4DnIUfFRG4261F1prllwKhWlgyz3KqdUBHX9LOwo6thpCAXNjNLsNROiwrdu9FWWSOa6PIyoLmiiWoP4kf4k1ABdRJs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ests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: With fs/binfmt_elf.c fully refactored to use the new elf_load() helper, there are no more users of vm_brk(), so remove it. Cc: Andrew Morton Cc: linux-mm@kvack.org Suggested-by: Eric Biederman Signed-off-by: Kees Cook --- include/linux/mm.h | 3 +-- mm/mmap.c | 6 ------ mm/nommu.c | 5 ----- 3 files changed, 1 insertion(+), 13 deletions(-) diff --git a/include/linux/mm.h b/include/linux/mm.h index bf5d0b1b16f4..216dd0c6dcf8 100644 --- a/include/linux/mm.h +++ b/include/linux/mm.h @@ -3308,8 +3308,7 @@ static inline void mm_populate(unsigned long addr, unsigned long len) static inline void mm_populate(unsigned long addr, unsigned long len) {} #endif -/* These take the mm semaphore themselves */ -extern int __must_check vm_brk(unsigned long, unsigned long); +/* This takes the mm semaphore itself */ extern int __must_check vm_brk_flags(unsigned long, unsigned long, unsigned long); extern int vm_munmap(unsigned long, size_t); extern unsigned long __must_check vm_mmap(struct file *, unsigned long, diff --git a/mm/mmap.c b/mm/mmap.c index b56a7f0c9f85..34d2337ace59 100644 --- a/mm/mmap.c +++ b/mm/mmap.c @@ -3174,12 +3174,6 @@ int vm_brk_flags(unsigned long addr, unsigned long request, unsigned long flags) } EXPORT_SYMBOL(vm_brk_flags); -int vm_brk(unsigned long addr, unsigned long len) -{ - return vm_brk_flags(addr, len, 0); -} -EXPORT_SYMBOL(vm_brk); - /* Release all mmaps. */ void exit_mmap(struct mm_struct *mm) { diff --git a/mm/nommu.c b/mm/nommu.c index 7f9e9e5a0e12..23c43c208f2b 100644 --- a/mm/nommu.c +++ b/mm/nommu.c @@ -1531,11 +1531,6 @@ void exit_mmap(struct mm_struct *mm) mmap_write_unlock(mm); } -int vm_brk(unsigned long addr, unsigned long len) -{ - return -ENOMEM; -} - /* * expand (or shrink) an existing mapping, potentially moving it at the same * time (controlled by the MREMAP_MAYMOVE flag and available VM space)