[libc-commits] [libc] [libc] Small recvfrom fixes (yaml, unpoison) (PR #111020)

via libc-commits libc-commits at lists.llvm.org
Thu Oct 3 09:47:23 PDT 2024


llvmbot wrote:


<!--LLVM PR SUMMARY COMMENT-->

@llvm/pr-subscribers-libc

Author: Michael Jones (michaelrj-google)

<details>
<summary>Changes</summary>

Forgot to update the newhdrgen yaml (old headergen is fine) and forgot
to unpoison addrlen. This patch fixes those.


---
Full diff: https://github.com/llvm/llvm-project/pull/111020.diff


2 Files Affected:

- (modified) libc/newhdrgen/yaml/sys/socket.yaml (+1-1) 
- (modified) libc/src/sys/socket/linux/recvfrom.cpp (+1) 


``````````diff
diff --git a/libc/newhdrgen/yaml/sys/socket.yaml b/libc/newhdrgen/yaml/sys/socket.yaml
index accb4b14099e82..45602d4b3bff03 100644
--- a/libc/newhdrgen/yaml/sys/socket.yaml
+++ b/libc/newhdrgen/yaml/sys/socket.yaml
@@ -62,7 +62,7 @@ functions:
       - type: size_t
       - type: int
       - type: const struct sockaddr *
-      - type: socklen_t
+      - type: socklen_t *
   - name: recvmsg
     standards:
       - POSIX
diff --git a/libc/src/sys/socket/linux/recvfrom.cpp b/libc/src/sys/socket/linux/recvfrom.cpp
index fdcaceee8ad293..791005529acdf2 100644
--- a/libc/src/sys/socket/linux/recvfrom.cpp
+++ b/libc/src/sys/socket/linux/recvfrom.cpp
@@ -45,6 +45,7 @@ LLVM_LIBC_FUNCTION(ssize_t, recvfrom,
   }
 
   MSAN_UNPOISON(buf, ret);
+  MSAN_UNPOISON(addrlen, sizeof(socklen_t));
 
   return ret;
 }

``````````

</details>


https://github.com/llvm/llvm-project/pull/111020


More information about the libc-commits mailing list