Skip to content

Conversation

@michaelrj-google
Copy link
Contributor

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

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

llvmbot commented Oct 3, 2024

@llvm/pr-subscribers-libc

Author: Michael Jones (michaelrj-google)

Changes

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

@nickdesaulniers
Copy link
Member

man 2 recvfrom doesn't mention const for any of the parameters. restrict and _Nullable would be nice to add (IIRC, restrict isn't supported in C++ except via compiler extension.

@michaelrj-google
Copy link
Contributor Author

Fixed const, added restrict. Planning to land later today if there are no further comments.

@michaelrj-google michaelrj-google merged commit cdfdc85 into llvm:main Oct 3, 2024
7 checks passed
@michaelrj-google michaelrj-google deleted the libcRecvfromPtrFix branch October 3, 2024 22:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants