From owner-freebsd-questions@freebsd.org Tue Jul 20 12:12:22 2021 Return-Path: Delivered-To: freebsd-questions@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 6361C66B840 for ; Tue, 20 Jul 2021 12:12:22 +0000 (UTC) (envelope-from rdbodev@gmail.com) Received: from mail-ej1-x636.google.com (mail-ej1-x636.google.com [IPv6:2a00:1450:4864:20::636]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (2048 bits) client-digest SHA256) (Client CN "smtp.gmail.com", Issuer "GTS CA 1O1" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4GTcz94PyNz3kqr for ; Tue, 20 Jul 2021 12:12:21 +0000 (UTC) (envelope-from rdbodev@gmail.com) Received: by mail-ej1-x636.google.com with SMTP id hc15so34009477ejc.4 for ; Tue, 20 Jul 2021 05:12:21 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:from:date:message-id:subject:to; bh=I5roAn7vW0htCBn1tl86Q4glOHDPRTL94titxDcMkM4=; b=gE7NZGGTVCW30iFLLmSSrOLs17aI+7fQLzqiOJwkE3OWTt/tx2mNE1YzjWY0RsoJ9c rNT7bt+iT+C0nAbR1M4IkHYQAuBBjsclPiFeOEln/tYgq2rFV4md7uFSKUR45jasJrd0 X2MeCSFv7DQSlJd1NjJlaQc6CmwvjNVUWsNVP60shPuQf4djQd5p30vOcsuu9mqdoYPi qigiMPYdYePu6dvZcIQkDV71AkBpcthfSUel3dkOBpR18X3C0JdbWav4UCWzgwnVH0iT dzpYz/EGVvvr+xC+Ot+eoi/H43ds6w3G3CLT5mr7WyQakXebnYdHwHX7DAYQ5tX26fHb sSmw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:from:date:message-id:subject:to; bh=I5roAn7vW0htCBn1tl86Q4glOHDPRTL94titxDcMkM4=; b=FjHU5hJc7VhnId6j5PELwPt/Rw80NvFOUHseoOMUkC9Okq8NeNv6IGBF0zqmFlHuUv Yho0+c/kEZXlf3PYzfF6orEUbM3HaliNJcJEkMCQuQduuE44XFGeHUVQPPTxMAXIlO/I lJTBy6KJUdhYAcxtTI1N/6mrF9NEyV86vo+MERGBSyUFzTa/wSzy8Vp4vbuektxVfgN3 XVcCD1J9moRT8cOyKIbvEIB2QV8oSRxKqm10z2yWzdBktbzFcXVkYVwguVY5z6t9mrBJ jo3dup5jc+9nDwthVjuv6XHtmOg/FCeTh3LY4zLGh0vKoSYqakUn7M6gJJj1nSZFEo/z PBow== X-Gm-Message-State: AOAM532uKtID6V4sZaaf2qxUU47gfZ5328IRJLyYa32aflRMmPOZDEeX q9sdI9kM6qs3RgZvMNwCCEjfDxF/23qWUnLmz8zoTeP1on8= X-Google-Smtp-Source: ABdhPJy/hcJjYZ+ryN6xXeMgZGbSXJ71EMiFMBGpI9xM6KbLTIdqAaSmIIN9/Xl/pVmis99GdgUvPiaKn8/pJsO8Vcg= X-Received: by 2002:a17:907:3e1f:: with SMTP id hp31mr31848218ejc.55.1626783140040; Tue, 20 Jul 2021 05:12:20 -0700 (PDT) MIME-Version: 1.0 From: Rdbo Date: Tue, 20 Jul 2021 09:15:27 -0300 Message-ID: Subject: Understanding the behavior of the 32 bit mmap system call To: freebsd-questions@freebsd.org X-Rspamd-Queue-Id: 4GTcz94PyNz3kqr X-Spamd-Bar: / Authentication-Results: mx1.freebsd.org; dkim=pass header.d=gmail.com header.s=20161025 header.b=gE7NZGGT; dmarc=pass (policy=none) header.from=gmail.com; spf=pass (mx1.freebsd.org: domain of rdbodev@gmail.com designates 2a00:1450:4864:20::636 as permitted sender) smtp.mailfrom=rdbodev@gmail.com X-Spamd-Result: default: False [-0.13 / 15.00]; R_SPF_ALLOW(-0.20)[+ip6:2a00:1450:4000::/36:c]; FREEMAIL_FROM(0.00)[gmail.com]; TO_DN_NONE(0.00)[]; DKIM_TRACE(0.00)[gmail.com:+]; DMARC_POLICY_ALLOW(-0.50)[gmail.com,none]; FROM_EQ_ENVFROM(0.00)[]; MIME_TRACE(0.00)[0:+,1:+,2:~]; RBL_DBL_DONT_QUERY_IPS(0.00)[2a00:1450:4864:20::636:from]; FREEMAIL_ENVFROM(0.00)[gmail.com]; ASN(0.00)[asn:15169, ipnet:2a00:1450::/32, country:US]; DWL_DNSWL_NONE(0.00)[gmail.com:dkim]; ARC_NA(0.00)[]; R_DKIM_ALLOW(-0.20)[gmail.com:s=20161025]; FROM_HAS_DN(0.00)[]; TO_MATCH_ENVRCPT_ALL(0.00)[]; NEURAL_HAM_LONG(-1.00)[-0.999]; MIME_GOOD(-0.10)[multipart/alternative,text/plain]; PREVIOUSLY_DELIVERED(0.00)[freebsd-questions@freebsd.org]; NEURAL_SPAM_MEDIUM(0.98)[0.981]; RCPT_COUNT_ONE(0.00)[1]; SPAMHAUS_ZRD(0.00)[2a00:1450:4864:20::636:from:127.0.2.255]; NEURAL_SPAM_SHORT(0.89)[0.890]; RCVD_IN_DNSWL_NONE(0.00)[2a00:1450:4864:20::636:from]; RCVD_COUNT_TWO(0.00)[2]; RCVD_TLS_ALL(0.00)[]; MAILMAN_DEST(0.00)[freebsd-questions] X-Mailman-Approved-At: Tue, 20 Jul 2021 14:45:41 +0000 Content-Type: text/plain; charset="UTF-8" X-Content-Filtered-By: Mailman/MimeDel 2.1.34 X-BeenThere: freebsd-questions@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: User questions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 20 Jul 2021 12:12:22 -0000 Hi, I'm a hobbyist developer working on a multiplatform, multiarch memory library, and I chose FreeBSD to be one of the supported operating systems. I was playing around with the SYS_mmap system call and I noticed that, for x86_32, you have to pass a struct containing all the mmap arguments, rather than the arguments themselves. The thing is, this structure is not passed as a pointer (like on Linux, for example), so I don't see how one would do this syscall from a remote process, as each register is responsible for one argument of the syscall, and a single register can't store a structure this size. I've tried passing the structure as a pointer, passing each mmap argument in a separate register (like __NR_mmap2 on Linux), looking for alternative mmap system calls that do not require the struct parameter. Unfortunately, these attempts have all failed. TLDR; how to run a 32 bit SYS_mmap system call from a remote process when a single register can't fit the whole structure and the structure is not passed as a pointer? Regards, rdbo