sphinx.addnodesdocument)}( rawsourcechildren]( translations LanguagesNode)}(hhh](h pending_xref)}(hhh]docutils.nodesTextChinese (Simplified)}parenthsba attributes}(ids]classes]names]dupnames]backrefs] refdomainstdreftypedoc reftarget+/translations/zh_CN/process/adding-syscallsmodnameN classnameN refexplicitutagnamehhh ubh)}(hhh]hChinese (Traditional)}hh2sbah}(h]h ]h"]h$]h&] refdomainh)reftypeh+ reftarget+/translations/zh_TW/process/adding-syscallsmodnameN classnameN refexplicituh1hhh ubh)}(hhh]hItalian}hhFsbah}(h]h ]h"]h$]h&] refdomainh)reftypeh+ reftarget+/translations/it_IT/process/adding-syscallsmodnameN classnameN refexplicituh1hhh ubh)}(hhh]hJapanese}hhZsbah}(h]h ]h"]h$]h&] refdomainh)reftypeh+ reftarget+/translations/ja_JP/process/adding-syscallsmodnameN classnameN refexplicituh1hhh ubh)}(hhh]hKorean}hhnsbah}(h]h ]h"]h$]h&] refdomainh)reftypeh+ reftarget+/translations/ko_KR/process/adding-syscallsmodnameN classnameN refexplicituh1hhh ubh)}(hhh]hSpanish}hhsbah}(h]h ]h"]h$]h&] refdomainh)reftypeh+ reftarget+/translations/sp_SP/process/adding-syscallsmodnameN classnameN refexplicituh1hhh ubeh}(h]h ]h"]h$]h&]current_languageEnglishuh1h hh _documenthsourceNlineNubhtarget)}(h.. _addsyscalls:h]h}(h]h ]h"]h$]h&]refid addsyscallsuh1hhKhhhhhE/var/lib/git/docbuild/linux/Documentation/process/adding-syscalls.rstubhsection)}(hhh](htitle)}(hAdding a New System Callh]hAdding a New System Call}(hhhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhhhhhKubh paragraph)}(hThis document describes what's involved in adding a new system call to the Linux kernel, over and above the normal submission advice in :ref:`Documentation/process/submitting-patches.rst `.h](hThis document describes what’s involved in adding a new system call to the Linux kernel, over and above the normal submission advice in }(hhhhhNhNubh)}(hG:ref:`Documentation/process/submitting-patches.rst `h]hinline)}(hhh]h,Documentation/process/submitting-patches.rst}(hhhhhNhNubah}(h]h ](xrefstdstd-refeh"]h$]h&]uh1hhhubah}(h]h ]h"]h$]h&]refdocprocess/adding-syscalls refdomainhreftyperef refexplicitrefwarn reftargetsubmittingpatchesuh1hhhhKhhubh.}(hhhhhNhNubeh}(h]h ]h"]h$]h&]uh1hhhhKhhhhubh)}(hhh](h)}(hSystem Call Alternativesh]hSystem Call Alternatives}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhhhhhK ubh)}(hX8The first thing to consider when adding a new system call is whether one of the alternatives might be suitable instead. Although system calls are the most traditional and most obvious interaction points between userspace and the kernel, there are other possibilities -- choose what fits best for your interface.h]hX8The first thing to consider when adding a new system call is whether one of the alternatives might be suitable instead. Although system calls are the most traditional and most obvious interaction points between userspace and the kernel, there are other possibilities -- choose what fits best for your interface.}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKhhhhubh block_quote)}(hX!- If the operations involved can be made to look like a filesystem-like object, it may make more sense to create a new filesystem or device. This also makes it easier to encapsulate the new functionality in a kernel module rather than requiring it to be built into the main kernel. - If the new functionality involves operations where the kernel notifies userspace that something has happened, then returning a new file descriptor for the relevant object allows userspace to use ``poll``/``select``/``epoll`` to receive that notification. - However, operations that don't map to :manpage:`read(2)`/:manpage:`write(2)`-like operations have to be implemented as :manpage:`ioctl(2)` requests, which can lead to a somewhat opaque API. - If you're just exposing runtime system information, a new node in sysfs (see ``Documentation/filesystems/sysfs.rst``) or the ``/proc`` filesystem may be more appropriate. However, access to these mechanisms requires that the relevant filesystem is mounted, which might not always be the case (e.g. in a namespaced/sandboxed/chrooted environment). Avoid adding any API to debugfs, as this is not considered a 'production' interface to userspace. - If the operation is specific to a particular file or file descriptor, then an additional :manpage:`fcntl(2)` command option may be more appropriate. However, :manpage:`fcntl(2)` is a multiplexing system call that hides a lot of complexity, so this option is best for when the new function is closely analogous to existing :manpage:`fcntl(2)` functionality, or the new functionality is very simple (for example, getting/setting a simple flag related to a file descriptor). - If the operation is specific to a particular task or process, then an additional :manpage:`prctl(2)` command option may be more appropriate. As with :manpage:`fcntl(2)`, this system call is a complicated multiplexor so is best reserved for near-analogs of existing ``prctl()`` commands or getting/setting a simple flag related to a process. h]h bullet_list)}(hhh](h list_item)}(hXIf the operations involved can be made to look like a filesystem-like object, it may make more sense to create a new filesystem or device. This also makes it easier to encapsulate the new functionality in a kernel module rather than requiring it to be built into the main kernel. - If the new functionality involves operations where the kernel notifies userspace that something has happened, then returning a new file descriptor for the relevant object allows userspace to use ``poll``/``select``/``epoll`` to receive that notification. - However, operations that don't map to :manpage:`read(2)`/:manpage:`write(2)`-like operations have to be implemented as :manpage:`ioctl(2)` requests, which can lead to a somewhat opaque API. h](h)}(hXIf the operations involved can be made to look like a filesystem-like object, it may make more sense to create a new filesystem or device. This also makes it easier to encapsulate the new functionality in a kernel module rather than requiring it to be built into the main kernel.h]hXIf the operations involved can be made to look like a filesystem-like object, it may make more sense to create a new filesystem or device. This also makes it easier to encapsulate the new functionality in a kernel module rather than requiring it to be built into the main kernel.}(hj.hhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKhj*ubj)}(hX- If the new functionality involves operations where the kernel notifies userspace that something has happened, then returning a new file descriptor for the relevant object allows userspace to use ``poll``/``select``/``epoll`` to receive that notification. - However, operations that don't map to :manpage:`read(2)`/:manpage:`write(2)`-like operations have to be implemented as :manpage:`ioctl(2)` requests, which can lead to a somewhat opaque API. h]j$)}(hhh](j))}(hIf the new functionality involves operations where the kernel notifies userspace that something has happened, then returning a new file descriptor for the relevant object allows userspace to use ``poll``/``select``/``epoll`` to receive that notification.h]h)}(hIf the new functionality involves operations where the kernel notifies userspace that something has happened, then returning a new file descriptor for the relevant object allows userspace to use ``poll``/``select``/``epoll`` to receive that notification.h](hIf the new functionality involves operations where the kernel notifies userspace that something has happened, then returning a new file descriptor for the relevant object allows userspace to use }(hjGhhhNhNubhliteral)}(h``poll``h]hpoll}(hjQhhhNhNubah}(h]h ]h"]h$]h&]uh1jOhjGubh/}(hjGhhhNhNubjP)}(h ``select``h]hselect}(hjchhhNhNubah}(h]h ]h"]h$]h&]uh1jOhjGubh/}hjGsbjP)}(h ``epoll``h]hepoll}(hjuhhhNhNubah}(h]h ]h"]h$]h&]uh1jOhjGubh to receive that notification.}(hjGhhhNhNubeh}(h]h ]h"]h$]h&]uh1hhhhKhjCubah}(h]h ]h"]h$]h&]uh1j(hj@ubj))}(hHowever, operations that don't map to :manpage:`read(2)`/:manpage:`write(2)`-like operations have to be implemented as :manpage:`ioctl(2)` requests, which can lead to a somewhat opaque API. h]h)}(hHowever, operations that don't map to :manpage:`read(2)`/:manpage:`write(2)`-like operations have to be implemented as :manpage:`ioctl(2)` requests, which can lead to a somewhat opaque API.h](h(However, operations that don’t map to }(hjhhhNhNubhmanpage)}(h:manpage:`read(2)`h]hread(2)}(hjhhhNhNubah}(h]h ]jah"]h$]h&] xml:spacepreservepathread(2)pagereadsection2uh1jhjubh/}(hjhhhNhNubj)}(h:manpage:`write(2)`h]hwrite(2)}(hjhhhNhNubah}(h]h ]jah"]h$]h&]jjjwrite(2)jwritejjuh1jhjubh+-like operations have to be implemented as }(hjhhhNhNubj)}(h:manpage:`ioctl(2)`h]hioctl(2)}(hjhhhNhNubah}(h]h ]jah"]h$]h&]jjjioctl(2)jioctljjuh1jhjubh3 requests, which can lead to a somewhat opaque API.}(hjhhhNhNubeh}(h]h ]h"]h$]h&]uh1hhhhKhjubah}(h]h ]h"]h$]h&]uh1j(hj@ubeh}(h]h ]h"]h$]h&]bullet-uh1j#hhhKhj<ubah}(h]h ]h"]h$]h&]uh1jhhhKhj*ubeh}(h]h ]h"]h$]h&]uh1j(hj%ubj))}(hXIf you're just exposing runtime system information, a new node in sysfs (see ``Documentation/filesystems/sysfs.rst``) or the ``/proc`` filesystem may be more appropriate. However, access to these mechanisms requires that the relevant filesystem is mounted, which might not always be the case (e.g. in a namespaced/sandboxed/chrooted environment). Avoid adding any API to debugfs, as this is not considered a 'production' interface to userspace.h]h)}(hXIf you're just exposing runtime system information, a new node in sysfs (see ``Documentation/filesystems/sysfs.rst``) or the ``/proc`` filesystem may be more appropriate. However, access to these mechanisms requires that the relevant filesystem is mounted, which might not always be the case (e.g. in a namespaced/sandboxed/chrooted environment). Avoid adding any API to debugfs, as this is not considered a 'production' interface to userspace.h](hOIf you’re just exposing runtime system information, a new node in sysfs (see }(hjhhhNhNubjP)}(h'``Documentation/filesystems/sysfs.rst``h]h#Documentation/filesystems/sysfs.rst}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1jOhjubh ) or the }(hjhhhNhNubjP)}(h ``/proc``h]h/proc}(hj!hhhNhNubah}(h]h ]h"]h$]h&]uh1jOhjubhX< filesystem may be more appropriate. However, access to these mechanisms requires that the relevant filesystem is mounted, which might not always be the case (e.g. in a namespaced/sandboxed/chrooted environment). Avoid adding any API to debugfs, as this is not considered a ‘production’ interface to userspace.}(hjhhhNhNubeh}(h]h ]h"]h$]h&]uh1hhhhK#hjubah}(h]h ]h"]h$]h&]uh1j(hj%ubj))}(hXIf the operation is specific to a particular file or file descriptor, then an additional :manpage:`fcntl(2)` command option may be more appropriate. However, :manpage:`fcntl(2)` is a multiplexing system call that hides a lot of complexity, so this option is best for when the new function is closely analogous to existing :manpage:`fcntl(2)` functionality, or the new functionality is very simple (for example, getting/setting a simple flag related to a file descriptor).h]h)}(hXIf the operation is specific to a particular file or file descriptor, then an additional :manpage:`fcntl(2)` command option may be more appropriate. However, :manpage:`fcntl(2)` is a multiplexing system call that hides a lot of complexity, so this option is best for when the new function is closely analogous to existing :manpage:`fcntl(2)` functionality, or the new functionality is very simple (for example, getting/setting a simple flag related to a file descriptor).h](hYIf the operation is specific to a particular file or file descriptor, then an additional }(hjChhhNhNubj)}(h:manpage:`fcntl(2)`h]hfcntl(2)}(hjKhhhNhNubah}(h]h ]jah"]h$]h&]jjjfcntl(2)jfcntljjuh1jhjCubh3 command option may be more appropriate. However, }(hjChhhNhNubj)}(h:manpage:`fcntl(2)`h]hfcntl(2)}(hj_hhhNhNubah}(h]h ]jah"]h$]h&]jjjfcntl(2)jfcntljjuh1jhjCubh is a multiplexing system call that hides a lot of complexity, so this option is best for when the new function is closely analogous to existing }(hjChhhNhNubj)}(h:manpage:`fcntl(2)`h]hfcntl(2)}(hjshhhNhNubah}(h]h ]jah"]h$]h&]jjjfcntl(2)jfcntljjuh1jhjCubh functionality, or the new functionality is very simple (for example, getting/setting a simple flag related to a file descriptor).}(hjChhhNhNubeh}(h]h ]h"]h$]h&]uh1hhhhK)hj?ubah}(h]h ]h"]h$]h&]uh1j(hj%ubj))}(hXWIf the operation is specific to a particular task or process, then an additional :manpage:`prctl(2)` command option may be more appropriate. As with :manpage:`fcntl(2)`, this system call is a complicated multiplexor so is best reserved for near-analogs of existing ``prctl()`` commands or getting/setting a simple flag related to a process. h]h)}(hXUIf the operation is specific to a particular task or process, then an additional :manpage:`prctl(2)` command option may be more appropriate. As with :manpage:`fcntl(2)`, this system call is a complicated multiplexor so is best reserved for near-analogs of existing ``prctl()`` commands or getting/setting a simple flag related to a process.h](hQIf the operation is specific to a particular task or process, then an additional }(hjhhhNhNubj)}(h:manpage:`prctl(2)`h]hprctl(2)}(hjhhhNhNubah}(h]h ]jah"]h$]h&]jjjprctl(2)jprctljjuh1jhjubh2 command option may be more appropriate. As with }(hjhhhNhNubj)}(h:manpage:`fcntl(2)`h]hfcntl(2)}(hjhhhNhNubah}(h]h ]jah"]h$]h&]jjjfcntl(2)jfcntljjuh1jhjubha, this system call is a complicated multiplexor so is best reserved for near-analogs of existing }(hjhhhNhNubjP)}(h ``prctl()``h]hprctl()}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1jOhjubh@ commands or getting/setting a simple flag related to a process.}(hjhhhNhNubeh}(h]h ]h"]h$]h&]uh1hhhhK/hjubah}(h]h ]h"]h$]h&]uh1j(hj%ubeh}(h]h ]h"]h$]h&]jjuh1j#hhhKhjubah}(h]h ]h"]h$]h&]uh1jhhhKhhhhubeh}(h]system-call-alternativesah ]h"]system call alternativesah$]h&]uh1hhhhhhhhK ubh)}(hhh](h)}(h)Designing the API: Planning for Extensionh]h)Designing the API: Planning for Extension}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhjhhhhhK7ubh)}(hA new system call forms part of the API of the kernel, and has to be supported indefinitely. As such, it's a very good idea to explicitly discuss the interface on the kernel mailing list, and it's important to plan for future extensions of the interface.h]hXA new system call forms part of the API of the kernel, and has to be supported indefinitely. As such, it’s a very good idea to explicitly discuss the interface on the kernel mailing list, and it’s important to plan for future extensions of the interface.}(hj hhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhK9hjhhubh)}(hX](The syscall table is littered with historical examples where this wasn't done, together with the corresponding follow-up system calls -- ``eventfd``/``eventfd2``, ``dup2``/``dup3``, ``inotify_init``/``inotify_init1``, ``pipe``/``pipe2``, ``renameat``/``renameat2`` -- so learn from the history of the kernel and plan for extensions from the start.)h](h(The syscall table is littered with historical examples where this wasn’t done, together with the corresponding follow-up system calls -- }(hjhhhNhNubjP)}(h ``eventfd``h]heventfd}(hj hhhNhNubah}(h]h ]h"]h$]h&]uh1jOhjubh/}(hjhhhNhNubjP)}(h ``eventfd2``h]heventfd2}(hj2hhhNhNubah}(h]h ]h"]h$]h&]uh1jOhjubh, }(hjhhhNhNubjP)}(h``dup2``h]hdup2}(hjDhhhNhNubah}(h]h ]h"]h$]h&]uh1jOhjubh/}hjsbjP)}(h``dup3``h]hdup3}(hjVhhhNhNubah}(h]h ]h"]h$]h&]uh1jOhjubh, }hjsbjP)}(h``inotify_init``h]h inotify_init}(hjhhhhNhNubah}(h]h ]h"]h$]h&]uh1jOhjubh/}hjsbjP)}(h``inotify_init1``h]h inotify_init1}(hjzhhhNhNubah}(h]h ]h"]h$]h&]uh1jOhjubh, }(hjhhhNhNubjP)}(h``pipe``h]hpipe}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1jOhjubh/}hjsbjP)}(h ``pipe2``h]hpipe2}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1jOhjubh, }hjsbjP)}(h ``renameat``h]hrenameat}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1jOhjubh/}hjsbjP)}(h ``renameat2``h]h renameat2}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1jOhjubhT -- so learn from the history of the kernel and plan for extensions from the start.)}(hjhhhNhNubeh}(h]h ]h"]h$]h&]uh1hhhhK>hjhhubh)}(hXjFor simpler system calls that only take a couple of arguments, the preferred way to allow for future extensibility is to include a flags argument to the system call. To make sure that userspace programs can safely use flags between kernel versions, check whether the flags value holds any unknown flags, and reject the system call (with ``EINVAL``) if it does::h](hXRFor simpler system calls that only take a couple of arguments, the preferred way to allow for future extensibility is to include a flags argument to the system call. To make sure that userspace programs can safely use flags between kernel versions, check whether the flags value holds any unknown flags, and reject the system call (with }(hjhhhNhNubjP)}(h ``EINVAL``h]hEINVAL}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1jOhjubh ) if it does:}(hjhhhNhNubeh}(h]h ]h"]h$]h&]uh1hhhhKDhjhhubh literal_block)}(hKif (flags & ~(THING_FLAG1 | THING_FLAG2 | THING_FLAG3)) return -EINVAL;h]hKif (flags & ~(THING_FLAG1 | THING_FLAG2 | THING_FLAG3)) return -EINVAL;}hjsbah}(h]h ]h"]h$]h&]jjuh1jhhhKJhjhhubh)}(hI(If no flags values are used yet, check that the flags argument is zero.)h]hI(If no flags values are used yet, check that the flags argument is zero.)}(hj hhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKMhjhhubh)}(hXFor more sophisticated system calls that involve a larger number of arguments, it's preferred to encapsulate the majority of the arguments into a structure that is passed in by pointer. Such a structure can cope with future extension by including a size argument in the structure::h]hXFor more sophisticated system calls that involve a larger number of arguments, it’s preferred to encapsulate the majority of the arguments into a structure that is passed in by pointer. Such a structure can cope with future extension by including a size argument in the structure:}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKOhjhhubj)}(hstruct xyzzy_params { u32 size; /* userspace sets p->size = sizeof(struct xyzzy_params) */ u32 param_1; u64 param_2; u64 param_3; };h]hstruct xyzzy_params { u32 size; /* userspace sets p->size = sizeof(struct xyzzy_params) */ u32 param_1; u64 param_2; u64 param_3; };}hj&sbah}(h]h ]h"]h$]h&]jjuh1jhhhKThjhhubh)}(hAs long as any subsequently added field, say ``param_4``, is designed so that a zero value gives the previous behaviour, then this allows both directions of version mismatch:h](h-As long as any subsequently added field, say }(hj4hhhNhNubjP)}(h ``param_4``h]hparam_4}(hj<hhhNhNubah}(h]h ]h"]h$]h&]uh1jOhj4ubhv, is designed so that a zero value gives the previous behaviour, then this allows both directions of version mismatch:}(hj4hhhNhNubeh}(h]h ]h"]h$]h&]uh1hhhhK[hjhhubj)}(hX- To cope with a later userspace program calling an older kernel, the kernel code should check that any memory beyond the size of the structure that it expects is zero (effectively checking that ``param_4 == 0``). - To cope with an older userspace program calling a newer kernel, the kernel code can zero-extend a smaller instance of the structure (effectively setting ``param_4 = 0``). h]j$)}(hhh](j))}(hTo cope with a later userspace program calling an older kernel, the kernel code should check that any memory beyond the size of the structure that it expects is zero (effectively checking that ``param_4 == 0``).h]h)}(hTo cope with a later userspace program calling an older kernel, the kernel code should check that any memory beyond the size of the structure that it expects is zero (effectively checking that ``param_4 == 0``).h](hTo cope with a later userspace program calling an older kernel, the kernel code should check that any memory beyond the size of the structure that it expects is zero (effectively checking that }(hj_hhhNhNubjP)}(h``param_4 == 0``h]h param_4 == 0}(hjghhhNhNubah}(h]h ]h"]h$]h&]uh1jOhj_ubh).}(hj_hhhNhNubeh}(h]h ]h"]h$]h&]uh1hhhhK_hj[ubah}(h]h ]h"]h$]h&]uh1j(hjXubj))}(hTo cope with an older userspace program calling a newer kernel, the kernel code can zero-extend a smaller instance of the structure (effectively setting ``param_4 = 0``). h]h)}(hTo cope with an older userspace program calling a newer kernel, the kernel code can zero-extend a smaller instance of the structure (effectively setting ``param_4 = 0``).h](hTo cope with an older userspace program calling a newer kernel, the kernel code can zero-extend a smaller instance of the structure (effectively setting }(hjhhhNhNubjP)}(h``param_4 = 0``h]h param_4 = 0}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1jOhjubh).}(hjhhhNhNubeh}(h]h ]h"]h$]h&]uh1hhhhKbhjubah}(h]h ]h"]h$]h&]uh1j(hjXubeh}(h]h ]h"]h$]h&]jjuh1j#hhhK_hjTubah}(h]h ]h"]h$]h&]uh1jhhhK_hjhhubh)}(hSee :manpage:`perf_event_open(2)` and the ``perf_copy_attr()`` function (in ``kernel/events/core.c``) for an example of this approach.h](hSee }(hjhhhNhNubj)}(h:manpage:`perf_event_open(2)`h]hperf_event_open(2)}(hjhhhNhNubah}(h]h ]jah"]h$]h&]jjjperf_event_open(2)jperf_event_openjjuh1jhjubh and the }(hjhhhNhNubjP)}(h``perf_copy_attr()``h]hperf_copy_attr()}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1jOhjubh function (in }(hjhhhNhNubjP)}(h``kernel/events/core.c``h]hkernel/events/core.c}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1jOhjubh") for an example of this approach.}(hjhhhNhNubeh}(h]h ]h"]h$]h&]uh1hhhhKfhjhhubeh}(h](designing-the-api-planning-for-extensionah ]h"])designing the api: planning for extensionah$]h&]uh1hhhhhhhhK7ubh)}(hhh](h)}(h'Designing the API: Other Considerationsh]h'Designing the API: Other Considerations}(hj hhhNhNubah}(h]h ]h"]h$]h&]uh1hhj hhhhhKkubh)}(hXIf your new system call allows userspace to refer to a kernel object, it should use a file descriptor as the handle for that object -- don't invent a new type of userspace object handle when the kernel already has mechanisms and well-defined semantics for using file descriptors.h]hXIf your new system call allows userspace to refer to a kernel object, it should use a file descriptor as the handle for that object -- don’t invent a new type of userspace object handle when the kernel already has mechanisms and well-defined semantics for using file descriptors.}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKmhj hhubh)}(hXpIf your new :manpage:`xyzzy(2)` system call does return a new file descriptor, then the flags argument should include a value that is equivalent to setting ``O_CLOEXEC`` on the new FD. This makes it possible for userspace to close the timing window between ``xyzzy()`` and calling ``fcntl(fd, F_SETFD, FD_CLOEXEC)``, where an unexpected ``fork()`` and ``execve()`` in another thread could leak a descriptor to the exec'ed program. (However, resist the temptation to re-use the actual value of the ``O_CLOEXEC`` constant, as it is architecture-specific and is part of a numbering space of ``O_*`` flags that is fairly full.)h](h If your new }(hj(hhhNhNubj)}(h:manpage:`xyzzy(2)`h]hxyzzy(2)}(hj0hhhNhNubah}(h]h ]jah"]h$]h&]jjjxyzzy(2)jxyzzyjjuh1jhj(ubh} system call does return a new file descriptor, then the flags argument should include a value that is equivalent to setting }(hj(hhhNhNubjP)}(h ``O_CLOEXEC``h]h O_CLOEXEC}(hjDhhhNhNubah}(h]h ]h"]h$]h&]uh1jOhj(ubhY on the new FD. This makes it possible for userspace to close the timing window between }(hj(hhhNhNubjP)}(h ``xyzzy()``h]hxyzzy()}(hjVhhhNhNubah}(h]h ]h"]h$]h&]uh1jOhj(ubh and calling }(hj(hhhNhNubjP)}(h"``fcntl(fd, F_SETFD, FD_CLOEXEC)``h]hfcntl(fd, F_SETFD, FD_CLOEXEC)}(hjhhhhNhNubah}(h]h ]h"]h$]h&]uh1jOhj(ubh, where an unexpected }(hj(hhhNhNubjP)}(h ``fork()``h]hfork()}(hjzhhhNhNubah}(h]h ]h"]h$]h&]uh1jOhj(ubh and }(hj(hhhNhNubjP)}(h ``execve()``h]hexecve()}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1jOhj(ubh in another thread could leak a descriptor to the exec’ed program. (However, resist the temptation to re-use the actual value of the }(hj(hhhNhNubjP)}(h ``O_CLOEXEC``h]h O_CLOEXEC}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1jOhj(ubhN constant, as it is architecture-specific and is part of a numbering space of }(hj(hhhNhNubjP)}(h``O_*``h]hO_*}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1jOhj(ubh flags that is fairly full.)}(hj(hhhNhNubeh}(h]h ]h"]h$]h&]uh1hhhhKrhj hhubh)}(hXVIf your system call returns a new file descriptor, you should also consider what it means to use the :manpage:`poll(2)` family of system calls on that file descriptor. Making a file descriptor ready for reading or writing is the normal way for the kernel to indicate to userspace that an event has occurred on the corresponding kernel object.h](heIf your system call returns a new file descriptor, you should also consider what it means to use the }(hjhhhNhNubj)}(h:manpage:`poll(2)`h]hpoll(2)}(hjhhhNhNubah}(h]h ]jah"]h$]h&]jjjpoll(2)jpolljjuh1jhjubh family of system calls on that file descriptor. Making a file descriptor ready for reading or writing is the normal way for the kernel to indicate to userspace that an event has occurred on the corresponding kernel object.}(hjhhhNhNubeh}(h]h ]h"]h$]h&]uh1hhhhK|hj hhubh)}(hJIf your new :manpage:`xyzzy(2)` system call involves a filename argument::h](h If your new }(hjhhhNhNubj)}(h:manpage:`xyzzy(2)`h]hxyzzy(2)}(hjhhhNhNubah}(h]h ]jah"]h$]h&]jjjxyzzy(2)jxyzzyjjuh1jhjubh* system call involves a filename argument:}(hjhhhNhNubeh}(h]h ]h"]h$]h&]uh1hhhhKhj hhubj)}(h@int sys_xyzzy(const char __user *path, ..., unsigned int flags);h]h@int sys_xyzzy(const char __user *path, ..., unsigned int flags);}hj sbah}(h]h ]h"]h$]h&]jjuh1jhhhKhj hhubh)}(hWyou should also consider whether an :manpage:`xyzzyat(2)` version is more appropriate::h](h$you should also consider whether an }(hjhhhNhNubj)}(h:manpage:`xyzzyat(2)`h]h xyzzyat(2)}(hj"hhhNhNubah}(h]h ]jah"]h$]h&]jjj xyzzyat(2)jxyzzyatjjuh1jhjubh version is more appropriate:}(hjhhhNhNubeh}(h]h ]h"]h$]h&]uh1hhhhKhj hhubj)}(hKint sys_xyzzyat(int dfd, const char __user *path, ..., unsigned int flags);h]hKint sys_xyzzyat(int dfd, const char __user *path, ..., unsigned int flags);}hj<sbah}(h]h ]h"]h$]h&]jjuh1jhhhKhj hhubh)}(hXThis allows more flexibility for how userspace specifies the file in question; in particular it allows userspace to request the functionality for an already-opened file descriptor using the ``AT_EMPTY_PATH`` flag, effectively giving an :manpage:`fxyzzy(3)` operation for free::h](hThis allows more flexibility for how userspace specifies the file in question; in particular it allows userspace to request the functionality for an already-opened file descriptor using the }(hjJhhhNhNubjP)}(h``AT_EMPTY_PATH``h]h AT_EMPTY_PATH}(hjRhhhNhNubah}(h]h ]h"]h$]h&]uh1jOhjJubh flag, effectively giving an }(hjJhhhNhNubj)}(h:manpage:`fxyzzy(3)`h]h fxyzzy(3)}(hjdhhhNhNubah}(h]h ]jah"]h$]h&]jjj fxyzzy(3)jfxyzzyj3uh1jhjJubh operation for free:}(hjJhhhNhNubeh}(h]h ]h"]h$]h&]uh1hhhhKhj hhubj)}(h- xyzzyat(AT_FDCWD, path, ..., 0) is equivalent to xyzzy(path,...) - xyzzyat(fd, "", ..., AT_EMPTY_PATH) is equivalent to fxyzzy(fd, ...)h]h- xyzzyat(AT_FDCWD, path, ..., 0) is equivalent to xyzzy(path,...) - xyzzyat(fd, "", ..., AT_EMPTY_PATH) is equivalent to fxyzzy(fd, ...)}hjsbah}(h]h ]h"]h$]h&]jjuh1jhhhKhj hhubh)}(h(For more details on the rationale of the \*at() calls, see the :manpage:`openat(2)` man page; for an example of AT_EMPTY_PATH, see the :manpage:`fstatat(2)` man page.)h](h@(For more details on the rationale of the *at() calls, see the }(hjhhhNhNubj)}(h:manpage:`openat(2)`h]h openat(2)}(hjhhhNhNubah}(h]h ]jah"]h$]h&]jjj openat(2)jopenatjjuh1jhjubh4 man page; for an example of AT_EMPTY_PATH, see the }(hjhhhNhNubj)}(h:manpage:`fstatat(2)`h]h fstatat(2)}(hjhhhNhNubah}(h]h ]jah"]h$]h&]jjj fstatat(2)jfstatatjjuh1jhjubh man page.)}(hjhhhNhNubeh}(h]h ]h"]h$]h&]uh1hhhhKhj hhubh)}(hIf your new :manpage:`xyzzy(2)` system call involves a parameter describing an offset within a file, make its type ``loff_t`` so that 64-bit offsets can be supported even on 32-bit architectures.h](h If your new }(hjhhhNhNubj)}(h:manpage:`xyzzy(2)`h]hxyzzy(2)}(hjhhhNhNubah}(h]h ]jah"]h$]h&]jjjxyzzy(2)jxyzzyjjuh1jhjubhT system call involves a parameter describing an offset within a file, make its type }(hjhhhNhNubjP)}(h ``loff_t``h]hloff_t}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1jOhjubhF so that 64-bit offsets can be supported even on 32-bit architectures.}(hjhhhNhNubeh}(h]h ]h"]h$]h&]uh1hhhhKhj hhubh)}(hXBIf your new :manpage:`xyzzy(2)` system call involves privileged functionality, it needs to be governed by the appropriate Linux capability bit (checked with a call to ``capable()``), as described in the :manpage:`capabilities(7)` man page. Choose an existing capability bit that governs related functionality, but try to avoid combining lots of only vaguely related functions together under the same bit, as this goes against capabilities' purpose of splitting the power of root. In particular, avoid adding new uses of the already overly-general ``CAP_SYS_ADMIN`` capability.h](h If your new }(hjhhhNhNubj)}(h:manpage:`xyzzy(2)`h]hxyzzy(2)}(hjhhhNhNubah}(h]h ]jah"]h$]h&]jjjxyzzy(2)jxyzzyjjuh1jhjubh system call involves privileged functionality, it needs to be governed by the appropriate Linux capability bit (checked with a call to }(hjhhhNhNubjP)}(h ``capable()``h]h capable()}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1jOhjubh), as described in the }(hjhhhNhNubj)}(h:manpage:`capabilities(7)`h]hcapabilities(7)}(hj%hhhNhNubah}(h]h ]jah"]h$]h&]jjjcapabilities(7)j capabilitiesj7uh1jhjubhXB man page. Choose an existing capability bit that governs related functionality, but try to avoid combining lots of only vaguely related functions together under the same bit, as this goes against capabilities’ purpose of splitting the power of root. In particular, avoid adding new uses of the already overly-general }(hjhhhNhNubjP)}(h``CAP_SYS_ADMIN``h]h CAP_SYS_ADMIN}(hj:hhhNhNubah}(h]h ]h"]h$]h&]uh1jOhjubh capability.}(hjhhhNhNubeh}(h]h ]h"]h$]h&]uh1hhhhKhj hhubh)}(hX:If your new :manpage:`xyzzy(2)` system call manipulates a process other than the calling process, it should be restricted (using a call to ``ptrace_may_access()``) so that only a calling process with the same permissions as the target process, or with the necessary capabilities, can manipulate the target process.h](h If your new }(hjRhhhNhNubj)}(h:manpage:`xyzzy(2)`h]hxyzzy(2)}(hjZhhhNhNubah}(h]h ]jah"]h$]h&]jjjxyzzy(2)jxyzzyjjuh1jhjRubhl system call manipulates a process other than the calling process, it should be restricted (using a call to }(hjRhhhNhNubjP)}(h``ptrace_may_access()``h]hptrace_may_access()}(hjnhhhNhNubah}(h]h ]h"]h$]h&]uh1jOhjRubh) so that only a calling process with the same permissions as the target process, or with the necessary capabilities, can manipulate the target process.}(hjRhhhNhNubeh}(h]h ]h"]h$]h&]uh1hhhhKhj hhubh)}(hXNFinally, be aware that some non-x86 architectures have an easier time if system call parameters that are explicitly 64-bit fall on odd-numbered arguments (i.e. parameter 1, 3, 5), to allow use of contiguous pairs of 32-bit registers. (This concern does not apply if the arguments are part of a structure that's passed in by pointer.)h]hXPFinally, be aware that some non-x86 architectures have an easier time if system call parameters that are explicitly 64-bit fall on odd-numbered arguments (i.e. parameter 1, 3, 5), to allow use of contiguous pairs of 32-bit registers. (This concern does not apply if the arguments are part of a structure that’s passed in by pointer.)}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKhj hhubeh}(h]&designing-the-api-other-considerationsah ]h"]'designing the api: other considerationsah$]h&]uh1hhhhhhhhKkubh)}(hhh](h)}(hProposing the APIh]hProposing the API}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhjhhhhhKubh)}(hTo make new system calls easy to review, it's best to divide up the patchset into separate chunks. These should include at least the following items as distinct commits (each of which is described further below):h]hTo make new system calls easy to review, it’s best to divide up the patchset into separate chunks. These should include at least the following items as distinct commits (each of which is described further below):}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKhjhhubj)}(hX - The core implementation of the system call, together with prototypes, generic numbering, Kconfig changes and fallback stub implementation. - Wiring up of the new system call for one particular architecture, usually x86 (including all of x86_64, x86_32 and x32). - A demonstration of the use of the new system call in userspace via a selftest in ``tools/testing/selftests/``. - A draft man-page for the new system call, either as plain text in the cover letter, or as a patch to the (separate) man-pages repository. h]j$)}(hhh](j))}(hThe core implementation of the system call, together with prototypes, generic numbering, Kconfig changes and fallback stub implementation.h]h)}(hThe core implementation of the system call, together with prototypes, generic numbering, Kconfig changes and fallback stub implementation.h]hThe core implementation of the system call, together with prototypes, generic numbering, Kconfig changes and fallback stub implementation.}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKhjubah}(h]h ]h"]h$]h&]uh1j(hjubj))}(hxWiring up of the new system call for one particular architecture, usually x86 (including all of x86_64, x86_32 and x32).h]h)}(hxWiring up of the new system call for one particular architecture, usually x86 (including all of x86_64, x86_32 and x32).h]hxWiring up of the new system call for one particular architecture, usually x86 (including all of x86_64, x86_32 and x32).}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKhjubah}(h]h ]h"]h$]h&]uh1j(hjubj))}(hnA demonstration of the use of the new system call in userspace via a selftest in ``tools/testing/selftests/``.h]h)}(hnA demonstration of the use of the new system call in userspace via a selftest in ``tools/testing/selftests/``.h](hQA demonstration of the use of the new system call in userspace via a selftest in }(hjhhhNhNubjP)}(h``tools/testing/selftests/``h]htools/testing/selftests/}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1jOhjubh.}(hjhhhNhNubeh}(h]h ]h"]h$]h&]uh1hhhhKhjubah}(h]h ]h"]h$]h&]uh1j(hjubj))}(hA draft man-page for the new system call, either as plain text in the cover letter, or as a patch to the (separate) man-pages repository. h]h)}(hA draft man-page for the new system call, either as plain text in the cover letter, or as a patch to the (separate) man-pages repository.h]hA draft man-page for the new system call, either as plain text in the cover letter, or as a patch to the (separate) man-pages repository.}(hj hhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKhjubah}(h]h ]h"]h$]h&]uh1j(hjubeh}(h]h ]h"]h$]h&]jjuh1j#hhhKhjubah}(h]h ]h"]h$]h&]uh1jhhhKhjhhubh)}(htNew system call proposals, like any change to the kernel's API, should always be cc'ed to linux-api@vger.kernel.org.h](h^New system call proposals, like any change to the kernel’s API, should always be cc’ed to }(hj@hhhNhNubh reference)}(hlinux-api@vger.kernel.orgh]hlinux-api@vger.kernel.org}(hjJhhhNhNubah}(h]h ]h"]h$]h&]refuri mailto:linux-api@vger.kernel.orguh1jHhj@ubh.}(hj@hhhNhNubeh}(h]h ]h"]h$]h&]uh1hhhhKhjhhubeh}(h]proposing-the-apiah ]h"]proposing the apiah$]h&]uh1hhhhhhhhKubh)}(hhh](h)}(h"Generic System Call Implementationh]h"Generic System Call Implementation}(hjohhhNhNubah}(h]h ]h"]h$]h&]uh1hhjlhhhhhKubh)}(hXThe main entry point for your new :manpage:`xyzzy(2)` system call will be called ``sys_xyzzy()``, but you add this entry point with the appropriate ``SYSCALL_DEFINEn()`` macro rather than explicitly. The 'n' indicates the number of arguments to the system call, and the macro takes the system call name followed by the (type, name) pairs for the parameters as arguments. Using this macro allows metadata about the new system call to be made available for other tools.h](h"The main entry point for your new }(hj}hhhNhNubj)}(h:manpage:`xyzzy(2)`h]hxyzzy(2)}(hjhhhNhNubah}(h]h ]jah"]h$]h&]jjjxyzzy(2)jxyzzyjjuh1jhj}ubh system call will be called }(hj}hhhNhNubjP)}(h``sys_xyzzy()``h]h sys_xyzzy()}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1jOhj}ubh4, but you add this entry point with the appropriate }(hj}hhhNhNubjP)}(h``SYSCALL_DEFINEn()``h]hSYSCALL_DEFINEn()}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1jOhj}ubhX0 macro rather than explicitly. The ‘n’ indicates the number of arguments to the system call, and the macro takes the system call name followed by the (type, name) pairs for the parameters as arguments. Using this macro allows metadata about the new system call to be made available for other tools.}(hj}hhhNhNubeh}(h]h ]h"]h$]h&]uh1hhhhKhjlhhubh)}(hThe new entry point also needs a corresponding function prototype, in ``include/linux/syscalls.h``, marked as asmlinkage to match the way that system calls are invoked::h](hFThe new entry point also needs a corresponding function prototype, in }(hjhhhNhNubjP)}(h``include/linux/syscalls.h``h]hinclude/linux/syscalls.h}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1jOhjubhF, marked as asmlinkage to match the way that system calls are invoked:}(hjhhhNhNubeh}(h]h ]h"]h$]h&]uh1hhhhKhjlhhubj)}(hasmlinkage long sys_xyzzy(...);h]hasmlinkage long sys_xyzzy(...);}hjsbah}(h]h ]h"]h$]h&]jjuh1jhhhKhjlhhubh)}(hXSome architectures (e.g. x86) have their own architecture-specific syscall tables, but several other architectures share a generic syscall table. Add your new system call to the generic list by adding an entry to the list in ``include/uapi/asm-generic/unistd.h``::h](hSome architectures (e.g. x86) have their own architecture-specific syscall tables, but several other architectures share a generic syscall table. Add your new system call to the generic list by adding an entry to the list in }(hjhhhNhNubjP)}(h%``include/uapi/asm-generic/unistd.h``h]h!include/uapi/asm-generic/unistd.h}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1jOhjubh:}(hjhhhNhNubeh}(h]h ]h"]h$]h&]uh1hhhhKhjlhhubj)}(h7#define __NR_xyzzy 292 __SYSCALL(__NR_xyzzy, sys_xyzzy)h]h7#define __NR_xyzzy 292 __SYSCALL(__NR_xyzzy, sys_xyzzy)}hj sbah}(h]h ]h"]h$]h&]jjuh1jhhhKhjlhhubh)}(hAlso update the __NR_syscalls count to reflect the additional system call, and note that if multiple new system calls are added in the same merge window, your new syscall number may get adjusted to resolve conflicts.h]hAlso update the __NR_syscalls count to reflect the additional system call, and note that if multiple new system calls are added in the same merge window, your new syscall number may get adjusted to resolve conflicts.}(hj hhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKhjlhhubh)}(hThe file ``kernel/sys_ni.c`` provides a fallback stub implementation of each system call, returning ``-ENOSYS``. Add your new system call here too::h](h The file }(hj- hhhNhNubjP)}(h``kernel/sys_ni.c``h]hkernel/sys_ni.c}(hj5 hhhNhNubah}(h]h ]h"]h$]h&]uh1jOhj- ubhH provides a fallback stub implementation of each system call, returning }(hj- hhhNhNubjP)}(h ``-ENOSYS``h]h-ENOSYS}(hjG hhhNhNubah}(h]h ]h"]h$]h&]uh1jOhj- ubh%. Add your new system call here too:}(hj- hhhNhNubeh}(h]h ]h"]h$]h&]uh1hhhhKhjlhhubj)}(hCOND_SYSCALL(xyzzy);h]hCOND_SYSCALL(xyzzy);}hj_ sbah}(h]h ]h"]h$]h&]jjuh1jhhhKhjlhhubh)}(hYour new kernel functionality, and the system call that controls it, should normally be optional, so add a ``CONFIG`` option (typically to ``init/Kconfig``) for it. As usual for new ``CONFIG`` options:h](hkYour new kernel functionality, and the system call that controls it, should normally be optional, so add a }(hjm hhhNhNubjP)}(h ``CONFIG``h]hCONFIG}(hju hhhNhNubah}(h]h ]h"]h$]h&]uh1jOhjm ubh option (typically to }(hjm hhhNhNubjP)}(h``init/Kconfig``h]h init/Kconfig}(hj hhhNhNubah}(h]h ]h"]h$]h&]uh1jOhjm ubh) for it. As usual for new }(hjm hhhNhNubjP)}(h ``CONFIG``h]hCONFIG}(hj hhhNhNubah}(h]h ]h"]h$]h&]uh1jOhjm ubh options:}(hjm hhhNhNubeh}(h]h ]h"]h$]h&]uh1hhhhKhjlhhubj)}(hX- Include a description of the new functionality and system call controlled by the option. - Make the option depend on EXPERT if it should be hidden from normal users. - Make any new source files implementing the function dependent on the CONFIG option in the Makefile (e.g. ``obj-$(CONFIG_XYZZY_SYSCALL) += xyzzy.o``). - Double check that the kernel still builds with the new CONFIG option turned off. h]j$)}(hhh](j))}(hXInclude a description of the new functionality and system call controlled by the option.h]h)}(hXInclude a description of the new functionality and system call controlled by the option.h]hXInclude a description of the new functionality and system call controlled by the option.}(hj hhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKhj ubah}(h]h ]h"]h$]h&]uh1j(hj ubj))}(hJMake the option depend on EXPERT if it should be hidden from normal users.h]h)}(hj h]hJMake the option depend on EXPERT if it should be hidden from normal users.}(hj hhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKhj ubah}(h]h ]h"]h$]h&]uh1j(hj ubj))}(hMake any new source files implementing the function dependent on the CONFIG option in the Makefile (e.g. ``obj-$(CONFIG_XYZZY_SYSCALL) += xyzzy.o``).h]h)}(hMake any new source files implementing the function dependent on the CONFIG option in the Makefile (e.g. ``obj-$(CONFIG_XYZZY_SYSCALL) += xyzzy.o``).h](hiMake any new source files implementing the function dependent on the CONFIG option in the Makefile (e.g. }(hj hhhNhNubjP)}(h*``obj-$(CONFIG_XYZZY_SYSCALL) += xyzzy.o``h]h&obj-$(CONFIG_XYZZY_SYSCALL) += xyzzy.o}(hj hhhNhNubah}(h]h ]h"]h$]h&]uh1jOhj ubh).}(hj hhhNhNubeh}(h]h ]h"]h$]h&]uh1hhhhKhj ubah}(h]h ]h"]h$]h&]uh1j(hj ubj))}(hQDouble check that the kernel still builds with the new CONFIG option turned off. h]h)}(hPDouble check that the kernel still builds with the new CONFIG option turned off.h]hPDouble check that the kernel still builds with the new CONFIG option turned off.}(hj hhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKhj ubah}(h]h ]h"]h$]h&]uh1j(hj ubeh}(h]h ]h"]h$]h&]jjuh1j#hhhKhj ubah}(h]h ]h"]h$]h&]uh1jhhhKhjlhhubh)}(h.To summarize, you need a commit that includes:h]h.To summarize, you need a commit that includes:}(hj5 hhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKhjlhhubj)}(hX- ``CONFIG`` option for the new function, normally in ``init/Kconfig`` - ``SYSCALL_DEFINEn(xyzzy, ...)`` for the entry point - corresponding prototype in ``include/linux/syscalls.h`` - generic table entry in ``include/uapi/asm-generic/unistd.h`` - fallback stub in ``kernel/sys_ni.c`` h]j$)}(hhh](j))}(hD``CONFIG`` option for the new function, normally in ``init/Kconfig``h]h)}(hjL h](jP)}(h ``CONFIG``h]hCONFIG}(hjQ hhhNhNubah}(h]h ]h"]h$]h&]uh1jOhjN ubh* option for the new function, normally in }(hjN hhhNhNubjP)}(h``init/Kconfig``h]h init/Kconfig}(hjc hhhNhNubah}(h]h ]h"]h$]h&]uh1jOhjN ubeh}(h]h ]h"]h$]h&]uh1hhhhKhjJ ubah}(h]h ]h"]h$]h&]uh1j(hjG ubj))}(h3``SYSCALL_DEFINEn(xyzzy, ...)`` for the entry pointh]h)}(hj h](jP)}(h``SYSCALL_DEFINEn(xyzzy, ...)``h]hSYSCALL_DEFINEn(xyzzy, ...)}(hj hhhNhNubah}(h]h ]h"]h$]h&]uh1jOhj ubh for the entry point}(hj hhhNhNubeh}(h]h ]h"]h$]h&]uh1hhhhKhj} ubah}(h]h ]h"]h$]h&]uh1j(hjG ubj))}(h7corresponding prototype in ``include/linux/syscalls.h``h]h)}(hj h](hcorresponding prototype in }(hj hhhNhNubjP)}(h``include/linux/syscalls.h``h]hinclude/linux/syscalls.h}(hj hhhNhNubah}(h]h ]h"]h$]h&]uh1jOhj ubeh}(h]h ]h"]h$]h&]uh1hhhhKhj ubah}(h]h ]h"]h$]h&]uh1j(hjG ubj))}(hhj{hhubh)}(hHowever, there are a couple of situations where a compatibility layer is needed to cope with size differences between 32-bit and 64-bit.h]hHowever, there are a couple of situations where a compatibility layer is needed to cope with size differences between 32-bit and 64-bit.}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhMBhj{hhubh)}(hThe first is if the 64-bit kernel also supports 32-bit userspace programs, and so needs to parse areas of (``__user``) memory that could hold either 32-bit or 64-bit values. In particular, this is needed whenever a system call argument is:h](hkThe first is if the 64-bit kernel also supports 32-bit userspace programs, and so needs to parse areas of (}(hjhhhNhNubjP)}(h ``__user``h]h__user}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1jOhjubh{) memory that could hold either 32-bit or 64-bit values. In particular, this is needed whenever a system call argument is:}(hjhhhNhNubeh}(h]h ]h"]h$]h&]uh1hhhhMEhj{hhubj)}(h- a pointer to a pointer - a pointer to a struct containing a pointer (e.g. ``struct iovec __user *``) - a pointer to a varying sized integral type (``time_t``, ``off_t``, ``long``, ...) - a pointer to a struct containing a varying sized integral type. h]j$)}(hhh](j))}(ha pointer to a pointerh]h)}(hjh]ha pointer to a pointer}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhMJhjubah}(h]h ]h"]h$]h&]uh1j(hjubj))}(hKa pointer to a struct containing a pointer (e.g. ``struct iovec __user *``)h]h)}(hjh](h1a pointer to a struct containing a pointer (e.g. }(hjhhhNhNubjP)}(h``struct iovec __user *``h]hstruct iovec __user *}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1jOhjubh)}(hjhhhNhNubeh}(h]h ]h"]h$]h&]uh1hhhhMKhjubah}(h]h ]h"]h$]h&]uh1j(hjubj))}(hQa pointer to a varying sized integral type (``time_t``, ``off_t``, ``long``, ...)h]h)}(hQa pointer to a varying sized integral type (``time_t``, ``off_t``, ``long``, ...)h](h,a pointer to a varying sized integral type (}(hjhhhNhNubjP)}(h ``time_t``h]htime_t}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1jOhjubh, }(hjhhhNhNubjP)}(h ``off_t``h]hoff_t}(hj-hhhNhNubah}(h]h ]h"]h$]h&]uh1jOhjubh, }(hjhhhNhNubjP)}(h``long``h]hlong}(hj?hhhNhNubah}(h]h ]h"]h$]h&]uh1jOhjubh, ...)}(hjhhhNhNubeh}(h]h ]h"]h$]h&]uh1hhhhMLhjubah}(h]h ]h"]h$]h&]uh1j(hjubj))}(h@a pointer to a struct containing a varying sized integral type. h]h)}(h?a pointer to a struct containing a varying sized integral type.h]h?a pointer to a struct containing a varying sized integral type.}(hjahhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhMNhj]ubah}(h]h ]h"]h$]h&]uh1j(hjubeh}(h]h ]h"]h$]h&]jjuh1j#hhhMJhjubah}(h]h ]h"]h$]h&]uh1jhhhMJhj{hhubh)}(hXThe second situation that requires a compatibility layer is if one of the system call's arguments has a type that is explicitly 64-bit even on a 32-bit architecture, for example ``loff_t`` or ``__u64``. In this case, a value that arrives at a 64-bit kernel from a 32-bit application will be split into two 32-bit values, which then need to be re-assembled in the compatibility layer.h](hThe second situation that requires a compatibility layer is if one of the system call’s arguments has a type that is explicitly 64-bit even on a 32-bit architecture, for example }(hjhhhNhNubjP)}(h ``loff_t``h]hloff_t}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1jOhjubh or }(hjhhhNhNubjP)}(h ``__u64``h]h__u64}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1jOhjubh. In this case, a value that arrives at a 64-bit kernel from a 32-bit application will be split into two 32-bit values, which then need to be re-assembled in the compatibility layer.}(hjhhhNhNubeh}(h]h ]h"]h$]h&]uh1hhhhMPhj{hhubh)}(h(Note that a system call argument that's a pointer to an explicit 64-bit type does **not** need a compatibility layer; for example, :manpage:`splice(2)`'s arguments of type ``loff_t __user *`` do not trigger the need for a ``compat_`` system call.)h](hU(Note that a system call argument that’s a pointer to an explicit 64-bit type does }(hjhhhNhNubhstrong)}(h**not**h]hnot}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1jhjubh* need a compatibility layer; for example, }(hjhhhNhNubj)}(h:manpage:`splice(2)`h]h splice(2)}(hjhhhNhNubah}(h]h ]jah"]h$]h&]jjj splice(2)jsplicejjuh1jhjubh’s arguments of type }(hjhhhNhNubjP)}(h``loff_t __user *``h]hloff_t __user *}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1jOhjubh do not trigger the need for a }(hjhhhNhNubjP)}(h ``compat_``h]hcompat_}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1jOhjubh system call.)}(hjhhhNhNubeh}(h]h ]h"]h$]h&]uh1hhhhMVhj{hhubh)}(hXThe compatibility version of the system call is called ``compat_sys_xyzzy()``, and is added with the ``COMPAT_SYSCALL_DEFINEn()`` macro, analogously to SYSCALL_DEFINEn. This version of the implementation runs as part of a 64-bit kernel, but expects to receive 32-bit parameter values and does whatever is needed to deal with them. (Typically, the ``compat_sys_`` version converts the values to 64-bit versions and either calls on to the ``sys_`` version, or both of them call a common inner implementation function.)h](h7The compatibility version of the system call is called }(hj hhhNhNubjP)}(h``compat_sys_xyzzy()``h]hcompat_sys_xyzzy()}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1jOhj ubh, and is added with the }(hj hhhNhNubjP)}(h``COMPAT_SYSCALL_DEFINEn()``h]hCOMPAT_SYSCALL_DEFINEn()}(hj'hhhNhNubah}(h]h ]h"]h$]h&]uh1jOhj ubh macro, analogously to SYSCALL_DEFINEn. This version of the implementation runs as part of a 64-bit kernel, but expects to receive 32-bit parameter values and does whatever is needed to deal with them. (Typically, the }(hj hhhNhNubjP)}(h``compat_sys_``h]h compat_sys_}(hj9hhhNhNubah}(h]h ]h"]h$]h&]uh1jOhj ubhK version converts the values to 64-bit versions and either calls on to the }(hj hhhNhNubjP)}(h``sys_``h]hsys_}(hjKhhhNhNubah}(h]h ]h"]h$]h&]uh1jOhj ubhG version, or both of them call a common inner implementation function.)}(hj hhhNhNubeh}(h]h ]h"]h$]h&]uh1hhhhMZhj{hhubh)}(hThe compat entry point also needs a corresponding function prototype, in ``include/linux/compat.h``, marked as asmlinkage to match the way that system calls are invoked::h](hIThe compat entry point also needs a corresponding function prototype, in }(hjchhhNhNubjP)}(h``include/linux/compat.h``h]hinclude/linux/compat.h}(hjkhhhNhNubah}(h]h ]h"]h$]h&]uh1jOhjcubhF, marked as asmlinkage to match the way that system calls are invoked:}(hjchhhNhNubeh}(h]h ]h"]h$]h&]uh1hhhhMbhj{hhubj)}(h&asmlinkage long compat_sys_xyzzy(...);h]h&asmlinkage long compat_sys_xyzzy(...);}hjsbah}(h]h ]h"]h$]h&]jjuh1jhhhMfhj{hhubh)}(hXIf the system call involves a structure that is laid out differently on 32-bit and 64-bit systems, say ``struct xyzzy_args``, then the include/linux/compat.h header file should also include a compat version of the structure (``struct compat_xyzzy_args``) where each variable-size field has the appropriate ``compat_`` type that corresponds to the type in ``struct xyzzy_args``. The ``compat_sys_xyzzy()`` routine can then use this ``compat_`` structure to parse the arguments from a 32-bit invocation.h](hgIf the system call involves a structure that is laid out differently on 32-bit and 64-bit systems, say }(hjhhhNhNubjP)}(h``struct xyzzy_args``h]hstruct xyzzy_args}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1jOhjubhe, then the include/linux/compat.h header file should also include a compat version of the structure (}(hjhhhNhNubjP)}(h``struct compat_xyzzy_args``h]hstruct compat_xyzzy_args}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1jOhjubh5) where each variable-size field has the appropriate }(hjhhhNhNubjP)}(h ``compat_``h]hcompat_}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1jOhjubh& type that corresponds to the type in }(hjhhhNhNubjP)}(h``struct xyzzy_args``h]hstruct xyzzy_args}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1jOhjubh. The }(hjhhhNhNubjP)}(h``compat_sys_xyzzy()``h]hcompat_sys_xyzzy()}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1jOhjubh routine can then use this }(hjhhhNhNubjP)}(h ``compat_``h]hcompat_}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1jOhjubh; structure to parse the arguments from a 32-bit invocation.}(hjhhhNhNubeh}(h]h ]h"]h$]h&]uh1hhhhMhhj{hhubh)}(h"For example, if there are fields::h]h!For example, if there are fields:}(hj hhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhMphj{hhubj)}(htstruct xyzzy_args { const char __user *ptr; __kernel_long_t varying_val; u64 fixed_val; /* ... */ };h]htstruct xyzzy_args { const char __user *ptr; __kernel_long_t varying_val; u64 fixed_val; /* ... */ };}hjsbah}(h]h ]h"]h$]h&]jjuh1jhhhMrhj{hhubh)}(h@in struct xyzzy_args, then struct compat_xyzzy_args would have::h]h?in struct xyzzy_args, then struct compat_xyzzy_args would have:}(hj'hhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhMyhj{hhubj)}(htstruct compat_xyzzy_args { compat_uptr_t ptr; compat_long_t varying_val; u64 fixed_val; /* ... */ };h]htstruct compat_xyzzy_args { compat_uptr_t ptr; compat_long_t varying_val; u64 fixed_val; /* ... */ };}hj5sbah}(h]h ]h"]h$]h&]jjuh1jhhhM{hj{hhubh)}(hThe generic system call list also needs adjusting to allow for the compat version; the entry in ``include/uapi/asm-generic/unistd.h`` should use ``__SC_COMP`` rather than ``__SYSCALL``::h](h`The generic system call list also needs adjusting to allow for the compat version; the entry in }(hjChhhNhNubjP)}(h%``include/uapi/asm-generic/unistd.h``h]h!include/uapi/asm-generic/unistd.h}(hjKhhhNhNubah}(h]h ]h"]h$]h&]uh1jOhjCubh should use }(hjChhhNhNubjP)}(h ``__SC_COMP``h]h __SC_COMP}(hj]hhhNhNubah}(h]h ]h"]h$]h&]uh1jOhjCubh rather than }(hjChhhNhNubjP)}(h ``__SYSCALL``h]h __SYSCALL}(hjohhhNhNubah}(h]h ]h"]h$]h&]uh1jOhjCubh:}(hjChhhNhNubeh}(h]h ]h"]h$]h&]uh1hhhhMhj{hhubj)}(hI#define __NR_xyzzy 292 __SC_COMP(__NR_xyzzy, sys_xyzzy, compat_sys_xyzzy)h]hI#define __NR_xyzzy 292 __SC_COMP(__NR_xyzzy, sys_xyzzy, compat_sys_xyzzy)}hjsbah}(h]h ]h"]h$]h&]jjuh1jhhhMhj{hhubh)}(hTo summarize, you need:h]hTo summarize, you need:}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhMhj{hhubj)}(hX- a ``COMPAT_SYSCALL_DEFINEn(xyzzy, ...)`` for the compat entry point - corresponding prototype in ``include/linux/compat.h`` - (if needed) 32-bit mapping struct in ``include/linux/compat.h`` - instance of ``__SC_COMP`` not ``__SYSCALL`` in ``include/uapi/asm-generic/unistd.h`` h]j$)}(hhh](j))}(hCa ``COMPAT_SYSCALL_DEFINEn(xyzzy, ...)`` for the compat entry pointh]h)}(hjh](ha }(hjhhhNhNubjP)}(h&``COMPAT_SYSCALL_DEFINEn(xyzzy, ...)``h]h"COMPAT_SYSCALL_DEFINEn(xyzzy, ...)}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1jOhjubh for the compat entry point}(hjhhhNhNubeh}(h]h ]h"]h$]h&]uh1hhhhMhjubah}(h]h ]h"]h$]h&]uh1j(hjubj))}(h5corresponding prototype in ``include/linux/compat.h``h]h)}(hjh](hcorresponding prototype in }(hjhhhNhNubjP)}(h``include/linux/compat.h``h]hinclude/linux/compat.h}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1jOhjubeh}(h]h ]h"]h$]h&]uh1hhhhMhjubah}(h]h ]h"]h$]h&]uh1j(hjubj))}(h?(if needed) 32-bit mapping struct in ``include/linux/compat.h``h]h)}(hjh](h%(if needed) 32-bit mapping struct in }(hjhhhNhNubjP)}(h``include/linux/compat.h``h]hinclude/linux/compat.h}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1jOhjubeh}(h]h ]h"]h$]h&]uh1hhhhMhjubah}(h]h ]h"]h$]h&]uh1j(hjubj))}(hVinstance of ``__SC_COMP`` not ``__SYSCALL`` in ``include/uapi/asm-generic/unistd.h`` h]h)}(hTinstance of ``__SC_COMP`` not ``__SYSCALL`` in ``include/uapi/asm-generic/unistd.h``h](h instance of }(hj!hhhNhNubjP)}(h ``__SC_COMP``h]h __SC_COMP}(hj)hhhNhNubah}(h]h ]h"]h$]h&]uh1jOhj!ubh not }(hj!hhhNhNubjP)}(h ``__SYSCALL``h]h __SYSCALL}(hj;hhhNhNubah}(h]h ]h"]h$]h&]uh1jOhj!ubh in }(hj!hhhNhNubjP)}(h%``include/uapi/asm-generic/unistd.h``h]h!include/uapi/asm-generic/unistd.h}(hjMhhhNhNubah}(h]h ]h"]h$]h&]uh1jOhj!ubeh}(h]h ]h"]h$]h&]uh1hhhhMhjubah}(h]h ]h"]h$]h&]uh1j(hjubeh}(h]h ]h"]h$]h&]jjuh1j#hhhMhjubah}(h]h ]h"]h$]h&]uh1jhhhMhj{hhubh)}(hhh](h)}(h Since 6.11h]h Since 6.11}(hjvhhhNhNubah}(h]h ]h"]h$]h&]uh1hhjshhhhhMubh)}(hThis applies to all the architectures listed in :ref:`Since 6.11` under "Generic System Call Implementation", except arm64. See :ref:`Compatibility System Calls (arm64)` for more information.h](h0This applies to all the architectures listed in }(hjhhhNhNubh)}(h':ref:`Since 6.11`h]h)}(hjh]h Since 6.11}(hjhhhNhNubah}(h]h ](hߌstdstd-refeh"]h$]h&]uh1hhjubah}(h]h ]h"]h$]h&]refdoch refdomainjreftyperef refexplicitrefwarnhsyscall_generic_6_11uh1hhhhMhjubhC under “Generic System Call Implementation”, except arm64. See }(hjhhhNhNubh)}(h7:ref:`Compatibility System Calls (arm64)`h]h)}(hjh]h"Compatibility System Calls (arm64)}(hjhhhNhNubah}(h]h ](hߌstdstd-refeh"]h$]h&]uh1hhjubah}(h]h ]h"]h$]h&]refdoch refdomainjreftyperef refexplicitrefwarnh compat_arm64uh1hhhhMhjubh for more information.}(hjhhhNhNubeh}(h]h ]h"]h$]h&]uh1hhhhMhjshhubh)}(hYou need to extend the entry in ``scripts/syscall.tbl`` with an extra column to indicate that a 32-bit userspace program running on a 64-bit kernel should hit the compat entry point::h](h You need to extend the entry in }(hjhhhNhNubjP)}(h``scripts/syscall.tbl``h]hscripts/syscall.tbl}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1jOhjubh with an extra column to indicate that a 32-bit userspace program running on a 64-bit kernel should hit the compat entry point:}(hjhhhNhNubeh}(h]h ]h"]h$]h&]uh1hhhhMhjshhubj)}(h8468 common xyzzy sys_xyzzy compat_sys_xyzzyh]h8468 common xyzzy sys_xyzzy compat_sys_xyzzy}hjsbah}(h]h ]h"]h$]h&]jjuh1jhhhMhjshhubh)}(hTo summarize, you need:h]hTo summarize, you need:}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhMhjshhubj)}(hX- ``COMPAT_SYSCALL_DEFINEn(xyzzy, ...)`` for the compat entry point - corresponding prototype in ``include/linux/compat.h`` - modification of the entry in ``scripts/syscall.tbl`` to include an extra "compat" column - (if needed) 32-bit mapping struct in ``include/linux/compat.h`` h]j$)}(hhh](j))}(hA``COMPAT_SYSCALL_DEFINEn(xyzzy, ...)`` for the compat entry pointh]h)}(hjh](jP)}(h&``COMPAT_SYSCALL_DEFINEn(xyzzy, ...)``h]h"COMPAT_SYSCALL_DEFINEn(xyzzy, ...)}(hj$hhhNhNubah}(h]h ]h"]h$]h&]uh1jOhj!ubh for the compat entry point}(hj!hhhNhNubeh}(h]h ]h"]h$]h&]uh1hhhhMhjubah}(h]h ]h"]h$]h&]uh1j(hjubj))}(h5corresponding prototype in ``include/linux/compat.h``h]h)}(hjDh](hcorresponding prototype in }(hjFhhhNhNubjP)}(h``include/linux/compat.h``h]hinclude/linux/compat.h}(hjMhhhNhNubah}(h]h ]h"]h$]h&]uh1jOhjFubeh}(h]h ]h"]h$]h&]uh1hhhhMhjBubah}(h]h ]h"]h$]h&]uh1j(hjubj))}(hXmodification of the entry in ``scripts/syscall.tbl`` to include an extra "compat" columnh]h)}(hXmodification of the entry in ``scripts/syscall.tbl`` to include an extra "compat" columnh](hmodification of the entry in }(hjkhhhNhNubjP)}(h``scripts/syscall.tbl``h]hscripts/syscall.tbl}(hjshhhNhNubah}(h]h ]h"]h$]h&]uh1jOhjkubh( to include an extra “compat” column}(hjkhhhNhNubeh}(h]h ]h"]h$]h&]uh1hhhhMhjgubah}(h]h ]h"]h$]h&]uh1j(hjubj))}(hA(if needed) 32-bit mapping struct in ``include/linux/compat.h`` h]h)}(h?(if needed) 32-bit mapping struct in ``include/linux/compat.h``h](h%(if needed) 32-bit mapping struct in }(hjhhhNhNubjP)}(h``include/linux/compat.h``h]hinclude/linux/compat.h}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1jOhjubeh}(h]h ]h"]h$]h&]uh1hhhhMhjubah}(h]h ]h"]h$]h&]uh1j(hjubeh}(h]h ]h"]h$]h&]jjuh1j#hhhMhjubah}(h]h ]h"]h$]h&]uh1jhhhMhjshhubh)}(h.. _compat_arm64:h]h}(h]h ]h"]h$]h&]h compat-arm64uh1hhMhjshhhhubh)}(hhh](h)}(h"Compatibility System Calls (arm64)h]h"Compatibility System Calls (arm64)}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhjhhhhhMubh)}(hOn arm64, there is a dedicated syscall table for compatibility system calls targeting 32-bit (AArch32) userspace: ``arch/arm64/tools/syscall_32.tbl``. You need to add an additional line to this table specifying the compat entry point::h](hrOn arm64, there is a dedicated syscall table for compatibility system calls targeting 32-bit (AArch32) userspace: }(hjhhhNhNubjP)}(h#``arch/arm64/tools/syscall_32.tbl``h]harch/arm64/tools/syscall_32.tbl}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1jOhjubhU. You need to add an additional line to this table specifying the compat entry point:}(hjhhhNhNubeh}(h]h ]h"]h$]h&]uh1hhhhMhjhhubj)}(h8468 common xyzzy sys_xyzzy compat_sys_xyzzyh]h8468 common xyzzy sys_xyzzy compat_sys_xyzzy}hjsbah}(h]h ]h"]h$]h&]jjuh1jhhhMhjhhubeh}(h]( compatibility-system-calls-arm64jeh ]h"]("compatibility system calls (arm64) compat_arm64eh$]h&]uh1hhjshhhhhMj }jjsj}jjsubeh}(h]id1ah ]h"]h$]j ah&]uh1hhj{hhhhhMj Kubeh}(h]"compatibility-system-calls-genericah ]h"]$compatibility system calls (generic)ah$]h&]uh1hhhhhhhhM<ubh)}(hhh](h)}(h Compatibility System Calls (x86)h]h Compatibility System Calls (x86)}(hj*hhhNhNubah}(h]h ]h"]h$]h&]uh1hhj'hhhhhMubh)}(hTo wire up the x86 architecture of a system call with a compatibility version, the entries in the syscall tables need to be adjusted.h]hTo wire up the x86 architecture of a system call with a compatibility version, the entries in the syscall tables need to be adjusted.}(hj8hhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhMhj'hhubh)}(hFirst, the entry in ``arch/x86/entry/syscalls/syscall_32.tbl`` gets an extra column to indicate that a 32-bit userspace program running on a 64-bit kernel should hit the compat entry point::h](hFirst, the entry in }(hjFhhhNhNubjP)}(h*``arch/x86/entry/syscalls/syscall_32.tbl``h]h&arch/x86/entry/syscalls/syscall_32.tbl}(hjNhhhNhNubah}(h]h ]h"]h$]h&]uh1jOhjFubh gets an extra column to indicate that a 32-bit userspace program running on a 64-bit kernel should hit the compat entry point:}(hjFhhhNhNubeh}(h]h ]h"]h$]h&]uh1hhhhMhj'hhubj)}(h=380 i386 xyzzy sys_xyzzy __ia32_compat_sys_xyzzyh]h=380 i386 xyzzy sys_xyzzy __ia32_compat_sys_xyzzy}hjfsbah}(h]h ]h"]h$]h&]jjuh1jhhhMhj'hhubh)}(hSecond, you need to figure out what should happen for the x32 ABI version of the new system call. There's a choice here: the layout of the arguments should either match the 64-bit version or the 32-bit version.h]hSecond, you need to figure out what should happen for the x32 ABI version of the new system call. There’s a choice here: the layout of the arguments should either match the 64-bit version or the 32-bit version.}(hjthhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhMhj'hhubh)}(hIf there's a pointer-to-a-pointer involved, the decision is easy: x32 is ILP32, so the layout should match the 32-bit version, and the entry in ``arch/x86/entry/syscalls/syscall_64.tbl`` is split so that x32 programs hit the compatibility wrapper::h](hIf there’s a pointer-to-a-pointer involved, the decision is easy: x32 is ILP32, so the layout should match the 32-bit version, and the entry in }(hjhhhNhNubjP)}(h*``arch/x86/entry/syscalls/syscall_64.tbl``h]h&arch/x86/entry/syscalls/syscall_64.tbl}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1jOhjubh= is split so that x32 programs hit the compatibility wrapper:}(hjhhhNhNubeh}(h]h ]h"]h$]h&]uh1hhhhMhj'hhubj)}(hV333 64 xyzzy sys_xyzzy ... 555 x32 xyzzy __x32_compat_sys_xyzzyh]hV333 64 xyzzy sys_xyzzy ... 555 x32 xyzzy __x32_compat_sys_xyzzy}hjsbah}(h]h ]h"]h$]h&]jjuh1jhhhMhj'hhubh)}(hIf no pointers are involved, then it is preferable to re-use the 64-bit system call for the x32 ABI (and consequently the entry in arch/x86/entry/syscalls/syscall_64.tbl is unchanged).h]hIf no pointers are involved, then it is preferable to re-use the 64-bit system call for the x32 ABI (and consequently the entry in arch/x86/entry/syscalls/syscall_64.tbl is unchanged).}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhMhj'hhubh)}(hIn either case, you should check that the types involved in your argument layout do indeed map exactly from x32 (-mx32) to either the 32-bit (-m32) or 64-bit (-m64) equivalents.h]hIn either case, you should check that the types involved in your argument layout do indeed map exactly from x32 (-mx32) to either the 32-bit (-m32) or 64-bit (-m64) equivalents.}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhMhj'hhubeh}(h]compatibility-system-calls-x86ah ]h"] compatibility system calls (x86)ah$]h&]uh1hhhhhhhhMubh)}(hhh](h)}(h System Calls Returning Elsewhereh]h System Calls Returning Elsewhere}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhjhhhhhMubh)}(hXFor most system calls, once the system call is complete the user program continues exactly where it left off -- at the next instruction, with the stack the same and most of the registers the same as before the system call, and with the same virtual memory space.h]hXFor most system calls, once the system call is complete the user program continues exactly where it left off -- at the next instruction, with the stack the same and most of the registers the same as before the system call, and with the same virtual memory space.}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhMhjhhubh)}(hHowever, a few system calls do things differently. They might return to a different location (``rt_sigreturn``) or change the memory space (``fork``/``vfork``/``clone``) or even architecture (``execve``/``execveat``) of the program.h](h_However, a few system calls do things differently. They might return to a different location (}(hjhhhNhNubjP)}(h``rt_sigreturn``h]h rt_sigreturn}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1jOhjubh) or change the memory space (}(hjhhhNhNubjP)}(h``fork``h]hfork}(hj hhhNhNubah}(h]h ]h"]h$]h&]uh1jOhjubh/}(hjhhhNhNubjP)}(h ``vfork``h]hvfork}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1jOhjubh/}hjsbjP)}(h ``clone``h]hclone}(hj1hhhNhNubah}(h]h ]h"]h$]h&]uh1jOhjubh) or even architecture (}(hjhhhNhNubjP)}(h ``execve``h]hexecve}(hjChhhNhNubah}(h]h ]h"]h$]h&]uh1jOhjubh/}hjsbjP)}(h ``execveat``h]hexecveat}(hjUhhhNhNubah}(h]h ]h"]h$]h&]uh1jOhjubh) of the program.}(hjhhhNhNubeh}(h]h ]h"]h$]h&]uh1hhhhMhjhhubh)}(hTo allow for this, the kernel implementation of the system call may need to save and restore additional registers to the kernel stack, allowing complete control of where and how execution continues after the system call.h]hTo allow for this, the kernel implementation of the system call may need to save and restore additional registers to the kernel stack, allowing complete control of where and how execution continues after the system call.}(hjmhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhMhjhhubh)}(hThis is arch-specific, but typically involves defining assembly entry points that save/restore additional registers and invoke the real system call entry point.h]hThis is arch-specific, but typically involves defining assembly entry points that save/restore additional registers and invoke the real system call entry point.}(hj{hhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhMhjhhubh)}(hFor x86_64, this is implemented as a ``stub_xyzzy`` entry point in ``arch/x86/entry/entry_64.S``, and the entry in the syscall table (``arch/x86/entry/syscalls/syscall_64.tbl``) is adjusted to match::h](h%For x86_64, this is implemented as a }(hjhhhNhNubjP)}(h``stub_xyzzy``h]h stub_xyzzy}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1jOhjubh entry point in }(hjhhhNhNubjP)}(h``arch/x86/entry/entry_64.S``h]harch/x86/entry/entry_64.S}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1jOhjubh&, and the entry in the syscall table (}(hjhhhNhNubjP)}(h*``arch/x86/entry/syscalls/syscall_64.tbl``h]h&arch/x86/entry/syscalls/syscall_64.tbl}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1jOhjubh) is adjusted to match:}(hjhhhNhNubeh}(h]h ]h"]h$]h&]uh1hhhhMhjhhubj)}(h#333 common xyzzy stub_xyzzyh]h#333 common xyzzy stub_xyzzy}hjsbah}(h]h ]h"]h$]h&]jjuh1jhhhMhjhhubh)}(hThe equivalent for 32-bit programs running on a 64-bit kernel is normally called ``stub32_xyzzy`` and implemented in ``arch/x86/entry/entry_64_compat.S``, with the corresponding syscall table adjustment in ``arch/x86/entry/syscalls/syscall_32.tbl``::h](hQThe equivalent for 32-bit programs running on a 64-bit kernel is normally called }(hjhhhNhNubjP)}(h``stub32_xyzzy``h]h stub32_xyzzy}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1jOhjubh and implemented in }(hjhhhNhNubjP)}(h$``arch/x86/entry/entry_64_compat.S``h]h arch/x86/entry/entry_64_compat.S}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1jOhjubh5, with the corresponding syscall table adjustment in }(hjhhhNhNubjP)}(h*``arch/x86/entry/syscalls/syscall_32.tbl``h]h&arch/x86/entry/syscalls/syscall_32.tbl}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1jOhjubh:}(hjhhhNhNubeh}(h]h ]h"]h$]h&]uh1hhhhMhjhhubj)}(h2380 i386 xyzzy sys_xyzzy stub32_xyzzyh]h2380 i386 xyzzy sys_xyzzy stub32_xyzzy}hjsbah}(h]h ]h"]h$]h&]jjuh1jhhhMhjhhubh)}(hXIf the system call needs a compatibility layer (as in the previous section) then the ``stub32_`` version needs to call on to the ``compat_sys_`` version of the system call rather than the native 64-bit version. Also, if the x32 ABI implementation is not common with the x86_64 version, then its syscall table will also need to invoke a stub that calls on to the ``compat_sys_`` version.h](hUIf the system call needs a compatibility layer (as in the previous section) then the }(hj-hhhNhNubjP)}(h ``stub32_``h]hstub32_}(hj5hhhNhNubah}(h]h ]h"]h$]h&]uh1jOhj-ubh! version needs to call on to the }(hj-hhhNhNubjP)}(h``compat_sys_``h]h compat_sys_}(hjGhhhNhNubah}(h]h ]h"]h$]h&]uh1jOhj-ubh version of the system call rather than the native 64-bit version. Also, if the x32 ABI implementation is not common with the x86_64 version, then its syscall table will also need to invoke a stub that calls on to the }(hj-hhhNhNubjP)}(h``compat_sys_``h]h compat_sys_}(hjYhhhNhNubah}(h]h ]h"]h$]h&]uh1jOhj-ubh version.}(hj-hhhNhNubeh}(h]h ]h"]h$]h&]uh1hhhhMhjhhubh)}(hXUFor completeness, it's also nice to set up a mapping so that user-mode Linux still works -- its syscall table will reference stub_xyzzy, but the UML build doesn't include ``arch/x86/entry/entry_64.S`` implementation (because UML simulates registers etc). Fixing this is as simple as adding a #define to ``arch/x86/um/sys_call_table_64.c``::h](hFor completeness, it’s also nice to set up a mapping so that user-mode Linux still works -- its syscall table will reference stub_xyzzy, but the UML build doesn’t include }(hjqhhhNhNubjP)}(h``arch/x86/entry/entry_64.S``h]harch/x86/entry/entry_64.S}(hjyhhhNhNubah}(h]h ]h"]h$]h&]uh1jOhjqubhh implementation (because UML simulates registers etc). Fixing this is as simple as adding a #define to }(hjqhhhNhNubjP)}(h#``arch/x86/um/sys_call_table_64.c``h]harch/x86/um/sys_call_table_64.c}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1jOhjqubh:}(hjqhhhNhNubeh}(h]h ]h"]h$]h&]uh1hhhhMhjhhubj)}(h#define stub_xyzzy sys_xyzzyh]h#define stub_xyzzy sys_xyzzy}hjsbah}(h]h ]h"]h$]h&]jjuh1jhhhMhjhhubeh}(h] system-calls-returning-elsewhereah ]h"] system calls returning elsewhereah$]h&]uh1hhhhhhhhMubh)}(hhh](h)}(h Other Detailsh]h Other Details}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhjhhhhhM ubh)}(hMost of the kernel treats system calls in a generic way, but there is the occasional exception that may need updating for your particular system call.h]hMost of the kernel treats system calls in a generic way, but there is the occasional exception that may need updating for your particular system call.}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhM hjhhubh)}(hXqThe audit subsystem is one such special case; it includes (arch-specific) functions that classify some special types of system call -- specifically file open (``open``/``openat``), program execution (``execve``/``exeveat``) or socket multiplexor (``socketcall``) operations. If your new system call is analogous to one of these, then the audit system should be updated.h](hThe audit subsystem is one such special case; it includes (arch-specific) functions that classify some special types of system call -- specifically file open (}(hjhhhNhNubjP)}(h``open``h]hopen}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1jOhjubh/}(hjhhhNhNubjP)}(h ``openat``h]hopenat}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1jOhjubh), program execution (}(hjhhhNhNubjP)}(h ``execve``h]hexecve}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1jOhjubh/}hjsbjP)}(h ``exeveat``h]hexeveat}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1jOhjubh) or socket multiplexor (}(hjhhhNhNubjP)}(h``socketcall``h]h socketcall}(hj(hhhNhNubah}(h]h ]h"]h$]h&]uh1jOhjubhl) operations. If your new system call is analogous to one of these, then the audit system should be updated.}(hjhhhNhNubeh}(h]h ]h"]h$]h&]uh1hhhhMhjhhubh)}(hMore generally, if there is an existing system call that is analogous to your new system call, it's worth doing a kernel-wide grep for the existing system call to check there are no other special cases.h]hMore generally, if there is an existing system call that is analogous to your new system call, it’s worth doing a kernel-wide grep for the existing system call to check there are no other special cases.}(hj@hhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhMhjhhubeh}(h] other-detailsah ]h"] other detailsah$]h&]uh1hhhhhhhhM ubh)}(hhh](h)}(hTestingh]hTesting}(hjYhhhNhNubah}(h]h ]h"]h$]h&]uh1hhjVhhhhhMubh)}(hX A new system call should obviously be tested; it is also useful to provide reviewers with a demonstration of how user space programs will use the system call. A good way to combine these aims is to include a simple self-test program in a new directory under ``tools/testing/selftests/``.h](hXA new system call should obviously be tested; it is also useful to provide reviewers with a demonstration of how user space programs will use the system call. A good way to combine these aims is to include a simple self-test program in a new directory under }(hjghhhNhNubjP)}(h``tools/testing/selftests/``h]htools/testing/selftests/}(hjohhhNhNubah}(h]h ]h"]h$]h&]uh1jOhjgubh.}(hjghhhNhNubeh}(h]h ]h"]h$]h&]uh1hhhhMhjVhhubh)}(hXFor a new system call, there will obviously be no libc wrapper function and so the test will need to invoke it using ``syscall()``; also, if the system call involves a new userspace-visible structure, the corresponding header will need to be installed to compile the test.h](huFor a new system call, there will obviously be no libc wrapper function and so the test will need to invoke it using }(hjhhhNhNubjP)}(h ``syscall()``h]h syscall()}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1jOhjubh; also, if the system call involves a new userspace-visible structure, the corresponding header will need to be installed to compile the test.}(hjhhhNhNubeh}(h]h ]h"]h$]h&]uh1hhhhM"hjVhhubh)}(hMake sure the selftest runs successfully on all supported architectures. For example, check that it works when compiled as an x86_64 (-m64), x86_32 (-m32) and x32 (-mx32) ABI program.h]hMake sure the selftest runs successfully on all supported architectures. For example, check that it works when compiled as an x86_64 (-m64), x86_32 (-m32) and x32 (-mx32) ABI program.}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhM'hjVhhubh)}(hFor more extensive and thorough testing of new functionality, you should also consider adding tests to the Linux Test Project, or to the xfstests project for filesystem-related changes.h]hFor more extensive and thorough testing of new functionality, you should also consider adding tests to the Linux Test Project, or to the xfstests project for filesystem-related changes.}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhM+hjVhhubj)}(h`- https://linux-test-project.github.io/ - git://git.kernel.org/pub/scm/fs/xfs/xfstests-dev.git h]j$)}(hhh](j))}(h%https://linux-test-project.github.io/h]h)}(hjh]jI)}(hjh]h%https://linux-test-project.github.io/}(hjhhhNhNubah}(h]h ]h"]h$]h&]refurijuh1jHhjubah}(h]h ]h"]h$]h&]uh1hhhhM/hjubah}(h]h ]h"]h$]h&]uh1j(hjubj))}(h6git://git.kernel.org/pub/scm/fs/xfs/xfstests-dev.git h]h)}(h4git://git.kernel.org/pub/scm/fs/xfs/xfstests-dev.gith]h4git://git.kernel.org/pub/scm/fs/xfs/xfstests-dev.git}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhM0hjubah}(h]h ]h"]h$]h&]uh1j(hjubeh}(h]h ]h"]h$]h&]jjuh1j#hhhM/hjubah}(h]h ]h"]h$]h&]uh1jhhhM/hjVhhubeh}(h]testingah ]h"]testingah$]h&]uh1hhhhhhhhMubh)}(hhh](h)}(hMan Pageh]hMan Page}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhjhhhhhM4ubh)}(hX All new system calls should come with a complete man page, ideally using groff markup, but plain text will do. If groff is used, it's helpful to include a pre-rendered ASCII version of the man page in the cover email for the patchset, for the convenience of reviewers.h]hXAll new system calls should come with a complete man page, ideally using groff markup, but plain text will do. If groff is used, it’s helpful to include a pre-rendered ASCII version of the man page in the cover email for the patchset, for the convenience of reviewers.}(hj(hhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhM6hjhhubh)}(hThe man page should be cc'ed to linux-man@vger.kernel.org For more details, see https://www.kernel.org/doc/man-pages/patches.htmlh](h"The man page should be cc’ed to }(hj6hhhNhNubjI)}(hlinux-man@vger.kernel.orgh]hlinux-man@vger.kernel.org}(hj>hhhNhNubah}(h]h ]h"]h$]h&]refuri mailto:linux-man@vger.kernel.orguh1jHhj6ubh For more details, see }(hj6hhhNhNubjI)}(h1https://www.kernel.org/doc/man-pages/patches.htmlh]h1https://www.kernel.org/doc/man-pages/patches.html}(hjRhhhNhNubah}(h]h ]h"]h$]h&]refurijTuh1jHhj6ubeh}(h]h ]h"]h$]h&]uh1hhhhM;hjhhubeh}(h]man-pageah ]h"]man pageah$]h&]uh1hhhhhhhhM4ubh)}(hhh](h)}(h&Do not call System Calls in the Kernelh]h&Do not call System Calls in the Kernel}(hjrhhhNhNubah}(h]h ]h"]h$]h&]uh1hhjohhhhhM@ubh)}(hXSystem calls are, as stated above, interaction points between userspace and the kernel. Therefore, system call functions such as ``sys_xyzzy()`` or ``compat_sys_xyzzy()`` should only be called from userspace via the syscall table, but not from elsewhere in the kernel. If the syscall functionality is useful to be used within the kernel, needs to be shared between an old and a new syscall, or needs to be shared between a syscall and its compatibility variant, it should be implemented by means of a "helper" function (such as ``ksys_xyzzy()``). This kernel function may then be called within the syscall stub (``sys_xyzzy()``), the compatibility syscall stub (``compat_sys_xyzzy()``), and/or other kernel code.h](hSystem calls are, as stated above, interaction points between userspace and the kernel. Therefore, system call functions such as }(hjhhhNhNubjP)}(h``sys_xyzzy()``h]h sys_xyzzy()}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1jOhjubh or }(hjhhhNhNubjP)}(h``compat_sys_xyzzy()``h]hcompat_sys_xyzzy()}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1jOhjubhXk should only be called from userspace via the syscall table, but not from elsewhere in the kernel. If the syscall functionality is useful to be used within the kernel, needs to be shared between an old and a new syscall, or needs to be shared between a syscall and its compatibility variant, it should be implemented by means of a “helper” function (such as }(hjhhhNhNubjP)}(h``ksys_xyzzy()``h]h ksys_xyzzy()}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1jOhjubhE). This kernel function may then be called within the syscall stub (}(hjhhhNhNubjP)}(h``sys_xyzzy()``h]h sys_xyzzy()}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1jOhjubh#), the compatibility syscall stub (}(hjhhhNhNubjP)}(h``compat_sys_xyzzy()``h]hcompat_sys_xyzzy()}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1jOhjubh), and/or other kernel code.}(hjhhhNhNubeh}(h]h ]h"]h$]h&]uh1hhhhMBhjohhubh)}(hX=At least on 64-bit x86, it will be a hard requirement from v4.17 onwards to not call system call functions in the kernel. It uses a different calling convention for system calls where ``struct pt_regs`` is decoded on-the-fly in a syscall wrapper which then hands processing over to the actual syscall function. This means that only those parameters which are actually needed for a specific syscall are passed on during syscall entry, instead of filling in six CPU registers with random user space content all the time (which may cause serious trouble down the call chain).h](hAt least on 64-bit x86, it will be a hard requirement from v4.17 onwards to not call system call functions in the kernel. It uses a different calling convention for system calls where }(hjhhhNhNubjP)}(h``struct pt_regs``h]hstruct pt_regs}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1jOhjubhXr is decoded on-the-fly in a syscall wrapper which then hands processing over to the actual syscall function. This means that only those parameters which are actually needed for a specific syscall are passed on during syscall entry, instead of filling in six CPU registers with random user space content all the time (which may cause serious trouble down the call chain).}(hjhhhNhNubeh}(h]h ]h"]h$]h&]uh1hhhhMMhjohhubh)}(hMoreover, rules on how data may be accessed may differ between kernel data and user data. This is another reason why calling ``sys_xyzzy()`` is generally a bad idea.h](h~Moreover, rules on how data may be accessed may differ between kernel data and user data. This is another reason why calling }(hjhhhNhNubjP)}(h``sys_xyzzy()``h]h sys_xyzzy()}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1jOhjubh is generally a bad idea.}(hjhhhNhNubeh}(h]h ]h"]h$]h&]uh1hhhhMVhjohhubh)}(hExceptions to this rule are only allowed in architecture-specific overrides, architecture-specific compatibility wrappers, or other code in arch/.h]hExceptions to this rule are only allowed in architecture-specific overrides, architecture-specific compatibility wrappers, or other code in arch/.}(hj(hhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhMZhjohhubeh}(h]&do-not-call-system-calls-in-the-kernelah ]h"]&do not call system calls in the kernelah$]h&]uh1hhhhhhhhM@ubh)}(hhh](h)}(hReferences and Sourcesh]hReferences and Sources}(hjAhhhNhNubah}(h]h ]h"]h$]h&]uh1hhj>hhhhhM_ubj)}(hX - LWN article from Michael Kerrisk on use of flags argument in system calls: https://lwn.net/Articles/585415/ - LWN article from Michael Kerrisk on how to handle unknown flags in a system call: https://lwn.net/Articles/588444/ - LWN article from Jake Edge describing constraints on 64-bit system call arguments: https://lwn.net/Articles/311630/ - Pair of LWN articles from David Drysdale that describe the system call implementation paths in detail for v3.14: - https://lwn.net/Articles/604287/ - https://lwn.net/Articles/604515/ - Architecture-specific requirements for system calls are discussed in the :manpage:`syscall(2)` man-page: http://man7.org/linux/man-pages/man2/syscall.2.html#NOTES - Collated emails from Linus Torvalds discussing the problems with ``ioctl()``: https://yarchive.net/comp/linux/ioctl.html - "How to not invent kernel interfaces", Arnd Bergmann, https://www.ukuug.org/events/linux2007/2007/papers/Bergmann.pdf - LWN article from Michael Kerrisk on avoiding new uses of CAP_SYS_ADMIN: https://lwn.net/Articles/486306/ - Recommendation from Andrew Morton that all related information for a new system call should come in the same email thread: https://lore.kernel.org/r/20140724144747.3041b208832bbdf9fbce5d96@linux-foundation.org - Recommendation from Michael Kerrisk that a new system call should come with a man page: https://lore.kernel.org/r/CAKgNAkgMA39AfoSoA5Pe1r9N+ZzfYQNvNPvcRN7tOvRb8+v06Q@mail.gmail.com - Suggestion from Thomas Gleixner that x86 wire-up should be in a separate commit: https://lore.kernel.org/r/alpine.DEB.2.11.1411191249560.3909@nanos - Suggestion from Greg Kroah-Hartman that it's good for new system calls to come with a man-page & selftest: https://lore.kernel.org/r/20140320025530.GA25469@kroah.com - Discussion from Michael Kerrisk of new system call vs. :manpage:`prctl(2)` extension: https://lore.kernel.org/r/CAHO5Pa3F2MjfTtfNxa8LbnkeeU8=YJ+9tDqxZpw7Gz59E-4AUg@mail.gmail.com - Suggestion from Ingo Molnar that system calls that involve multiple arguments should encapsulate those arguments in a struct, which includes a size field for future extensibility: https://lore.kernel.org/r/20150730083831.GA22182@gmail.com - Numbering oddities arising from (re-)use of O_* numbering space flags: - commit 75069f2b5bfb ("vfs: renumber FMODE_NONOTIFY and add to uniqueness check") - commit 12ed2e36c98a ("fanotify: FMODE_NONOTIFY and __O_SYNC in sparc conflict") - commit bb458c644a59 ("Safer ABI for O_TMPFILE") - Discussion from Matthew Wilcox about restrictions on 64-bit arguments: https://lore.kernel.org/r/20081212152929.GM26095@parisc-linux.org - Recommendation from Greg Kroah-Hartman that unknown flags should be policed: https://lore.kernel.org/r/20140717193330.GB4703@kroah.com - Recommendation from Linus Torvalds that x32 system calls should prefer compatibility with 64-bit versions rather than 32-bit versions: https://lore.kernel.org/r/CA+55aFxfmwfB7jbbrXxa=K7VBYPfAvmu3XOkGrLbB1UFjX1+Ew@mail.gmail.com - Patch series revising system call table infrastructure to use scripts/syscall.tbl across multiple architectures: https://lore.kernel.org/lkml/20240704143611.2979589-1-arnd@kernel.orgh]j$)}(hhh](j))}(hkLWN article from Michael Kerrisk on use of flags argument in system calls: https://lwn.net/Articles/585415/h]h)}(hkLWN article from Michael Kerrisk on use of flags argument in system calls: https://lwn.net/Articles/585415/h](hKLWN article from Michael Kerrisk on use of flags argument in system calls: }(hjZhhhNhNubjI)}(h https://lwn.net/Articles/585415/h]h https://lwn.net/Articles/585415/}(hjbhhhNhNubah}(h]h ]h"]h$]h&]refurijduh1jHhjZubeh}(h]h ]h"]h$]h&]uh1hhhhMahjVubah}(h]h ]h"]h$]h&]uh1j(hjSubj))}(hrLWN article from Michael Kerrisk on how to handle unknown flags in a system call: https://lwn.net/Articles/588444/h]h)}(hrLWN article from Michael Kerrisk on how to handle unknown flags in a system call: https://lwn.net/Articles/588444/h](hRLWN article from Michael Kerrisk on how to handle unknown flags in a system call: }(hjhhhNhNubjI)}(h https://lwn.net/Articles/588444/h]h https://lwn.net/Articles/588444/}(hjhhhNhNubah}(h]h ]h"]h$]h&]refurijuh1jHhjubeh}(h]h ]h"]h$]h&]uh1hhhhMchj}ubah}(h]h ]h"]h$]h&]uh1j(hjSubj))}(hsLWN article from Jake Edge describing constraints on 64-bit system call arguments: https://lwn.net/Articles/311630/h]h)}(hsLWN article from Jake Edge describing constraints on 64-bit system call arguments: https://lwn.net/Articles/311630/h](hSLWN article from Jake Edge describing constraints on 64-bit system call arguments: }(hjhhhNhNubjI)}(h https://lwn.net/Articles/311630/h]h https://lwn.net/Articles/311630/}(hjhhhNhNubah}(h]h ]h"]h$]h&]refurijuh1jHhjubeh}(h]h ]h"]h$]h&]uh1hhhhMehjubah}(h]h ]h"]h$]h&]uh1j(hjSubj))}(hPair of LWN articles from David Drysdale that describe the system call implementation paths in detail for v3.14: - https://lwn.net/Articles/604287/ - https://lwn.net/Articles/604515/ h](h)}(hpPair of LWN articles from David Drysdale that describe the system call implementation paths in detail for v3.14:h]hpPair of LWN articles from David Drysdale that describe the system call implementation paths in detail for v3.14:}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhMghjubj)}(hF- https://lwn.net/Articles/604287/ - https://lwn.net/Articles/604515/ h]j$)}(hhh](j))}(h https://lwn.net/Articles/604287/h]h)}(hjh]jI)}(hjh]h https://lwn.net/Articles/604287/}(hjhhhNhNubah}(h]h ]h"]h$]h&]refurijuh1jHhjubah}(h]h ]h"]h$]h&]uh1hhhhMjhjubah}(h]h ]h"]h$]h&]uh1j(hjubj))}(h!https://lwn.net/Articles/604515/ h]h)}(h https://lwn.net/Articles/604515/h]jI)}(hj h]h https://lwn.net/Articles/604515/}(hj hhhNhNubah}(h]h ]h"]h$]h&]refurij uh1jHhj ubah}(h]h ]h"]h$]h&]uh1hhhhMkhjubah}(h]h ]h"]h$]h&]uh1j(hjubeh}(h]h ]h"]h$]h&]jjuh1j#hhhMjhjubah}(h]h ]h"]h$]h&]uh1jhhhMjhjubeh}(h]h ]h"]h$]h&]uh1j(hjSubj))}(hArchitecture-specific requirements for system calls are discussed in the :manpage:`syscall(2)` man-page: http://man7.org/linux/man-pages/man2/syscall.2.html#NOTESh]h)}(hArchitecture-specific requirements for system calls are discussed in the :manpage:`syscall(2)` man-page: http://man7.org/linux/man-pages/man2/syscall.2.html#NOTESh](hIArchitecture-specific requirements for system calls are discussed in the }(hj=hhhNhNubj)}(h:manpage:`syscall(2)`h]h syscall(2)}(hjEhhhNhNubah}(h]h ]jah"]h$]h&]jjj syscall(2)jsyscalljjuh1jhj=ubh man-page: }(hj=hhhNhNubjI)}(h9http://man7.org/linux/man-pages/man2/syscall.2.html#NOTESh]h9http://man7.org/linux/man-pages/man2/syscall.2.html#NOTES}(hjYhhhNhNubah}(h]h ]h"]h$]h&]refurij[uh1jHhj=ubeh}(h]h ]h"]h$]h&]uh1hhhhMmhj9ubah}(h]h ]h"]h$]h&]uh1j(hjSubj))}(hxCollated emails from Linus Torvalds discussing the problems with ``ioctl()``: https://yarchive.net/comp/linux/ioctl.htmlh]h)}(hxCollated emails from Linus Torvalds discussing the problems with ``ioctl()``: https://yarchive.net/comp/linux/ioctl.htmlh](hACollated emails from Linus Torvalds discussing the problems with }(hjxhhhNhNubjP)}(h ``ioctl()``h]hioctl()}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1jOhjxubh: }(hjxhhhNhNubjI)}(h*https://yarchive.net/comp/linux/ioctl.htmlh]h*https://yarchive.net/comp/linux/ioctl.html}(hjhhhNhNubah}(h]h ]h"]h$]h&]refurijuh1jHhjxubeh}(h]h ]h"]h$]h&]uh1hhhhMphjtubah}(h]h ]h"]h$]h&]uh1j(hjSubj))}(hu"How to not invent kernel interfaces", Arnd Bergmann, https://www.ukuug.org/events/linux2007/2007/papers/Bergmann.pdfh]h)}(hu"How to not invent kernel interfaces", Arnd Bergmann, https://www.ukuug.org/events/linux2007/2007/papers/Bergmann.pdfh](h:“How to not invent kernel interfaces”, Arnd Bergmann, }(hjhhhNhNubjI)}(h?https://www.ukuug.org/events/linux2007/2007/papers/Bergmann.pdfh]h?https://www.ukuug.org/events/linux2007/2007/papers/Bergmann.pdf}(hjhhhNhNubah}(h]h ]h"]h$]h&]refurijuh1jHhjubeh}(h]h ]h"]h$]h&]uh1hhhhMrhjubah}(h]h ]h"]h$]h&]uh1j(hjSubj))}(hhLWN article from Michael Kerrisk on avoiding new uses of CAP_SYS_ADMIN: https://lwn.net/Articles/486306/h]h)}(hhLWN article from Michael Kerrisk on avoiding new uses of CAP_SYS_ADMIN: https://lwn.net/Articles/486306/h](hHLWN article from Michael Kerrisk on avoiding new uses of CAP_SYS_ADMIN: }(hjhhhNhNubjI)}(h https://lwn.net/Articles/486306/h]h https://lwn.net/Articles/486306/}(hjhhhNhNubah}(h]h ]h"]h$]h&]refurijuh1jHhjubeh}(h]h ]h"]h$]h&]uh1hhhhMthjubah}(h]h ]h"]h$]h&]uh1j(hjSubj))}(hRecommendation from Andrew Morton that all related information for a new system call should come in the same email thread: https://lore.kernel.org/r/20140724144747.3041b208832bbdf9fbce5d96@linux-foundation.orgh]h)}(hRecommendation from Andrew Morton that all related information for a new system call should come in the same email thread: https://lore.kernel.org/r/20140724144747.3041b208832bbdf9fbce5d96@linux-foundation.orgh](h{Recommendation from Andrew Morton that all related information for a new system call should come in the same email thread: }(hjhhhNhNubjI)}(hVhttps://lore.kernel.org/r/20140724144747.3041b208832bbdf9fbce5d96@linux-foundation.orgh]hVhttps://lore.kernel.org/r/20140724144747.3041b208832bbdf9fbce5d96@linux-foundation.org}(hjhhhNhNubah}(h]h ]h"]h$]h&]refurij uh1jHhjubeh}(h]h ]h"]h$]h&]uh1hhhhMvhjubah}(h]h ]h"]h$]h&]uh1j(hjSubj))}(hRecommendation from Michael Kerrisk that a new system call should come with a man page: https://lore.kernel.org/r/CAKgNAkgMA39AfoSoA5Pe1r9N+ZzfYQNvNPvcRN7tOvRb8+v06Q@mail.gmail.comh]h)}(hRecommendation from Michael Kerrisk that a new system call should come with a man page: https://lore.kernel.org/r/CAKgNAkgMA39AfoSoA5Pe1r9N+ZzfYQNvNPvcRN7tOvRb8+v06Q@mail.gmail.comh](hXRecommendation from Michael Kerrisk that a new system call should come with a man page: }(hj&hhhNhNubjI)}(h\https://lore.kernel.org/r/CAKgNAkgMA39AfoSoA5Pe1r9N+ZzfYQNvNPvcRN7tOvRb8+v06Q@mail.gmail.comh]h\https://lore.kernel.org/r/CAKgNAkgMA39AfoSoA5Pe1r9N+ZzfYQNvNPvcRN7tOvRb8+v06Q@mail.gmail.com}(hj.hhhNhNubah}(h]h ]h"]h$]h&]refurij0uh1jHhj&ubeh}(h]h ]h"]h$]h&]uh1hhhhMyhj"ubah}(h]h ]h"]h$]h&]uh1j(hjSubj))}(hSuggestion from Thomas Gleixner that x86 wire-up should be in a separate commit: https://lore.kernel.org/r/alpine.DEB.2.11.1411191249560.3909@nanosh]h)}(hSuggestion from Thomas Gleixner that x86 wire-up should be in a separate commit: https://lore.kernel.org/r/alpine.DEB.2.11.1411191249560.3909@nanosh](hQSuggestion from Thomas Gleixner that x86 wire-up should be in a separate commit: }(hjMhhhNhNubjI)}(hBhttps://lore.kernel.org/r/alpine.DEB.2.11.1411191249560.3909@nanosh]hBhttps://lore.kernel.org/r/alpine.DEB.2.11.1411191249560.3909@nanos}(hjUhhhNhNubah}(h]h ]h"]h$]h&]refurijWuh1jHhjMubeh}(h]h ]h"]h$]h&]uh1hhhhM{hjIubah}(h]h ]h"]h$]h&]uh1j(hjSubj))}(hSuggestion from Greg Kroah-Hartman that it's good for new system calls to come with a man-page & selftest: https://lore.kernel.org/r/20140320025530.GA25469@kroah.comh]h)}(hSuggestion from Greg Kroah-Hartman that it's good for new system calls to come with a man-page & selftest: https://lore.kernel.org/r/20140320025530.GA25469@kroah.comh](hmSuggestion from Greg Kroah-Hartman that it’s good for new system calls to come with a man-page & selftest: }(hjthhhNhNubjI)}(h:https://lore.kernel.org/r/20140320025530.GA25469@kroah.comh]h:https://lore.kernel.org/r/20140320025530.GA25469@kroah.com}(hj|hhhNhNubah}(h]h ]h"]h$]h&]refurij~uh1jHhjtubeh}(h]h ]h"]h$]h&]uh1hhhhM}hjpubah}(h]h ]h"]h$]h&]uh1j(hjSubj))}(hDiscussion from Michael Kerrisk of new system call vs. :manpage:`prctl(2)` extension: https://lore.kernel.org/r/CAHO5Pa3F2MjfTtfNxa8LbnkeeU8=YJ+9tDqxZpw7Gz59E-4AUg@mail.gmail.comh]h)}(hDiscussion from Michael Kerrisk of new system call vs. :manpage:`prctl(2)` extension: https://lore.kernel.org/r/CAHO5Pa3F2MjfTtfNxa8LbnkeeU8=YJ+9tDqxZpw7Gz59E-4AUg@mail.gmail.comh](h7Discussion from Michael Kerrisk of new system call vs. }(hjhhhNhNubj)}(h:manpage:`prctl(2)`h]hprctl(2)}(hjhhhNhNubah}(h]h ]jah"]h$]h&]jjjprctl(2)jprctljjuh1jhjubh extension: }(hjhhhNhNubjI)}(h\https://lore.kernel.org/r/CAHO5Pa3F2MjfTtfNxa8LbnkeeU8=YJ+9tDqxZpw7Gz59E-4AUg@mail.gmail.comh]h\https://lore.kernel.org/r/CAHO5Pa3F2MjfTtfNxa8LbnkeeU8=YJ+9tDqxZpw7Gz59E-4AUg@mail.gmail.com}(hjhhhNhNubah}(h]h ]h"]h$]h&]refurijuh1jHhjubeh}(h]h ]h"]h$]h&]uh1hhhhMhjubah}(h]h ]h"]h$]h&]uh1j(hjSubj))}(hSuggestion from Ingo Molnar that system calls that involve multiple arguments should encapsulate those arguments in a struct, which includes a size field for future extensibility: https://lore.kernel.org/r/20150730083831.GA22182@gmail.comh]h)}(hSuggestion from Ingo Molnar that system calls that involve multiple arguments should encapsulate those arguments in a struct, which includes a size field for future extensibility: https://lore.kernel.org/r/20150730083831.GA22182@gmail.comh](hSuggestion from Ingo Molnar that system calls that involve multiple arguments should encapsulate those arguments in a struct, which includes a size field for future extensibility: }(hjhhhNhNubjI)}(h:https://lore.kernel.org/r/20150730083831.GA22182@gmail.comh]h:https://lore.kernel.org/r/20150730083831.GA22182@gmail.com}(hjhhhNhNubah}(h]h ]h"]h$]h&]refurijuh1jHhjubeh}(h]h ]h"]h$]h&]uh1hhhhMhjubah}(h]h ]h"]h$]h&]uh1j(hjSubj))}(hX(Numbering oddities arising from (re-)use of O_* numbering space flags: - commit 75069f2b5bfb ("vfs: renumber FMODE_NONOTIFY and add to uniqueness check") - commit 12ed2e36c98a ("fanotify: FMODE_NONOTIFY and __O_SYNC in sparc conflict") - commit bb458c644a59 ("Safer ABI for O_TMPFILE") h](h)}(hFNumbering oddities arising from (re-)use of O_* numbering space flags:h]hFNumbering oddities arising from (re-)use of O_* numbering space flags:}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhMhjubj)}(h- commit 75069f2b5bfb ("vfs: renumber FMODE_NONOTIFY and add to uniqueness check") - commit 12ed2e36c98a ("fanotify: FMODE_NONOTIFY and __O_SYNC in sparc conflict") - commit bb458c644a59 ("Safer ABI for O_TMPFILE") h]j$)}(hhh](j))}(hPcommit 75069f2b5bfb ("vfs: renumber FMODE_NONOTIFY and add to uniqueness check")h]h)}(hPcommit 75069f2b5bfb ("vfs: renumber FMODE_NONOTIFY and add to uniqueness check")h]hTcommit 75069f2b5bfb (“vfs: renumber FMODE_NONOTIFY and add to uniqueness check”)}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhMhjubah}(h]h ]h"]h$]h&]uh1j(hjubj))}(hOcommit 12ed2e36c98a ("fanotify: FMODE_NONOTIFY and __O_SYNC in sparc conflict")h]h)}(hOcommit 12ed2e36c98a ("fanotify: FMODE_NONOTIFY and __O_SYNC in sparc conflict")h]hScommit 12ed2e36c98a (“fanotify: FMODE_NONOTIFY and __O_SYNC in sparc conflict”)}(hj.hhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhMhj*ubah}(h]h ]h"]h$]h&]uh1j(hjubj))}(h0commit bb458c644a59 ("Safer ABI for O_TMPFILE") h]h)}(h/commit bb458c644a59 ("Safer ABI for O_TMPFILE")h]h3commit bb458c644a59 (“Safer ABI for O_TMPFILE”)}(hjFhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhMhjBubah}(h]h ]h"]h$]h&]uh1j(hjubeh}(h]h ]h"]h$]h&]jjuh1j#hhhMhj ubah}(h]h ]h"]h$]h&]uh1jhhhMhjubeh}(h]h ]h"]h$]h&]uh1j(hjSubj))}(hDiscussion from Matthew Wilcox about restrictions on 64-bit arguments: https://lore.kernel.org/r/20081212152929.GM26095@parisc-linux.orgh]h)}(hDiscussion from Matthew Wilcox about restrictions on 64-bit arguments: https://lore.kernel.org/r/20081212152929.GM26095@parisc-linux.orgh](hGDiscussion from Matthew Wilcox about restrictions on 64-bit arguments: }(hjphhhNhNubjI)}(hAhttps://lore.kernel.org/r/20081212152929.GM26095@parisc-linux.orgh]hAhttps://lore.kernel.org/r/20081212152929.GM26095@parisc-linux.org}(hjxhhhNhNubah}(h]h ]h"]h$]h&]refurijzuh1jHhjpubeh}(h]h ]h"]h$]h&]uh1hhhhMhjlubah}(h]h ]h"]h$]h&]uh1j(hjSubj))}(hRecommendation from Greg Kroah-Hartman that unknown flags should be policed: https://lore.kernel.org/r/20140717193330.GB4703@kroah.comh]h)}(hRecommendation from Greg Kroah-Hartman that unknown flags should be policed: https://lore.kernel.org/r/20140717193330.GB4703@kroah.comh](hMRecommendation from Greg Kroah-Hartman that unknown flags should be policed: }(hjhhhNhNubjI)}(h9https://lore.kernel.org/r/20140717193330.GB4703@kroah.comh]h9https://lore.kernel.org/r/20140717193330.GB4703@kroah.com}(hjhhhNhNubah}(h]h ]h"]h$]h&]refurijuh1jHhjubeh}(h]h ]h"]h$]h&]uh1hhhhMhjubah}(h]h ]h"]h$]h&]uh1j(hjSubj))}(hRecommendation from Linus Torvalds that x32 system calls should prefer compatibility with 64-bit versions rather than 32-bit versions: https://lore.kernel.org/r/CA+55aFxfmwfB7jbbrXxa=K7VBYPfAvmu3XOkGrLbB1UFjX1+Ew@mail.gmail.comh]h)}(hRecommendation from Linus Torvalds that x32 system calls should prefer compatibility with 64-bit versions rather than 32-bit versions: https://lore.kernel.org/r/CA+55aFxfmwfB7jbbrXxa=K7VBYPfAvmu3XOkGrLbB1UFjX1+Ew@mail.gmail.comh](hRecommendation from Linus Torvalds that x32 system calls should prefer compatibility with 64-bit versions rather than 32-bit versions: }(hjhhhNhNubjI)}(h\https://lore.kernel.org/r/CA+55aFxfmwfB7jbbrXxa=K7VBYPfAvmu3XOkGrLbB1UFjX1+Ew@mail.gmail.comh]h\https://lore.kernel.org/r/CA+55aFxfmwfB7jbbrXxa=K7VBYPfAvmu3XOkGrLbB1UFjX1+Ew@mail.gmail.com}(hjhhhNhNubah}(h]h ]h"]h$]h&]refurijuh1jHhjubeh}(h]h ]h"]h$]h&]uh1hhhhMhjubah}(h]h ]h"]h$]h&]uh1j(hjSubj))}(hPatch series revising system call table infrastructure to use scripts/syscall.tbl across multiple architectures: https://lore.kernel.org/lkml/20240704143611.2979589-1-arnd@kernel.orgh]h)}(hPatch series revising system call table infrastructure to use scripts/syscall.tbl across multiple architectures: https://lore.kernel.org/lkml/20240704143611.2979589-1-arnd@kernel.orgh](hqPatch series revising system call table infrastructure to use scripts/syscall.tbl across multiple architectures: }(hjhhhNhNubjI)}(hEhttps://lore.kernel.org/lkml/20240704143611.2979589-1-arnd@kernel.orgh]hEhttps://lore.kernel.org/lkml/20240704143611.2979589-1-arnd@kernel.org}(hjhhhNhNubah}(h]h ]h"]h$]h&]refurijuh1jHhjubeh}(h]h ]h"]h$]h&]uh1hhhhMhjubah}(h]h ]h"]h$]h&]uh1j(hjSubeh}(h]h ]h"]h$]h&]jjuh1j#hhhMahjOubah}(h]h ]h"]h$]h&]uh1jhhhMahj>hhubeh}(h]references-and-sourcesah ]h"]references and sourcesah$]h&]uh1hhhhhhhhM_ubeh}(h](adding-a-new-system-callheh ]h"](adding a new system call addsyscallseh$]h&]uh1hhhhhhhhKj }j"hsj}hhsubeh}(h]h ]h"]h$]h&]sourcehuh1hcurrent_sourceN current_lineNsettingsdocutils.frontendValues)}(hN generatorN datestampN source_linkN source_urlN toc_backlinksentryfootnote_backlinksK sectnum_xformKstrip_commentsNstrip_elements_with_classesN strip_classesN report_levelK halt_levelKexit_status_levelKdebugNwarning_streamN tracebackinput_encoding utf-8-siginput_encoding_error_handlerstrictoutput_encodingutf-8output_encoding_error_handlerjJerror_encodingutf-8error_encoding_error_handlerbackslashreplace language_codeenrecord_dependenciesNconfigN id_prefixhauto_id_prefixid dump_settingsNdump_internalsNdump_transformsNdump_pseudo_xmlNexpose_internalsNstrict_visitorN_disable_configN_sourceh _destinationN _config_files]7/var/lib/git/docbuild/linux/Documentation/docutils.confafile_insertion_enabled raw_enabledKline_length_limitM'pep_referencesN pep_base_urlhttps://peps.python.org/pep_file_url_templatepep-%04drfc_referencesN rfc_base_url&https://datatracker.ietf.org/doc/html/ tab_widthKtrim_footnote_reference_spacesyntax_highlightlong smart_quotessmartquotes_locales]character_level_inline_markupdoctitle_xform docinfo_xformKsectsubtitle_xform image_loadinglinkembed_stylesheetcloak_email_addressessection_self_linkenvNubreporterNindirect_targets]substitution_defs}substitution_names}refnames}refids}(h]haj( ]j aj]jaunameids}(j"hj!jjjjjjjjijfjjj j( since 6.11Njxjuj$j!jjjjjjjjjSjPjjjljij;j8jju nametypes}(j"j!jjjjijj jjxj$jjjjjSjjlj;juh}(hhjhjhjjjj jfjjjlj( j) j j) juj j!j{jjsjjjjjj'jjjPjjjVjijj8jojj>u footnote_refs} citation_refs} autofootnotes]autofootnote_refs]symbol_footnotes]symbol_footnote_refs] footnotes] citations]autofootnote_startKsymbol_footnote_startK id_counter collectionsCounter}jXKsRparse_messages]hsystem_message)}(hhh]h)}(h-Duplicate implicit target name: "since 6.11".h]h1Duplicate implicit target name: “since 6.11”.}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhjubah}(h]h ]h"]h$]h&]jalevelKtypeINFOsourcehlineMuh1jhjshhhhhMubatransform_messages](j)}(hhh]h)}(hhh]h1Hyperlink target "addsyscalls" is not referenced.}hjsbah}(h]h ]h"]h$]h&]uh1hhjubah}(h]h ]h"]h$]h&]levelKtypejsourcehlineKuh1jubj)}(hhh]h)}(hhh]h:Hyperlink target "syscall-generic-6-11" is not referenced.}hjsbah}(h]h ]h"]h$]h&]uh1hhjubah}(h]h ]h"]h$]h&]levelKtypejsourcehlineKuh1jubj)}(hhh]h)}(hhh]h2Hyperlink target "compat-arm64" is not referenced.}hjsbah}(h]h ]h"]h$]h&]uh1hhjubah}(h]h ]h"]h$]h&]levelKtypejsourcehlineMuh1jube transformerN include_log] decorationNhhub.