From patchwork Tue Mar 12 18:41:13 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 779781 Delivered-To: patch@linaro.org Received: by 2002:a5d:604e:0:b0:33e:7753:30bd with SMTP id j14csp2169253wrt; Tue, 12 Mar 2024 11:42:43 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCWKw77ux6e1V7S7pZSkk1zpEO19JnVksU7YfX/87sXQKq/GgENWcFtLKcbzwW9e1fktTcU3Z/IOxwyDjjIGtQ2H X-Google-Smtp-Source: AGHT+IFbEYYe2WRTlZnJuhITYOP3en351LBpUKrvIFbc8ow4as4I6hZHKJ2PvIkVHW5kWP/80oqM X-Received: by 2002:a05:6808:bc9:b0:3c2:5d76:cdad with SMTP id o9-20020a0568080bc900b003c25d76cdadmr357764oik.12.1710268963381; Tue, 12 Mar 2024 11:42:43 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1710268963; cv=none; d=google.com; s=arc-20160816; b=AqV4XoDTzcGkHkvJDjDP2moipDrUnqSxmhKHhfmmdJ/J3xH9FbmvKwNzrOGjSg6PKn 7YnxXbifmlrTEdK1+cUQBY43Yb954xGM8B7cWGhTCAhh1kTdFiynvKRxV0bH90TCV95g Z5FvljQK//B7waxBM3vE/g0Rd7TNTYmgGaCZmOeX6WzyWUcUF6nL2FrdDLt9uwD0wTZ3 IOBIt0goIHG0l90i6TB4ZY6y06OzLClNqJvFE4veoQ/O2tvHqlsNLfkEIiEELWjJJ6v0 ROb0132vyuyueP2FaCXQQvdT85aTd8tuu6a90tdufUwBMPHF/caFj7vf5vq/Z2LJWTis 7PEw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to: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:cc:to :from:dkim-signature; bh=pSI45wyG1DbBDtEQROhzFaiavHjfnzmEgOAjYFnm1qw=; fh=kQadAhxV42GJ3cd2VUw1RyURv/zJQGvmUdF7iLEVTtc=; b=SnIl2whry5oAGPL9dxPsLm1OSlHPPlwRBvKfg6NvVNWsC45Ua1jn15OASoZtvPM9We gpbEn8StYcoNEsVJonGBevEn1M4YjLja0SBYx+UchaMBbhWqnh/BRe546Hqi6+yqXG/+ KuJKg8kgEAX2CMwpD0HjU3ZRNJdwXOUwOT1rDJJO1+O12f62oEZ/Wv4x5SdKYJa34k5x eDqWaBl9ABFIcmsBZ9e07WwD9hVoNoChfDFpk2i36jK1ywnwuHIKd6VxOjpKlWr6jaR7 C2vA+KF3stL4xvr9CDQwntb0v6hkrcxvYtW6iDzq82e9OegRTtNJvO8TSJTBk5/X0lcE c3qw==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=uv8pXXY5; 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=pass (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 if12-20020a0562141c4c00b0068cbab014absi8192133qvb.595.2024.03.12.11.42.43 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Tue, 12 Mar 2024 11:42:43 -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=pass header.i=@linaro.org header.s=google header.b=uv8pXXY5; 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=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rk74L-0000Ve-NY; Tue, 12 Mar 2024 14:41:45 -0400 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 1rk747-0000OI-HP for qemu-devel@nongnu.org; Tue, 12 Mar 2024 14:41:32 -0400 Received: from mail-pl1-x634.google.com ([2607:f8b0:4864:20::634]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1rk743-0001Mt-IX for qemu-devel@nongnu.org; Tue, 12 Mar 2024 14:41:29 -0400 Received: by mail-pl1-x634.google.com with SMTP id d9443c01a7336-1dd68d4cff1so32852915ad.2 for ; Tue, 12 Mar 2024 11:41:27 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1710268886; x=1710873686; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=pSI45wyG1DbBDtEQROhzFaiavHjfnzmEgOAjYFnm1qw=; b=uv8pXXY5LZmJeZ10/oX9Qu4atJaJCx4cIIYqBtPlBF+zck7nvBavXNa8xvBrm6YpbY R/0x1atZPyw6hQ+BVbotcLL8kqpApHg4IneenuOeW8Ug6bDPx60wMy581GEV8qWRGeGr 9TeezimiltM8qDxSfhTM2Q+aybE6IxXFrAHQRQAhE5keLX5CLCw8rU8XmAkFUWVVZ+EE Lbe52Jm+amxwm/aWT/lvmMBQm7ye8mr8Y+c5gLBbjvDpb+zRSMOsXiyDmnWdBSNYJ7ac FYvVkzslCWohVxGeH0YsmpChZxm/PAOCrz0qmYJJQBqdO1q0golF6NFKOrRedBQYHVqE hYVQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1710268886; x=1710873686; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=pSI45wyG1DbBDtEQROhzFaiavHjfnzmEgOAjYFnm1qw=; b=VM9jNHakqkyI81ieq+draToHPSOORga0nEJ80jFuDxNOKc7Ur0T6w4UMLFJKZetwcm 5UpgxTP0eEhU8MhqpFUvzPIBFzQEk6QpeQIJDe0iPEmbLN+/gA1vNKtHHQ7D5DPGy6r9 uiAQqstzZq2TQdZnG1M2wPLSLsoacQZBxsZn2nxEnAih++XuialKEG6e20l2zQalRTId PhSky2qLAXnj1OP7azCz8Qiw8PGnFjjBquSIIDIV1kwTMxqlXRgqj+WiJ8aAMGe79Mc5 9vtewalcG67ZOVp5PeSPQG9vM1Rg3bjYz07zcD/Cm/uaNGfVaJGOKoAQNV4sZvtrymoM Ejww== X-Gm-Message-State: AOJu0YzlMAkWWwXg8h6E732ULWTpaKn9qKTFfyOo4wwEVnrP8ZUm3gEA ZeaupGmo/5tNAbqpO3P5nmRxZdul1DMnYOOjzY+EuVEXjRjUN6EYeuMOW98foHH0HVzWThC1WhP G X-Received: by 2002:a17:903:2292:b0:1dd:96dc:dbad with SMTP id b18-20020a170903229200b001dd96dcdbadmr7967522plh.22.1710268885916; Tue, 12 Mar 2024 11:41:25 -0700 (PDT) Received: from stoup.. (173-197-098-125.biz.spectrum.com. [173.197.98.125]) by smtp.gmail.com with ESMTPSA id b11-20020a170903228b00b001dca40bb727sm6951739plh.88.2024.03.12.11.41.24 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 12 Mar 2024 11:41:25 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= Subject: [PULL 6/8] linux-user/elfload: Fully initialize struct target_elf_prpsinfo Date: Tue, 12 Mar 2024 08:41:13 -1000 Message-Id: <20240312184115.365415-7-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240312184115.365415-1-richard.henderson@linaro.org> References: <20240312184115.365415-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::634; envelope-from=richard.henderson@linaro.org; helo=mail-pl1-x634.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, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org Fixes Coverity CID: 1534962 Fixes: 243c4706625 ("linux-user/elfload: Write corefile elf header in one block") Reviewed-by: Philippe Mathieu-Daudé Signed-off-by: Richard Henderson --- linux-user/elfload.c | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/linux-user/elfload.c b/linux-user/elfload.c index 26d4c1d6b3..60cf55b36c 100644 --- a/linux-user/elfload.c +++ b/linux-user/elfload.c @@ -4204,7 +4204,14 @@ static void fill_prpsinfo_note(void *data, const TaskState *ts) * may well have higher alignment requirements, fill locally and * memcpy to the destination afterward. */ - struct target_elf_prpsinfo psinfo; + struct target_elf_prpsinfo psinfo = { + .pr_pid = getpid(), + .pr_ppid = getppid(), + .pr_pgrp = getpgrp(), + .pr_sid = getsid(0), + .pr_uid = getuid(), + .pr_gid = getgid(), + }; char *base_filename; size_t len; @@ -4217,13 +4224,6 @@ static void fill_prpsinfo_note(void *data, const TaskState *ts) } } - psinfo.pr_pid = getpid(); - psinfo.pr_ppid = getppid(); - psinfo.pr_pgrp = getpgrp(); - psinfo.pr_sid = getsid(0); - psinfo.pr_uid = getuid(); - psinfo.pr_gid = getgid(); - base_filename = g_path_get_basename(ts->bprm->filename); /* * Using strncpy here is fine: at max-length,