xref: /linux/Documentation/process/coding-assistants.rst (revision 12d5fc96ebbb3b948861805b32a4c3a96105ccd9)
1.. SPDX-License-Identifier: GPL-2.0
2
3.. _coding_assistants:
4
5AI Coding Assistants
6++++++++++++++++++++
7
8This document provides guidance for AI tools and developers using AI
9assistance when contributing to the Linux kernel.
10
11AI tools helping with Linux kernel development should follow the standard
12kernel development process:
13
14* Documentation/process/development-process.rst
15* Documentation/process/coding-style.rst
16* Documentation/process/submitting-patches.rst
17
18For guidelines on content generated by AI coding assistants see:
19
20* Documentation/process/generated-content.rst
21
22Licensing and Legal Requirements
23================================
24
25All contributions must comply with the kernel's licensing requirements:
26
27* All code must be compatible with GPL-2.0-only
28* Use appropriate SPDX license identifiers
29* See Documentation/process/license-rules.rst for details
30
31Signed-off-by and Developer Certificate of Origin
32=================================================
33
34AI agents MUST NOT add Signed-off-by tags. Only humans can legally
35certify the Developer Certificate of Origin (DCO). The human submitter
36is responsible for:
37
38* Reviewing all AI-generated code
39* Ensuring compliance with licensing requirements
40* Adding their own Signed-off-by tag to certify the DCO
41* Taking full responsibility for the contribution
42
43Procedure for finding and fixing bugs
44=====================================
45
46When an AI assistant is used to find and fix bugs, it **MUST** follow at least
47these steps:
48
491. Before starting, read the whole process documentation listed above, as well
50   as any other document mentioned in the request. Do not rely on isolated
51   parts found by keyword search.
522. Note the commit ID and Locate a bug as instructed.
533. For any bug found that is not trivial, verify that it looks real by
54   attempting to create a reproducer to demonstrate it. Lacking it may cause
55   the report to be ignored, as many unverified bug reports sent to maintainers
56   happen to be invalid. Stop here if it finally looks wrong.
574. Write a fix for the bug. This part is not optional: except in a few very
58   rare cases, an AI assistant able to find a bug is able to fix it. Note that
59   fixes written in the same session as used to find the bug will generally
60   lead to better and more accurate fixes as the LLM's reasoning context
61   remains present.
625. Build and verify that the fix works either using the reproducer or by
63   re-running a complete analysis; drop any fix that doesn't work and try
64   another one. The fix must not add build warnings and must pass the
65   checkpatch.pl checks (see submitting-patches.rst).
666. Commit the working fix with a detailed message describing the problem, the
67   solution and a Fixes tag. Do not add a Signed-off-by tag.
687. Identify the maintainers and lists using scripts/get_maintainer.pl.
69   Documentation/process/security-bugs.rst shows how to do that.
708. Indicate what could not be done. If the fix could not be built or tested, or
71   if no reproducer could be produced, say so explicitly: maintainers currently
72   waste too much time analyzing unverified reports and untested fixes.
739. Read Documentation/process/threat-model.rst to determine whether the bug is
74   a vulnerability or a regular bug, and leave the result to the reporter for
75   review (the assistant must never send anything itself). Regular bugs are
76   submitted as described in Documentation/process/submitting-patches.rst,
77   vulnerabilities as described in Documentation/process/security-bugs.rst.
78