From patchwork Tue Oct 27 19:29:24 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Heinrich Schuchardt X-Patchwork-Id: 1388942 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=BTxoX060; 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 4CLMH90XLMz9sV7 for ; Wed, 28 Oct 2020 06:30:13 +1100 (AEDT) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 656958249C; Tue, 27 Oct 2020 20:29:56 +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="BTxoX060"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id F136D824E0; Tue, 27 Oct 2020 20:29:50 +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.22]) (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 BB97F8248B for ; Tue, 27 Oct 2020 20:29:46 +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=1603826985; bh=07GxynJmdutdoAMYXCVpXo92u4XqFCDKl0VjGJEjKFw=; h=X-UI-Sender-Class:From:To:Cc:Subject:Date:In-Reply-To:References; b=BTxoX060CQyMVVU+1ORbVtgDJWDrehzBT+PbDDqouWk7YEj77lMI6pCG01nvHiGZD VCkMw7QAiEKep/7WPcb/+URLAuJ8CJj8vDgQqRLNrBp5AFfEbh+9b8l1B2Bz9p98JP eRUUwzm1wNLJNowslqWKxEHd+p+JSzEBXIWhuojs= X-UI-Sender-Class: 01bb95c1-4bf8-414a-932a-4f6e2808ef9c Received: from workstation4.fritz.box ([178.202.41.107]) by mail.gmx.com (mrgmx104 [212.227.17.174]) with ESMTPSA (Nemesis) id 1N3KPq-1kPHVC3r4k-010JkW; Tue, 27 Oct 2020 20:29:45 +0100 From: Heinrich Schuchardt To: Simon Glass Cc: Rasmus Villemoes , u-boot@lists.denx.de, Heinrich Schuchardt Subject: [PATCH v3 4/8] sandbox: use O_CLOEXEC in os_open() Date: Tue, 27 Oct 2020 20:29:24 +0100 Message-Id: <20201027192928.16508-5-xypron.glpk@gmx.de> X-Mailer: git-send-email 2.28.0 In-Reply-To: <20201027192928.16508-1-xypron.glpk@gmx.de> References: <20201027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FPE6+Tb1m/4iJ0K+39VJf0kCnxVTJbI+T+wWTL8Jvp0pcfcujecjuKvvu71iO1aQpeLZEFAHu lfTFc3byJIVPRv6c2zd+oHpvCFSv67BVUNrqXkBYWksVhMFlfmjokVNhL8IRsIdxgtXYBgFFU bPfK7npBhYjgKr0+6sCA== 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 Reviewed-by: Simon Glass Reviewed-by: Simon Glass --- v3: no change 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); }