From owner-cvs-all@FreeBSD.ORG Mon Oct 3 12:49:55 2005 Return-Path: X-Original-To: cvs-all@FreeBSD.org Delivered-To: cvs-all@FreeBSD.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 0FF0916A41F; Mon, 3 Oct 2005 12:49:55 +0000 (GMT) (envelope-from cperciva@FreeBSD.org) Received: from repoman.freebsd.org (repoman.freebsd.org [216.136.204.115]) by mx1.FreeBSD.org (Postfix) with ESMTP id DA3D643D46; Mon, 3 Oct 2005 12:49:54 +0000 (GMT) (envelope-from cperciva@FreeBSD.org) Received: from repoman.freebsd.org (localhost [127.0.0.1]) by repoman.freebsd.org (8.13.1/8.13.1) with ESMTP id j93CnsHv080819; Mon, 3 Oct 2005 12:49:54 GMT (envelope-from cperciva@repoman.freebsd.org) Received: (from cperciva@localhost) by repoman.freebsd.org (8.13.1/8.13.1/Submit) id j93Cnskf080818; Mon, 3 Oct 2005 12:49:54 GMT (envelope-from cperciva) Message-Id: <200510031249.j93Cnskf080818@repoman.freebsd.org> From: Colin Percival Date: Mon, 3 Oct 2005 12:49:54 +0000 (UTC) To: src-committers@FreeBSD.org, cvs-src@FreeBSD.org, cvs-all@FreeBSD.org X-FreeBSD-CVS-Branch: HEAD Cc: Subject: cvs commit: src/sys/kern kern_exec.c X-BeenThere: cvs-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: CVS commit messages for the entire tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 03 Oct 2005 12:49:55 -0000 cperciva 2005-10-03 12:49:54 UTC FreeBSD src repository Modified files: sys/kern kern_exec.c Log: If sufficiently bad things happen during a call to kern_execve(), it is possible for do_execve() to call exit1() rather than returning. As a result, the sequence "allocate memory; call kern_execve; free memory" can end up leaking memory. This commit documents this astonishing behaviour and adds a call to exec_free_args() before the exit1() call in do_execve(). Since all the users of kern_execve() in the tree use exec_free_args() to free the command-line arguments after kern_execve() returns, this should be safe, and it fixes the memory leak which can otherwise occur. Submitted by: Peter Holm MFC after: 3 days Security: Local denial of service Revision Changes Path 1.277 +8 -0 src/sys/kern/kern_exec.c