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

Michael Jones via libc-commits libc-commits at lists.llvm.org
Thu Oct 3 09:46:50 PDT 2024


https://github.com/michaelrj-google created https://github.com/llvm/llvm-project/pull/111020

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


>From 252ed0dfea10a368ad10a797664ef9b7506a5dba Mon Sep 17 00:00:00 2001
From: Michael Jones <michaelrj at google.com>
Date: Thu, 3 Oct 2024 09:45:39 -0700
Subject: [PATCH] [libc] Small recvfrom fixes (yaml, unpoison)

Forgot to update the newhdrgen yaml (old headergen is fine) and forgot
to unpoison addrlen. This patch fixes those.
---
 libc/newhdrgen/yaml/sys/socket.yaml    | 2 +-
 libc/src/sys/socket/linux/recvfrom.cpp | 1 +
 2 files changed, 2 insertions(+), 1 deletion(-)

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;
 }



More information about the libc-commits mailing list