From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Eli Zaretskii Newsgroups: gmane.emacs.devel Subject: Re: Leak in selinux stuff? Date: Sat, 19 Aug 2023 10:26:48 +0300 Message-ID: <83fs4f1ohz.fsf@gnu.org> References: <87y1i7em8t.fsf.ref@yahoo.com> <87y1i7em8t.fsf@yahoo.com> Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="35662"; mail-complaints-to="usenet@ciao.gmane.io" Cc: emacs-devel@gnu.org To: Po Lu , Paul Eggert Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Sat Aug 19 09:27:31 2023 Return-path: Envelope-to: ged-emacs-devel@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1qXGMr-000914-7n for ged-emacs-devel@m.gmane-mx.org; Sat, 19 Aug 2023 09:27:29 +0200 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qXGM2-0002Dq-GD; Sat, 19 Aug 2023 03:26:38 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qXGM1-0002DY-PL for emacs-devel@gnu.org; Sat, 19 Aug 2023 03:26:37 -0400 Original-Received: from fencepost.gnu.org ([2001:470:142:3::e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qXGM1-0003Qr-Bv; Sat, 19 Aug 2023 03:26:37 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=References:Subject:In-Reply-To:To:From:Date: mime-version; bh=37JcLFHRKddCAhRNadLEl+jAMGuf401wfeec+YEb+lA=; b=D3UhnsXdW3t5 HGIz2sscJXxlpPDl6KWb5lJMbaLn0rr5TSkfyvoQgQXz+LZl/ngfMUS0x14vQlM+ahCmeuofHMyoP 0QgWq3QO/MFaSSukQOSWHWS0MfPveWfY/DbWL49UBf1ZGN/6R2d98eLacTHVku1SClJ8hRMH+yBTO 6JQXP0y1HsMy9HFgtnrRGW9CbYa7njbIJ7unmZCU3LBuKh0hpjSyPIkqgdGXZUFnIAZAsy4jOJx4l crP+vdW2jkZBXN3FZwYqsxwhjyJpwxi7S5CM9jr6CtoF7ara+Clfe22jnPzidpcX4Gwjvv3sXgNUM bmeFMSl4PuqWSs6DSSEetA==; In-Reply-To: <87y1i7em8t.fsf@yahoo.com> (message from Po Lu on Sat, 19 Aug 2023 11:37:06 +0800) X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Xref: news.gmane.io gmane.emacs.devel:308915 Archived-At: > From: Po Lu > Date: Sat, 19 Aug 2023 11:37:06 +0800 > > fileio.c is littered with code like such: > > /* See https://debbugs.gnu.org/11245 for ENOTSUP. */ > if (fail && errno != ENOTSUP) > report_file_error ("Doing lsetfilecon", absname); > > context_free (parsed_con); > freecon (con); > > where `parsed_con' and `con' are allocated by libselinux functions by > the likes of `lgetfilecon'. Around such code, no measures are > apparently taken for deallocating those objects should a non local exit > occur. Am I missing anything, or should this be fixed? IMO, they should either free the resources before signaling an error, or use record_unwind_protect to free the allocated resources, yes.