apparmor_socket_bind(9)
π
apparmor_socket_bind β a Kernel API Manual moment (yes, that's the apparmor_socket_bind(9) page bestie, section 9, kernel-land, we're in it)
okay so picture this: you're about to let a socket get bound to an address, and AppArmor is standing there like the group chat moderator going "hold up, let me check something first." That's this function. She's the vibe check before the bind. β¨
πΈ NAME πΈ
apparmor_socket_bind β literally just checking perms before you bind an addr to a socket, no big deal, iconic behaviour only π
π¦ SYNOPSIS π¦
int apparmor_socket_bind (struct socket *sock , struct sockaddr *address
, int addrlen );
like, exactly that, don't come for me about the spacing, that's how she's written π
π ARGUMENTS π
sockβ the socket you wanna bind the address to. must be non-NULL fr fr, don't be out here passing NULL, that's not the move πaddressβ the address that's being bound. also must be non-NULL. yes both of them. it's giving "read the requirements" energy πaddrlenβ the length of the address. just a lilint, keeping it simple, we love that for her π
β¨ DESCRIPTION β¨
so what she actually does: she performs security checks before allowing a socket to bind to an address. that's the whole job. gatekeeping, but make it kernel security π«Ά
and here's where it gets cute β she handles Unix domain sockets specially, through aa_unix_bind_perm. special treatment! main character energy for unix sockets only π
β¨
for other socket families, she doesn't do anything fancy, she just uses the generic permission check via aa_sk_perm. one size fits all, lowkey efficient, ngl kind of a slay π
not me explaining kernel LSM hooks in a group chat voice π but like, it works, and that's what matters.
π₯ RETURN π₯
0β binding is permitted. congrats bestie, you're so valid, go off π- error code β on denial or invalid parameters. yeah. if she says no, she means no π
β SEE ALSO β
the whole friend group, no cap, here's everyone:
Kernel file ./security/apparmor/lsm.c, plus common_perm(9), common_perm_cond(9), common_perm_dir_dentry(9), common_perm_rm(9), common_perm_create(9), apparmor_uring_override_creds(9), apparmor_uring_sqpoll(9), apparmor_bprm_committing_creds(9), apparmor_bprm_committed_creds(9), apparmor_sk_clone_security(9), apparmor_unix_stream_connect(9), apparmor_unix_may_send(9), apparmor_socket_post_create(9), apparmor_socket_getpeersec_stream(9), apparmor_socket_getpeersec_dgram(9), apparmor_sock_graft(9), apparmor_socket_sock_rcv_skb(9), and set_init_ctx(9).
like I said. the whole group chat. go say hi πΈπ¦
and that's the page!! sign-off time π this lil masterpiece lives in ./security/apparmor, dated October 2026, and it's filed under apparmor_socket_bind(9) β mwah, periodt, bye bestie ππ
π¦ 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