From patchwork Tue Oct 27 18:47:00 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Heinrich Schuchardt X-Patchwork-Id: 1388883 X-Patchwork-Delegate: sjg@chromium.org Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=lists.denx.de (client-ip=2a01:238:438b:c500:173d:9f52:ddab:ee01; helo=phobos.denx.de; envelope-from=u-boot-bounces@lists.denx.de; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=gmx.de Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; secure) header.d=gmx.net header.i=@gmx.net header.a=rsa-sha256 header.s=badeba3b8450 header.b=iIFNvYBb; dkim-atps=neutral Received: from phobos.denx.de (phobos.denx.de [IPv6:2a01:238:438b:c500:173d:9f52:ddab:ee01]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 4CLLLF2kz7z9sV0 for ; Wed, 28 Oct 2020 05:47:49 +1100 (AEDT) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id CD022824A4; Tue, 27 Oct 2020 19:47:24 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=none (p=none dis=none) header.from=gmx.de Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (1024-bit key; secure) header.d=gmx.net header.i=@gmx.net header.b="iIFNvYBb"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 4C9FE824A7; Tue, 27 Oct 2020 19:47:21 +0100 (CET) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on phobos.denx.de X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,FREEMAIL_FROM,RCVD_IN_MSPIKE_H2,SPF_HELO_NONE,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.2 Received: from mout.gmx.net (mout.gmx.net [212.227.17.21]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id 9EC2E823F4 for ; Tue, 27 Oct 2020 19:47:17 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=none (p=none dis=none) header.from=gmx.de Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=xypron.glpk@gmx.de DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=gmx.net; s=badeba3b8450; t=1603824435; bh=OO/4eaKygKoBDlaTNqGojfV5WnFM6VKZUYLRJkbPf+I=; h=X-UI-Sender-Class:From:To:Cc:Subject:Date:In-Reply-To:References; b=iIFNvYBbk+62BPqsqKu7H0XQktMcPIQlmQg/aQ+2ZqpMqUqjO+5H+fV8eVquIeZhI aKuA5W94+jYmpeiGnGRth2MjWyOLhlFT+dGIDXZmny5TLdlA8kgj3zcF2M9CzBPXzH nK/PVY8wdgHhRkHFT+sA5mXmNBuOL8aQwYRe1e4Q= X-UI-Sender-Class: 01bb95c1-4bf8-414a-932a-4f6e2808ef9c Received: from workstation4.fritz.box ([178.202.41.107]) by mail.gmx.com (mrgmx105 [212.227.17.174]) with ESMTPSA (Nemesis) id 1MN5eX-1kqOKU1nV7-00J0W6; Tue, 27 Oct 2020 19:47:15 +0100 From: Heinrich Schuchardt To: Simon Glass Cc: Rasmus Villemoes , u-boot@lists.denx.de, Heinrich Schuchardt Subject: [PATCH v2 4/8] sandbox: use O_CLOEXEC in os_open() Date: Tue, 27 Oct 2020 19:47:00 +0100 Message-Id: <20201027184704.15910-5-xypron.glpk@gmx.de> X-Mailer: git-send-email 2.28.0 In-Reply-To: <20201027184704.15910-1-xypron.glpk@gmx.de> References: <20201027184704.15910-1-xypron.glpk@gmx.de> MIME-Version: 1.0 X-Provags-ID: V03:K1:sO1AIXzDFX4wb9bheXfDCQmXgEavXcR/s9t8+W3zXIVZ2T8fouu Ua/vLPteH/Wc9TcpkAXv61eQismhQci1bHitNtkHkjC+y5Yo2rB/HmQUK7qe4cJ92zTvRYY MkWEuTVUVAxJs3F/6FakQTnpj6L+sqnN/IAdBJ41qjprwu5+UEWclQEGX4OoUMnS4yvr9ZB hp35kkFeXvyWCkx0GMK1Q== X-UI-Out-Filterresults: notjunk:1;V03:K0:npNWgUqhm8g=:dD1RPj6/uEI5Rav16FAe74 dxWv5iWYPWxRkViD+Hj2qO6fhwiAEBF3N8w/OmpuScsv38F4Cof+E2bVmN2lCRJ4PSS32lmKB koN5toypor7iKUV3hDgHGrmBg3iB/uDEbkQN8LSF20oaLP8I/sJe2yhirTvNBK0+iqyHlotRM MehqpKhqxvpW2poReJeNExID4xt5KNpb1oI+2uFWDIczqkbM7e0LdBfGUH+cfFK2gW11QSKpo 8i9deU16L176u+h3DjGjEMu/gpI/gCBjQFWXVVc6WVcGjhrqeQMMqxZkkkPTB974MslYr2DEV 7XHuP6EAonHy6yVvkZM/x50W/wwH1iv3UZXUuM9n4BQU1FFxuU55pFtHD9RsrQ/2J/7seID3F vFET7KB8NbaHwj3A3I7IM10iZq/oHanu3/VlHKMMv+Vnj1G1llWogJFHDBvTD5f1ejfGCxN+M g4B4zoqvIirFz0tWUTa5SNaUUx0cRRfA+s44FC2Fg2ZYEvtGs6IrhI6MOJw1U7y6GA3vQhzwR E2N06j1fxbKZcrDSwfkurPlxuERJuaLltV2Szcrye8Xk/ky7IELYyT89CZ9hlU/FGg13oPeTK Rf2DAKS0yxCS/trMtKVOg7pEjMTKntgls8VSO9wV/Q2Xv6fxctDDHU4j0LZOCByZievitdwSE 58qRxg/k1k61Cm34BYSFyr/Rm5Pc/Nom+afxIA2vbt+IiuR6L1q9gb9Sd87mSV1IgoFWqNkeX W3lA/SAvbe5OwXOBDbv25vEixRu3uPELUAYTe3OnsF02cbbhMwimCOSvpQoHFAMwISdidj4GX DZFbn7pgKrpHBuG92/c6ezmF4ti8J6EecNyFWqQSBGxiYBFXo9iPpVxlQUsmlWJFae9FG4z/D OdCg9l3xlHgLGBU0a93w== X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.34 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" X-Virus-Scanned: clamav-milter 0.102.3 at phobos.denx.de X-Virus-Status: Clean During a cold reset execv() is used to relaunch the U-Boot binary. We must ensure that all files are closed in this case. Signed-off-by: Heinrich Schuchardt --- v2: new patch --- arch/sandbox/cpu/os.c | 5 +++++ 1 file changed, 5 insertions(+) -- 2.28.0 diff --git a/arch/sandbox/cpu/os.c b/arch/sandbox/cpu/os.c index c461fb0db0..7e474d6364 100644 --- a/arch/sandbox/cpu/os.c +++ b/arch/sandbox/cpu/os.c @@ -80,6 +80,11 @@ int os_open(const char *pathname, int os_flags) flags |= O_CREAT; if (os_flags & OS_O_TRUNC) flags |= O_TRUNC; + /* + * During a cold reset execv() is used to relaunch the U-Boot binary. + * We must ensure that all files are closed in this case. + */ + flags |= O_CLOEXEC; return open(pathname, flags, 0777); }