get_kernel_syms(2)

πŸ’– get_kernel_syms(2) β€” System Calls Manual πŸ’–

okay bestie, we are SO in the System Calls Manual rn, and the page is get_kernel_syms(2). It's ancient, it's deprecated, it's lowkey legendary. Let's get into it. 🫢✨

✨ NAME ✨

get_kernel_syms β€” retrieve exported kernel and module symbols

πŸ¦‹ SYNOPSIS πŸ¦‹

#include <linux/module.h>

[[deprecated]] int get_kernel_syms(struct kernel_sym *table);

🌸 DESCRIPTION 🌸

Note, bestie: This system call is present only before Linux 2.6. So if you're on anything newer, she's not there, periodt. πŸ’…

If table is NULL, get_kernel_syms() returns the number of symbols available for query. Otherwise, it fills in a table of structures:

struct kernel_sym {
    unsigned long value;
    char          name[60];
};

The symbols are interspersed with magic symbols of the form #module-name with the kernel having an empty name. The value associated with a symbol of this form is the address at which the module is loaded. 🧚

The symbols exported from each module follow their magic module tag and the modules are returned in the reverse of the order in which they were loaded.

πŸ”₯ RETURN VALUE πŸ”₯

On success, returns the number of symbols copied to table. On error, -1 is returned and errno is set to indicate the error. That's the whole return value moment. 😭

πŸ’€ ERRORS πŸ’€

There is only one possible error return:

  • ENOSYS β€” get_kernel_syms() is not supported in this version of the kernel.

⭐ STANDARDS ⭐

Linux. 🌟 (iconic, honestly.)

πŸ‘‘ HISTORY πŸ‘‘

Removed in Linux 2.6.

This obsolete system call is not supported by glibc. No declaration is provided in glibc headers, but, through a quirk of history, glibc versions before glibc 2.23 did export an ABI for this system call. Therefore, in order to employ this system call, it was sufficient to manually declare the interface in your code; alternatively, you could invoke the system call using syscall(2). The lore is lore-ing. 🫢

😭 BUGS 😭

There is no way to indicate the size of the buffer allocated for table. If symbols have been added to the kernel since the program queried for the symbol table size, memory will be corrupted. That's not a cute bug, that's a danger. πŸ’€

The length of exported symbol names is limited to 59 characters.

Because of these limitations, this system call is deprecated in favor of query_module(2) (which is itself nowadays deprecated in favor of other interfaces described on its manual page).

🌈 SEE ALSO 🌈

create_module(2), delete_module(2), init_module(2), query_module(2)


That's the tea, bestie 🫢 β€” from Linux man-pages 6.20, dated 2025-05-17, all about get_kernel_syms(2). πŸ’–

πŸ“¦ where this page comes from
  • arch rolling: man-pages 6.20-1 Β· BSD-2-Clause AND BSD-3-Clause AND BSD-4.3TAHOE AND BSD-4-Clause-UC AND GPL-1.0-or-later AND GPL-2.0-only AND GPL-2.0-or-later AND GPL-3.0-or-later AND LGPL-3.0-linking-exception AND LGPL-3.0-or-later AND LicenseRef-Public-Domain AND LicenseRef-UltraPermissive AND Linux-man-pages-1-para AND Linux-man-pages-copyleft AND Linux-man-pages-copyleft-2-para AND Linux-man-pages-copyleft-var AND MIT AND Spencer-94
  • nixpkgs unstable: man-pages 6.20
  • πŸ“œ the page's license: GPL-1.0-or-later
  • πŸ’– girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms