From patchwork Sat Jun 19 03:43:24 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 463850 Delivered-To: patch@linaro.org Received: by 2002:a05:6638:102:0:0:0:0 with SMTP id x2csp532575jao; Fri, 18 Jun 2021 20:44:02 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzDpqv0qfFM7WJ7xobnt4lna4lNPzNBFsd8IKBQikMaOuhD0EEtImG+q27Ueo25mImizICR X-Received: by 2002:a92:200a:: with SMTP id j10mr9472197ile.251.1624074242717; Fri, 18 Jun 2021 20:44:02 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1624074242; cv=none; d=google.com; s=arc-20160816; b=cP8cdOn4LGaPDMsRY9xzbMA6ER3EoFfVUtJV6JWnQI0+6WEuA+3S77sKVNMrrNcLde atNcrDC+RWCYhuAWQApYL9TKvOb8bvEPdrlcwlLPW6BoSD5nQfuHoHAJIjC2DTluXEGq zw5wb9YHSWyHXSWwnYkTrrn+8opLl+TXuqcF8JKakavirKyota6IovJPC9LiGFezUIA6 3lTuUimdy0PYLU0E7Q3Aqb+ZNnyFlzkORC9eC8yTaqKiFdIZDqAxiiFn1LKPZ1Cr8XcL hbZjaVekHKjemKOfzwX+L+Pb4DqqdaeOMNbwpt4H3kH2SdHpYCIejpB65owfPzMN78vo Suhg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:cc:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:to:from :dkim-signature; bh=YC2foJgnALUaFU8F6U+DDhXWrRa+DNA7R4W0GBliIEU=; b=YM9Kan1UZDBQxzOTE9oh0qnBL3mJbOX1EKivzExKsELz3eSPQvZG/9RCdAbNGcZL1j wQFF1S6/OMEpSXGHTlVhHeTw3kZtUirstkxXHaKQ0fc5j82kEPMRbzcGMjrFb7C9ST0+ 8yJgXuoa7pBU66gy+gBK1STchreUTq3VGWfu+bmtXN7S8NWR/dNSG7fHQTMKQVEaFWXF YV0L3zPmjOtFKwzYiqNb+c/WDGN2QC16J8Bm2PyEhUJyLNJOxlIKluPpYoopvlBwyboX 1arHtHSQYNRC2RutljmdeTYJteclmnAwur800YDacLH5PAZu7uVagFr0t2msdGM3v6Df UkHQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=AausL1d+; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id u21si10929541jak.34.2021.06.18.20.44.02 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Fri, 18 Jun 2021 20:44:02 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=AausL1d+; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1]:50790 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1luRtq-0000GA-66 for patch@linaro.org; Fri, 18 Jun 2021 23:44:02 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:33090) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1luRtZ-00009Q-ER for qemu-devel@nongnu.org; Fri, 18 Jun 2021 23:43:45 -0400 Received: from mail-pf1-x42b.google.com ([2607:f8b0:4864:20::42b]:35474) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1luRtQ-00082N-Ui for qemu-devel@nongnu.org; Fri, 18 Jun 2021 23:43:45 -0400 Received: by mail-pf1-x42b.google.com with SMTP id h12so9240416pfe.2 for ; Fri, 18 Jun 2021 20:43:35 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=YC2foJgnALUaFU8F6U+DDhXWrRa+DNA7R4W0GBliIEU=; b=AausL1d+dIJbIcyEOLHzxetr1Gqs9u+R7IU/7/O6HOHcDY6VmHkcsTmnLF0ftUhZXr CaVdpZZarNPBlqUYHdfm84aMZzY08JLzSu8wrn90TaGgrE4zyRP32zHXyNDP0a7jvPWu Sq+sGVKlzgyrqnMmcAnfGhl07KJU66O3AOdNdkeCYVsOk42Ay/EQKbkfKM6Kqyyp3Wrd O8YuuLwluwzAzwH6yk8sB6JXXBFr8ibNEpiEz3JwtGv4KhfY/ukvW3OIJjWxkIlrZaCt pUtbLl8PhZyYqcdecCJgA8nTLbRa4b1yqfGJgaecnB/4jyIjBMQ+r68lBxL9jerEK4mH Ak+A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=YC2foJgnALUaFU8F6U+DDhXWrRa+DNA7R4W0GBliIEU=; b=RiQFF5vfXoyFo8u5CCIC5vxUELsCDnkwxKbUx10jErAObix2tXmuAYWwulLtRAsfTq OdkbWh9X3Kqz9PmrHhVIqyoYhXpMrMLNXI0S0KMWKLWwN1qxrqmPxz9AXiF/sCvtI3B7 HctvrRVXf/Y4HKvOtY1V0wwBuLD90f5u5MdQKA6XB73z2VLdYDkDeAMP34x3gHf8H90Q jD0SvQHeJMPgAzqEKUr2ZkEqwPEHpmQtO6PTKwHEMHhtr1YlUKlHfrHE00PfqArj0EHG AWu09dJSaroJ02gHC8tD5DLda9ML4aAwh/V8Qh6NjQ4QCBoSnKtY/02/P/NlwQuGoLC3 QDZQ== X-Gm-Message-State: AOAM533az+NhZ8j3mKJ2Q84Op+1PAnPpsgBXwUD5Mv2QQ2bsBuROX0Yr OybmgIfDrlNWE+m3f8xi6LAMchPS1xu3DQ== X-Received: by 2002:a63:6d8d:: with SMTP id i135mr11084192pgc.350.1624074214962; Fri, 18 Jun 2021 20:43:34 -0700 (PDT) Received: from localhost.localdomain ([71.212.149.176]) by smtp.gmail.com with ESMTPSA id z6sm10045154pgs.24.2021.06.18.20.43.34 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 18 Jun 2021 20:43:34 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PATCH 07/12] linux-user: Replace bprm->fd with bprm->src.fd Date: Fri, 18 Jun 2021 20:43:24 -0700 Message-Id: <20210619034329.532318-8-richard.henderson@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210619034329.532318-1-richard.henderson@linaro.org> References: <20210619034329.532318-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::42b; envelope-from=richard.henderson@linaro.org; helo=mail-pf1-x42b.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: alex.bennee@linaro.org, laurent@vivier.eu Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" There are only a couple of uses of bprm->fd remaining. Migrate to the other field. Signed-off-by: Richard Henderson --- linux-user/qemu.h | 1 - linux-user/flatload.c | 8 ++++---- linux-user/linuxload.c | 5 ++--- 3 files changed, 6 insertions(+), 8 deletions(-) -- 2.25.1 Reviewed-by: Philippe Mathieu-Daudé diff --git a/linux-user/qemu.h b/linux-user/qemu.h index f4cdfb16b3..dafaae6293 100644 --- a/linux-user/qemu.h +++ b/linux-user/qemu.h @@ -211,7 +211,6 @@ struct linux_binprm { char buf[BPRM_BUF_SIZE] __attribute__((aligned)); ImageSource src; abi_ulong p; - int fd; int e_uid, e_gid; int argc, envc; char **argv; diff --git a/linux-user/flatload.c b/linux-user/flatload.c index 3e5594cf89..58d0d9352c 100644 --- a/linux-user/flatload.c +++ b/linux-user/flatload.c @@ -460,7 +460,7 @@ static int load_flat_file(struct linux_binprm * bprm, DBG_FLT("BINFMT_FLAT: ROM mapping of file (we hope)\n"); textpos = target_mmap(0, text_len, PROT_READ|PROT_EXEC, - MAP_PRIVATE, bprm->fd, 0); + MAP_PRIVATE, bprm->src.fd, 0); if (textpos == -1) { fprintf(stderr, "Unable to mmap process text\n"); return -1; @@ -487,7 +487,7 @@ static int load_flat_file(struct linux_binprm * bprm, } else #endif { - result = target_pread(bprm->fd, datapos, + result = target_pread(bprm->src.fd, datapos, data_len + (relocs * sizeof(abi_ulong)), fpos); } @@ -537,10 +537,10 @@ static int load_flat_file(struct linux_binprm * bprm, else #endif { - result = target_pread(bprm->fd, textpos, + result = target_pread(bprm->src.fd, textpos, text_len, 0); if (result >= 0) { - result = target_pread(bprm->fd, datapos, + result = target_pread(bprm->src.fd, datapos, data_len + (relocs * sizeof(abi_ulong)), ntohl(hdr->data_start)); } diff --git a/linux-user/linuxload.c b/linux-user/linuxload.c index 8b93b9704c..d0d3f2ed0e 100644 --- a/linux-user/linuxload.c +++ b/linux-user/linuxload.c @@ -36,7 +36,7 @@ static int prepare_binprm(struct linux_binprm *bprm) int mode; int retval; - if (fstat(bprm->fd, &st) < 0) { + if (fstat(bprm->src.fd, &st) < 0) { return -errno; } @@ -66,7 +66,7 @@ static int prepare_binprm(struct linux_binprm *bprm) bprm->e_gid = st.st_gid; } - retval = read(bprm->fd, bprm->buf, BPRM_BUF_SIZE); + retval = read(bprm->src.fd, bprm->buf, BPRM_BUF_SIZE); if (retval < 0) { perror("prepare_binprm"); exit(-1); @@ -133,7 +133,6 @@ int loader_exec(int fdexec, const char *filename, char **argv, char **envp, { int retval; - bprm->fd = fdexec; bprm->src.fd = fdexec; bprm->filename = (char *)filename; bprm->argc = count(argv);