move_addr_to_kernel(9)
π move_addr_to_kernel(9) β a Kernel API Manual moment
okay bestie, welcome to the Kernel API Manual π this one's a little kernel-space baddie called move_addr_to_kernel and tbh she's giving "small function, big responsibilities." let's get into it π
β¨ NAME β¨
move_addr_to_kernel β copy a socket address into kernel space π«Ά
like, she takes your lil user-space address and yeets it over to kernel space. that's the whole vibe. no cap.
β¨ SYNOPSIS β¨
int move_addr_to_kernel (void __user *uaddr , int ulen , struct
sockaddr_storage *kaddr );
lowkey iconic signature ngl π
β¨ ARGUMENTS β¨
uaddrβ the address in user space πΈ this is the one you're handing overulenβ the length in user space π how much of it we're dealing withkaddrβ the address in kernel space π this is where it's going, bestie
β¨ DESCRIPTION β¨
so here's the tea β the address gets copied into kernel space. that's it, that's the job, and honestly? she ate.
but listen, there are rules (there are always rules π):
- if the address you provided is too long, you get an error code of
-EINVALback π - if the copy gives invalid addresses, you get
-EFAULTπ - and on a success, you get
0back β¨ slay
heads up bestie: those first two are error paths, not victories. don't go celebrating a -EINVAL, i'm begging π
β¨ SEE ALSO β¨
she doesn't work alone, she's got a whole friend group π«Ά and it is long, so buckle up:
Kernel file ./net/socket.c move_addr_to_user(9), sock_read_xattr(9), sock_alloc_file(9), sock_from_file(9), sockfd_lookup(9), sock_alloc(9), sock_release(9), sock_sendmsg(9), kernel_sendmsg(9), sock_recvmsg(9), kernel_recvmsg(9), sock_create_lite(9), __sock_create(9), sock_create(9), sock_create_kern(9), sock_register(9), sock_unregister(9), kernel_bind(9), kernel_listen(9), kernel_accept(9), kernel_connect(9), kernel_getsockname(9), kernel_getpeername(9), kernel_sock_shutdown(9), kernel_sock_ip_overhead(9)
like i said. whole friend group. main character energy all around π
π that's the whole page bestie, go forth and copy those socket addresses responsibly π
this little love letter lives in the ./net source tree, dated October 2026, and it's filed under move_addr_to_kernel(9) π¦ mwah, bye β¨
π¦ where this page comes from
- nixpkgs unstable: linux-manual 7.3.1
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms