From nobody Fri May 3 08:36:21 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of _spf.google.com designates 209.85.221.42 as permitted sender) client-ip=209.85.221.42; envelope-from=philippe.mathieu.daude@gmail.com; helo=mail-wr1-f42.google.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of _spf.google.com designates 209.85.221.42 as permitted sender) smtp.mailfrom=philippe.mathieu.daude@gmail.com ARC-Seal: i=1; a=rsa-sha256; t=1631380098; cv=none; d=zohomail.com; s=zohoarc; b=n7EZP7+PGXRsaNQNL8eST74In9Eq4zn5nQ1mDfFXJgW13L26yuAgHJxOqVoI+mXQ+cbjoSYfy6ZBDNX717eIRbx4jz4FDH2keVIxIt9nxZZdwV65vnyGljmHdYSz7YurWaBSc4OAd9BhF8+FZ0iA2oqQmjfrmaX8oSgnjbSZwXc= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1631380098; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:MIME-Version:Message-ID:Sender:Subject:To; bh=HW7LjfgW7U1BD5KFLk5y6g99LyLhiM0DaLznBTDSPPs=; b=dOSv9Yy8qwZR/xh9vHjEseacQBMOhNSwY5mXWevjszUlSEPFYuG3e86vI9sDn8fV1egUgYSRDsD+lFzT6subxkSC5d0S+Zin/ve40JgL+k8VONl6Wdt9SbX3HxzJfmUVhKQliF0G5O4h0ZcX9zcwXEQz4xmmHl/BrQgzGrsXVU4= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of _spf.google.com designates 209.85.221.42 as permitted sender) smtp.mailfrom=philippe.mathieu.daude@gmail.com Received: from mail-wr1-f42.google.com (mail-wr1-f42.google.com [209.85.221.42]) by mx.zohomail.com with SMTPS id 1631380098601699.2378086049961; Sat, 11 Sep 2021 10:08:18 -0700 (PDT) Received: by mail-wr1-f42.google.com with SMTP id u16so7511422wrn.5 for ; Sat, 11 Sep 2021 10:08:18 -0700 (PDT) Return-Path: Return-Path: Received: from x1w.. (21.red-83-52-55.dynamicip.rima-tde.net. [83.52.55.21]) by smtp.gmail.com with ESMTPSA id i5sm2167594wrc.86.2021.09.11.10.08.15 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 11 Sep 2021 10:08:16 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=sender:from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=HW7LjfgW7U1BD5KFLk5y6g99LyLhiM0DaLznBTDSPPs=; b=MTgFA+VT0jO+eORCb/scJz/5PnsfAvx/6y9RufKIc5DVjUViJ5cjG67LcOl0IWEuur gSw0y58UbZawb5fCiwN6doESBORsQH7Lzvnqtr2EfN5RaiMKoApEjHRaZyT+wyP/wAak VAnOqIcmDGPGeGIdOu/98hmWWXP3XSUPpUeYbwVfJQnVkDBl6rJUpTOAv/UTLLlyeUYx Ok9UnM+uEtaVrMyRcl4cq6Co0NeMqLbalvHjCD7XMmw1aE7tlXrJONQNo+ZooQ5N77DC FgOKITKcXe3org0sCqb/gJfXdTOb1uWJo81kcM8m1XNES6ElKHCNPcB49ouOtLEhgGZz vYGA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :mime-version:content-transfer-encoding; bh=HW7LjfgW7U1BD5KFLk5y6g99LyLhiM0DaLznBTDSPPs=; b=6NppiXrXQkCIF9vBe7g7i7ph4URfs9sKw7cPLobCAEH04zyA7GdNjx3Z6U3nnfHqGj QWvr4OY2DVUd7mxKAS4f6+vVNBLMthS6aoSXmZeHfbKuMAhhvFnFlNdf6FwqtpKgp0WO Gn96GMhY78jj+Lajblae3PmuFg3LFhYx6cU61jOI5Ubj5r/WEZpGpaKP4+wo2c6ujSZc 0OUJjARLKGqWjQ7nFyPa8d4XWQe2xHVzwBZ9+NkrKj6Eb73v4rClMKMmQg0OGwl6gta+ arDOFTq9+m2DTEcuFqwk9lBJRdkrO1okLjppwRbb8R+/BpuWMqn3gaIMm5UgE9IbY8lG JteQ== X-Gm-Message-State: AOAM530LLE82WoLh2Qqv09hhztXfA0R78HutKPN4AT+B9fEqdC8hHcbm Jx1ATzqrhiQEba3klXod6Io= X-Google-Smtp-Source: ABdhPJz01Dhf/qyoko7azla67YT2wBSrhy94GgJgsNUVgqw8KbOidwweEfcooxc2SV1tKrDyXTCF0g== X-Received: by 2002:adf:9e4d:: with SMTP id v13mr3912307wre.26.1631380096910; Sat, 11 Sep 2021 10:08:16 -0700 (PDT) Sender: =?UTF-8?Q?Philippe_Mathieu=2DDaud=C3=A9?= From: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: Richard Henderson , Helge Deller , Laurent Vivier , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , Conrad Meyer Subject: [PATCH v2] linux-user: Correct host errno for IP[V6]_RECVERR socket options Date: Sat, 11 Sep 2021 19:08:14 +0200 Message-Id: <20210911170814.537351-1-f4bug@amsat.org> X-Mailer: git-send-email 2.31.1 MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @gmail.com) X-ZM-MESSAGEID: 1631380099997100001 Host errno must be converted to target errno in IP_RECVERR and IPV6_RECVERR socket options. Fixes: ee1ac3a1822 ("linux-user: Add sockopts for IPv6") Resolves: https://gitlab.com/qemu-project/qemu/-/issues/602 Reported-by: Conrad Meyer Signed-off-by: Philippe Mathieu-Daud=C3=A9 --- v2: Corrected patch description --- linux-user/syscall.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/linux-user/syscall.c b/linux-user/syscall.c index ccd3892b2df..edc9d6b5ba2 100644 --- a/linux-user/syscall.c +++ b/linux-user/syscall.c @@ -1967,7 +1967,8 @@ static inline abi_long host_to_target_cmsg(struct tar= get_msghdr *target_msgh, tgt_len !=3D sizeof(struct errhdr_t)) { goto unimplemented; } - __put_user(errh->ee.ee_errno, &target_errh->ee.ee_errno); + __put_user(get_errno(errh->ee.ee_errno), + &target_errh->ee.ee_errno); __put_user(errh->ee.ee_origin, &target_errh->ee.ee_origin); __put_user(errh->ee.ee_type, &target_errh->ee.ee_type); __put_user(errh->ee.ee_code, &target_errh->ee.ee_code); @@ -2011,7 +2012,8 @@ static inline abi_long host_to_target_cmsg(struct tar= get_msghdr *target_msgh, tgt_len !=3D sizeof(struct errhdr6_t)) { goto unimplemented; } - __put_user(errh->ee.ee_errno, &target_errh->ee.ee_errno); + __put_user(get_errno(errh->ee.ee_errno), + &target_errh->ee.ee_errno); __put_user(errh->ee.ee_origin, &target_errh->ee.ee_origin); __put_user(errh->ee.ee_type, &target_errh->ee.ee_type); __put_user(errh->ee.ee_code, &target_errh->ee.ee_code); --=20 2.31.1