← Documents Documentation/process/license-rules.rst GitHub 원문 ↗

Linux 6.18.37 · 정책과 보안

Linux kernel license와 SPDX 규칙

GPL-2.0-only kernel license, UAPI syscall exception, SPDX expression, license directory와 MODULE_LICENSE의 실제 의미를 설명합니다.

Source pathDocumentation/process/license-rules.rst
Source versionLinux v6.18.37
TranslationDUJINLABS 전문 번역 + 해설

요약·해설과 원문, 전문 번역을 서로 분리했습니다. API 이름, symbol, source path는 원문 표기를 사용합니다.

1. 요약·해설

원문의 핵심 논리와 kernel programming 관점의 보충 설명입니다. 아래의 전문 번역과는 별도로 작성했습니다.

Kernel 전체 license와 개별 file

license-rules.rst:5-56

Linux kernel 전체는 COPYING과 LICENSES/preferred/GPL-2.0에 정의된 GPL version 2 only로 제공되며 명시적인 Linux syscall exception이 있다. 개별 source file은 GPL-2.0과 호환되는 다른 license 또는 GPL-compatible license와 BSD·MIT 같은 permissive license의 dual-license를 사용할 수 있다.

UAPI header는 userspace program이 include하므로 특별하다. Syscall interface는 GPL requirement가 userspace software로 확장되지 않는 명확한 경계이고, header에는 Linux-syscall-note exception을 포함한 expression으로 이를 표시한다.

긴 boilerplate text는 typo와 formatting 차이 때문에 자동 compliance 검증이 어렵다. Kernel은 machine-readable하고 정확한 SPDX-License-Identifier를 모든 source file에 요구한다.

SPDX identifier 위치와 comment 형식

license-rules.rst:58-90

Identifier는 comment를 쓸 수 있는 첫 줄에 둔다. Interpreter shebang이 필요한 script만 두 번째 줄에 둔다. File type과 tool parser가 이해하는 comment 문법을 사용한다.

// SPDX-License-Identifier: GPL-2.0          /* C source, DTS */
/* SPDX-License-Identifier: GPL-2.0 */       /* C header, ASM */
# SPDX-License-Identifier: GPL-2.0            # script
.. SPDX-License-Identifier: GPL-2.0           # reStructuredText

WITH, OR, AND와 or-later

license-rules.rst:93-149
연산자의미
+해당 version 또는 이후 versionGPL-2.0+, LGPL-2.1+
WITH특정 license에 허용된 exception을 적용GPL-2.0 WITH Linux-syscall-note
ORDual license 중 하나를 선택할 수 있음GPL-2.0 OR BSD-3-Clause
AND두 license 조건을 모두 지켜야 함(GPL-2.0 WITH Linux-syscall-note) AND MIT

복합 expression은 parenthesis로 범위를 명확히 한다. Exception은 아무 license에나 붙일 수 없고 exception file의 SPDX-Licenses metatag에 허용된 identifier와만 조합한다.

Preferred, deprecated와 dual-only license

license-rules.rst:151-330

LICENSES/preferred에는 새 code에 우선 사용할 완전 호환·광범위 사용 license를 둔다. LICENSES/deprecated는 기존 code 유지 또는 다른 project에서 import할 때만 쓰고 새 code에는 권장하지 않는다. LICENSES/dual은 GPL-compatible preferred license와 OR로 dual-license할 때만 사용할 수 있는 license다.

각 license file 이름은 source에서 쓰는 SPDX identifier와 같고 Valid-License-Identifier, SPDX-URL, Usage-Guidance, License-Text metatag를 갖는다. 'or later'처럼 한 text에 여러 valid identifier가 있을 수 있다.

예를 들어 MPL-1.1은 GPLv2와 호환되지 않으므로 단독으로 새 kernel code에 쓸 수 없고 GPLv2-compatible license와 OR로 결합한 dual-license에서만 사용할 수 있다.

License exception file

license-rules.rst:333-423

LICENSES/exceptions에는 원 license에 추가 권리를 주는 exception text를 둔다. Linux-syscall-note는 UAPI header를 non-GPL userspace application이 include할 수 있게 하고, GCC-exception-2.0은 GCC runtime에서 import한 compiled code와 다른 license binary의 linking을 허용한다.

Exception file은 SPDX-Exception-Identifier, SPDX-URL, 함께 쓸 수 있는 SPDX-Licenses 목록, Usage-Guidance와 Exception-Text를 포함한다. Kernel에서 사용하는 모든 identifier와 exception은 LICENSES subtree에 대응 file이 있어야 checkpatch와 compliance tool이 검증하고 source 자체에서 text를 추출할 수 있다.

MODULE_LICENSE는 source license를 대신하지 않는다

license-rules.rst:425-484

Loadable module은 MODULE_LICENSE() tag도 필요하지만 이것은 SPDX source license의 대체가 아니며 정확한 법적 license를 결정하지 않는다. Module loader와 userspace tool에 free software인지 proprietary인지 알리는 운영상 표식이다.

문자열Loader 관점의 의미
GPL, GPL v2GPLv2-compatible module. only와 or-later 차이는 source SPDX에서 확인한다.
Dual MIT/GPLGPLv2 variant 또는 MIT 중 선택 가능한 dual license
Dual BSD/GPLGPLv2 variant 또는 source에 적힌 BSD variant 중 선택
Dual MPL/GPLGPLv2 variant 또는 source에 적힌 MPL variant 중 선택
ProprietaryGPLv2와 호환되지 않는 외부 module

Proprietary module을 load하면 kernel에 P taint가 생기고 loader는 EXPORT_SYMBOL_GPL symbol과 link하지 않는다. In-tree source에는 Proprietary MODULE_LICENSE를 사용할 수 없다.

2. 영어 원문 전체

번역 기준이 된 Linux v6.18.37 원문입니다. 줄 번호는 이 버전의 파일 좌표입니다.

원문 전체 펼치기
1 .. SPDX-License-Identifier: GPL-2.0
2
3 .. _kernel_licensing:
4
5 Linux kernel licensing rules
6 ============================
7
8 The Linux Kernel is provided under the terms of the GNU General Public
9 License version 2 only (GPL-2.0), as provided in LICENSES/preferred/GPL-2.0,
10 with an explicit syscall exception described in
11 LICENSES/exceptions/Linux-syscall-note, as described in the COPYING file.
12
13 This documentation file provides a description of how each source file
14 should be annotated to make its license clear and unambiguous.
15 It doesn't replace the Kernel's license.
16
17 The license described in the COPYING file applies to the kernel source
18 as a whole, though individual source files can have a different license
19 which is required to be compatible with the GPL-2.0::
20
21 GPL-1.0+ : GNU General Public License v1.0 or later
22 GPL-2.0+ : GNU General Public License v2.0 or later
23 LGPL-2.0 : GNU Library General Public License v2 only
24 LGPL-2.0+ : GNU Library General Public License v2 or later
25 LGPL-2.1 : GNU Lesser General Public License v2.1 only
26 LGPL-2.1+ : GNU Lesser General Public License v2.1 or later
27
28 Aside from that, individual files can be provided under a dual license,
29 e.g. one of the compatible GPL variants and alternatively under a
30 permissive license like BSD, MIT etc.
31
32 The User-space API (UAPI) header files, which describe the interface of
33 user-space programs to the kernel are a special case. According to the
34 note in the kernel COPYING file, the syscall interface is a clear boundary,
35 which does not extend the GPL requirements to any software which uses it to
36 communicate with the kernel. Because the UAPI headers must be includable
37 into any source files which create an executable running on the Linux
38 kernel, the exception must be documented by a special license expression.
39
40 The common way of expressing the license of a source file is to add the
41 matching boilerplate text into the top comment of the file. Due to
42 formatting, typos etc. these "boilerplates" are hard to validate for
43 tools which are used in the context of license compliance.
44
45 An alternative to boilerplate text is the use of Software Package Data
46 Exchange (SPDX) license identifiers in each source file. SPDX license
47 identifiers are machine parsable and precise shorthands for the license
48 under which the content of the file is contributed. SPDX license
49 identifiers are managed by the SPDX Workgroup at the Linux Foundation and
50 have been agreed on by partners throughout the industry, tool vendors, and
51 legal teams. For further information see https://spdx.org/
52
53 The Linux kernel requires the precise SPDX identifier in all source files.
54 The valid identifiers used in the kernel are explained in the section
55 `License identifiers`_ and have been retrieved from the official SPDX
56 license list at https://spdx.org/licenses/ along with the license texts.
57
58 License identifier syntax
59 -------------------------
60
61 1. Placement:
62
63 The SPDX license identifier in kernel files shall be added at the first
64 possible line in a file which can contain a comment. For the majority
65 of files this is the first line, except for scripts which require the
66 '#!PATH_TO_INTERPRETER' in the first line. For those scripts the SPDX
67 identifier goes into the second line.
68
69 |
70
71 2. Style:
72
73 The SPDX license identifier is added in form of a comment. The comment
74 style depends on the file type::
75
76 C source: // SPDX-License-Identifier: <SPDX License Expression>
77 C header: /* SPDX-License-Identifier: <SPDX License Expression> */
78 ASM: /* SPDX-License-Identifier: <SPDX License Expression> */
79 scripts: # SPDX-License-Identifier: <SPDX License Expression>
80 .rst: .. SPDX-License-Identifier: <SPDX License Expression>
81 .dts{i}: // SPDX-License-Identifier: <SPDX License Expression>
82
83 If a specific tool cannot handle the standard comment style, then the
84 appropriate comment mechanism which the tool accepts shall be used. This
85 is the reason for having the "/\* \*/" style comment in C header
86 files. There was build breakage observed with generated .lds files where
87 'ld' failed to parse the C++ comment. This has been fixed by now, but
88 there are still older assembler tools which cannot handle C++ style
89 comments.
90
91 |
92
93 3. Syntax:
94
95 A <SPDX License Expression> is either an SPDX short form license
96 identifier found on the SPDX License List, or the combination of two
97 SPDX short form license identifiers separated by "WITH" when a license
98 exception applies. When multiple licenses apply, an expression consists
99 of keywords "AND", "OR" separating sub-expressions and surrounded by
100 "(", ")" .
101
102 License identifiers for licenses like [L]GPL with the 'or later' option
103 are constructed by using a "+" for indicating the 'or later' option.::
104
105 // SPDX-License-Identifier: GPL-2.0+
106 // SPDX-License-Identifier: LGPL-2.1+
107
108 WITH should be used when there is a modifier to a license needed.
109 For example, the linux kernel UAPI files use the expression::
110
111 // SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note
112 // SPDX-License-Identifier: GPL-2.0+ WITH Linux-syscall-note
113
114 Other examples using WITH exceptions found in the kernel are::
115
116 // SPDX-License-Identifier: GPL-2.0 WITH mif-exception
117 // SPDX-License-Identifier: GPL-2.0+ WITH GCC-exception-2.0
118
119 Exceptions can only be used with particular License identifiers. The
120 valid License identifiers are listed in the tags of the exception text
121 file. For details see the point `Exceptions`_ in the chapter `License
122 identifiers`_.
123
124 OR should be used if the file is dual licensed and only one license is
125 to be selected. For example, some dtsi files are available under dual
126 licenses::
127
128 // SPDX-License-Identifier: GPL-2.0 OR BSD-3-Clause
129
130 Examples from the kernel for license expressions in dual licensed files::
131
132 // SPDX-License-Identifier: GPL-2.0 OR MIT
133 // SPDX-License-Identifier: GPL-2.0 OR BSD-2-Clause
134 // SPDX-License-Identifier: GPL-2.0 OR Apache-2.0
135 // SPDX-License-Identifier: GPL-2.0 OR MPL-1.1
136 // SPDX-License-Identifier: (GPL-2.0 WITH Linux-syscall-note) OR MIT
137 // SPDX-License-Identifier: GPL-1.0+ OR BSD-3-Clause OR OpenSSL
138
139 AND should be used if the file has multiple licenses whose terms all
140 apply to use the file. For example, if code is inherited from another
141 project and permission has been given to put it in the kernel, but the
142 original license terms need to remain in effect::
143
144 // SPDX-License-Identifier: (GPL-2.0 WITH Linux-syscall-note) AND MIT
145
146 Another other example where both sets of license terms need to be
147 adhered to is::
148
149 // SPDX-License-Identifier: GPL-1.0+ AND LGPL-2.1+
150
151 License identifiers
152 -------------------
153
154 The licenses currently used, as well as the licenses for code added to the
155 kernel, can be broken down into:
156
157 1. _`Preferred licenses`:
158
159 Whenever possible these licenses should be used as they are known to be
160 fully compatible and widely used. These licenses are available from the
161 directory::
162
163 LICENSES/preferred/
164
165 in the kernel source tree.
166
167 The files in this directory contain the full license text and
168 `Metatags`_. The file names are identical to the SPDX license
169 identifier which shall be used for the license in source files.
170
171 Examples::
172
173 LICENSES/preferred/GPL-2.0
174
175 Contains the GPL version 2 license text and the required metatags::
176
177 LICENSES/preferred/MIT
178
179 Contains the MIT license text and the required metatags
180
181 _`Metatags`:
182
183 The following meta tags must be available in a license file:
184
185 - Valid-License-Identifier:
186
187 One or more lines which declare which License Identifiers are valid
188 inside the project to reference this particular license text. Usually
189 this is a single valid identifier, but e.g. for licenses with the 'or
190 later' options two identifiers are valid.
191
192 - SPDX-URL:
193
194 The URL of the SPDX page which contains additional information related
195 to the license.
196
197 - Usage-Guidance:
198
199 Freeform text for usage advice. The text must include correct examples
200 for the SPDX license identifiers as they should be put into source
201 files according to the `License identifier syntax`_ guidelines.
202
203 - License-Text:
204
205 All text after this tag is treated as the original license text
206
207 File format examples::
208
209 Valid-License-Identifier: GPL-2.0
210 Valid-License-Identifier: GPL-2.0+
211 SPDX-URL: https://spdx.org/licenses/GPL-2.0.html
212 Usage-Guide:
213 To use this license in source code, put one of the following SPDX
214 tag/value pairs into a comment according to the placement
215 guidelines in the licensing rules documentation.
216 For 'GNU General Public License (GPL) version 2 only' use:
217 SPDX-License-Identifier: GPL-2.0
218 For 'GNU General Public License (GPL) version 2 or any later version' use:
219 SPDX-License-Identifier: GPL-2.0+
220 License-Text:
221 Full license text
222
223 ::
224
225 SPDX-License-Identifier: MIT
226 SPDX-URL: https://spdx.org/licenses/MIT.html
227 Usage-Guide:
228 To use this license in source code, put the following SPDX
229 tag/value pair into a comment according to the placement
230 guidelines in the licensing rules documentation.
231 SPDX-License-Identifier: MIT
232 License-Text:
233 Full license text
234
235 |
236
237 2. Deprecated licenses:
238
239 These licenses should only be used for existing code or for importing
240 code from a different project. These licenses are available from the
241 directory::
242
243 LICENSES/deprecated/
244
245 in the kernel source tree.
246
247 The files in this directory contain the full license text and
248 `Metatags`_. The file names are identical to the SPDX license
249 identifier which shall be used for the license in source files.
250
251 Examples::
252
253 LICENSES/deprecated/ISC
254
255 Contains the Internet Systems Consortium license text and the required
256 metatags::
257
258 LICENSES/deprecated/GPL-1.0
259
260 Contains the GPL version 1 license text and the required metatags.
261
262 Metatags:
263
264 The metatag requirements for 'other' licenses are identical to the
265 requirements of the `Preferred licenses`_.
266
267 File format example::
268
269 Valid-License-Identifier: ISC
270 SPDX-URL: https://spdx.org/licenses/ISC.html
271 Usage-Guide:
272 Usage of this license in the kernel for new code is discouraged
273 and it should solely be used for importing code from an already
274 existing project.
275 To use this license in source code, put the following SPDX
276 tag/value pair into a comment according to the placement
277 guidelines in the licensing rules documentation.
278 SPDX-License-Identifier: ISC
279 License-Text:
280 Full license text
281
282 |
283
284 3. Dual Licensing Only
285
286 These licenses should only be used to dual license code with another
287 license in addition to a preferred license. These licenses are available
288 from the directory::
289
290 LICENSES/dual/
291
292 in the kernel source tree.
293
294 The files in this directory contain the full license text and
295 `Metatags`_. The file names are identical to the SPDX license
296 identifier which shall be used for the license in source files.
297
298 Examples::
299
300 LICENSES/dual/MPL-1.1
301
302 Contains the Mozilla Public License version 1.1 license text and the
303 required metatags::
304
305 LICENSES/dual/Apache-2.0
306
307 Contains the Apache License version 2.0 license text and the required
308 metatags.
309
310 Metatags:
311
312 The metatag requirements for 'other' licenses are identical to the
313 requirements of the `Preferred licenses`_.
314
315 File format example::
316
317 Valid-License-Identifier: MPL-1.1
318 SPDX-URL: https://spdx.org/licenses/MPL-1.1.html
319 Usage-Guide:
320 Do NOT use. The MPL-1.1 is not GPL2 compatible. It may only be used for
321 dual-licensed files where the other license is GPL2 compatible.
322 If you end up using this it MUST be used together with a GPL2 compatible
323 license using "OR".
324 To use the Mozilla Public License version 1.1 put the following SPDX
325 tag/value pair into a comment according to the placement guidelines in
326 the licensing rules documentation:
327 SPDX-License-Identifier: MPL-1.1
328 License-Text:
329 Full license text
330
331 |
332
333 4. _`Exceptions`:
334
335 Some licenses can be amended with exceptions which grant certain rights
336 which the original license does not. These exceptions are available
337 from the directory::
338
339 LICENSES/exceptions/
340
341 in the kernel source tree. The files in this directory contain the full
342 exception text and the required `Exception Metatags`_.
343
344 Examples::
345
346 LICENSES/exceptions/Linux-syscall-note
347
348 Contains the Linux syscall exception as documented in the COPYING
349 file of the Linux kernel, which is used for UAPI header files.
350 e.g. /\* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note \*/::
351
352 LICENSES/exceptions/GCC-exception-2.0
353
354 Contains the GCC 'linking exception' which allows to link any binary
355 independent of its license against the compiled version of a file marked
356 with this exception. This is required for creating runnable executables
357 from source code which is not compatible with the GPL.
358
359 _`Exception Metatags`:
360
361 The following meta tags must be available in an exception file:
362
363 - SPDX-Exception-Identifier:
364
365 One exception identifier which can be used with SPDX license
366 identifiers.
367
368 - SPDX-URL:
369
370 The URL of the SPDX page which contains additional information related
371 to the exception.
372
373 - SPDX-Licenses:
374
375 A comma separated list of SPDX license identifiers for which the
376 exception can be used.
377
378 - Usage-Guidance:
379
380 Freeform text for usage advice. The text must be followed by correct
381 examples for the SPDX license identifiers as they should be put into
382 source files according to the `License identifier syntax`_ guidelines.
383
384 - Exception-Text:
385
386 All text after this tag is treated as the original exception text
387
388 File format examples::
389
390 SPDX-Exception-Identifier: Linux-syscall-note
391 SPDX-URL: https://spdx.org/licenses/Linux-syscall-note.html
392 SPDX-Licenses: GPL-2.0, GPL-2.0+, GPL-1.0+, LGPL-2.0, LGPL-2.0+, LGPL-2.1, LGPL-2.1+
393 Usage-Guidance:
394 This exception is used together with one of the above SPDX-Licenses
395 to mark user-space API (uapi) header files so they can be included
396 into non GPL compliant user-space application code.
397 To use this exception add it with the keyword WITH to one of the
398 identifiers in the SPDX-Licenses tag:
399 SPDX-License-Identifier: <SPDX-License> WITH Linux-syscall-note
400 Exception-Text:
401 Full exception text
402
403 ::
404
405 SPDX-Exception-Identifier: GCC-exception-2.0
406 SPDX-URL: https://spdx.org/licenses/GCC-exception-2.0.html
407 SPDX-Licenses: GPL-2.0, GPL-2.0+
408 Usage-Guidance:
409 The "GCC Runtime Library exception 2.0" is used together with one
410 of the above SPDX-Licenses for code imported from the GCC runtime
411 library.
412 To use this exception add it with the keyword WITH to one of the
413 identifiers in the SPDX-Licenses tag:
414 SPDX-License-Identifier: <SPDX-License> WITH GCC-exception-2.0
415 Exception-Text:
416 Full exception text
417
418
419 All SPDX license identifiers and exceptions must have a corresponding file
420 in the LICENSES subdirectories. This is required to allow tool
421 verification (e.g. checkpatch.pl) and to have the licenses ready to read
422 and extract right from the source, which is recommended by various FOSS
423 organizations, e.g. the `FSFE REUSE initiative <https://reuse.software/>`_.
424
425 _`MODULE_LICENSE`
426 -----------------
427
428 Loadable kernel modules also require a MODULE_LICENSE() tag. This tag is
429 neither a replacement for proper source code license information
430 (SPDX-License-Identifier) nor in any way relevant for expressing or
431 determining the exact license under which the source code of the module
432 is provided.
433
434 The sole purpose of this tag is to provide sufficient information
435 whether the module is free software or proprietary for the kernel
436 module loader and for user space tools.
437
438 The valid license strings for MODULE_LICENSE() are:
439
440 ============================= =============================================
441 "GPL" Module is licensed under GPL version 2. This
442 does not express any distinction between
443 GPL-2.0-only or GPL-2.0-or-later. The exact
444 license information can only be determined
445 via the license information in the
446 corresponding source files.
447
448 "GPL v2" Same as "GPL". It exists for historic
449 reasons.
450
451 "GPL and additional rights" Historical variant of expressing that the
452 module source is dual licensed under a
453 GPL v2 variant and MIT license. Please do
454 not use in new code.
455
456 "Dual MIT/GPL" The correct way of expressing that the
457 module is dual licensed under a GPL v2
458 variant or MIT license choice.
459
460 "Dual BSD/GPL" The module is dual licensed under a GPL v2
461 variant or BSD license choice. The exact
462 variant of the BSD license can only be
463 determined via the license information
464 in the corresponding source files.
465
466 "Dual MPL/GPL" The module is dual licensed under a GPL v2
467 variant or Mozilla Public License (MPL)
468 choice. The exact variant of the MPL
469 license can only be determined via the
470 license information in the corresponding
471 source files.
472
473 "Proprietary" The module is under a proprietary license.
474 "Proprietary" is to be understood only as
475 "The license is not compatible to GPLv2".
476 This string is solely for non-GPL2 compatible
477 third party modules and cannot be used for
478 modules which have their source code in the
479 kernel tree. Modules tagged that way are
480 tainting the kernel with the 'P' flag when
481 loaded and the kernel module loader refuses
482 to link such modules against symbols which
483 are exported with EXPORT_SYMBOL_GPL().
484 ============================= =============================================
485
486
487
488

3. 한국어 전문 번역

영어 원문의 문단 순서와 의미를 유지한 전체 번역입니다. 코드, 함수명, symbol과 URL은 원문 표기를 유지합니다.

Linux kernel license와 개별 source file

1-38

Linux kernel 전체는 COPYING file에 설명된 대로 LICENSES/preferred/GPL-2.0의 GNU General Public License version 2 only(GPL-2.0) 조건과 LICENSES/exceptions/Linux-syscall-note의 명시적 syscall exception에 따라 제공된다.

이 문서는 각 source file의 license를 명확하고 모호하지 않게 표시하는 방법을 설명하며 kernel 자체 license를 대체하지 않는다. COPYING의 license는 kernel source 전체에 적용되지만 개별 source file은 GPL-2.0과 호환되는 다른 license를 가질 수 있다.

식별자원문에서 설명하는 license
GPL-1.0+GNU General Public License v1.0 or later
GPL-2.0+GNU General Public License v2.0 or later
LGPL-2.0GNU Library General Public License v2 only
LGPL-2.0+GNU Library General Public License v2 or later
LGPL-2.1GNU Lesser General Public License v2.1 only
LGPL-2.1+GNU Lesser General Public License v2.1 or later

개별 file은 호환되는 GPL variant 하나와 BSD·MIT 같은 permissive license를 선택지로 함께 제공하는 dual license를 사용할 수도 있다.

User-space program과 kernel 사이 interface를 기술하는 User-space API(UAPI) header는 특별한 경우다. COPYING의 note에 따르면 syscall interface는 명확한 경계이며, 이를 통해 kernel과 통신하는 software에 GPL 요구 사항이 확장되지 않는다. UAPI header는 Linux kernel에서 실행될 executable을 만드는 어떤 source file에도 include될 수 있어야 하므로 이 exception을 특별한 license expression으로 문서화해야 한다.

Boilerplate 대신 SPDX identifier를 사용하는 이유

40-56

Source file의 license를 표현하는 전통적인 방법은 file 첫 comment에 해당 boilerplate text를 넣는 것이다. 하지만 formatting 차이와 오타 때문에 license compliance 도구가 이런 boilerplate를 검증하기 어렵다.

대안은 각 source file에 Software Package Data Exchange(SPDX) license identifier를 사용하는 것이다. SPDX identifier는 machine이 parse할 수 있고, file content가 어떤 license로 기여되었는지 정확하고 짧게 나타낸다. Linux Foundation의 SPDX Workgroup이 관리하며 산업계 partner, tool vendor와 legal team 사이에 합의된 체계다.

Linux kernel은 모든 source file에 정확한 SPDX identifier를 요구한다. Kernel에서 유효한 identifier는 이 문서의 License identifiers 절에 설명되어 있으며 license text와 함께 official SPDX license list에서 가져온 것이다.

Identifier 위치와 file type별 comment 형식

58-89

Kernel file의 SPDX license identifier는 comment를 넣을 수 있는 가장 첫 line에 둔다. 대부분 file에서는 첫 line이다. 첫 line에 #!PATH_TO_INTERPRETER가 필요한 script는 SPDX identifier를 두 번째 line에 둔다.

C source: // SPDX-License-Identifier: <SPDX License Expression>
C header: /* SPDX-License-Identifier: <SPDX License Expression> */
ASM:      /* SPDX-License-Identifier: <SPDX License Expression> */
scripts:  # SPDX-License-Identifier: <SPDX License Expression>
.rst:     .. SPDX-License-Identifier: <SPDX License Expression>
.dts{i}:  // SPDX-License-Identifier: <SPDX License Expression>

특정 tool이 표준 comment style을 처리하지 못하면 그 tool이 허용하는 comment mechanism을 사용한다. C header에 /* */ style을 쓰는 이유도 여기에 있다. 과거 generated .lds file에서 ld가 C++ comment를 parse하지 못해 build가 깨진 적이 있다. 그 문제는 수정되었지만 C++ style comment를 처리하지 못하는 오래된 assembler tool이 아직 남아 있다.

SPDX expression 문법: +, WITH, OR, AND

93-149

SPDX License Expression은 SPDX License List의 short-form license identifier 하나이거나, exception이 적용될 때 두 identifier를 WITH로 결합한 형태다. 여러 license가 함께 적용되면 AND 또는 OR keyword로 sub-expression을 나누고 필요에 따라 괄호로 묶는다.

or later를 나타내는 +

// SPDX-License-Identifier: GPL-2.0+
// SPDX-License-Identifier: LGPL-2.1+

[L]GPL에서 해당 version 이후도 허용하는 or later option은 identifier 뒤에 +를 붙여 나타낸다.

License modifier를 결합하는 WITH

// SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note
// SPDX-License-Identifier: GPL-2.0+ WITH Linux-syscall-note
// SPDX-License-Identifier: GPL-2.0 WITH mif-exception
// SPDX-License-Identifier: GPL-2.0+ WITH GCC-exception-2.0

License에 modifier가 필요하면 WITH를 사용한다. Linux kernel UAPI file은 Linux-syscall-note를 결합한다. Exception은 아무 license에나 붙일 수 없으며 exception text file의 tag에 나열된 license identifier하고만 사용할 수 있다.

선택 가능한 dual license의 OR

// SPDX-License-Identifier: GPL-2.0 OR BSD-3-Clause
// SPDX-License-Identifier: GPL-2.0 OR MIT
// SPDX-License-Identifier: GPL-2.0 OR BSD-2-Clause
// SPDX-License-Identifier: GPL-2.0 OR Apache-2.0
// SPDX-License-Identifier: GPL-2.0 OR MPL-1.1
// SPDX-License-Identifier: (GPL-2.0 WITH Linux-syscall-note) OR MIT
// SPDX-License-Identifier: GPL-1.0+ OR BSD-3-Clause OR OpenSSL

File이 dual licensed되어 있고 사용자가 그중 하나를 선택할 수 있다면 OR를 사용한다. 일부 dtsi file이 이 형태로 제공된다.

모든 조건이 동시에 적용되는 AND

// SPDX-License-Identifier: (GPL-2.0 WITH Linux-syscall-note) AND MIT
// SPDX-License-Identifier: GPL-1.0+ AND LGPL-2.1+

File 사용에 여러 license 조건이 모두 적용되면 AND를 사용한다. 다른 project에서 code를 가져오면서 kernel에 넣을 permission을 받았지만 original license 조건도 계속 유효한 경우가 예다.

Preferred license와 license-file metatag

151-235

현재 사용 중인 license와 새로 kernel에 추가되는 code의 license는 여러 category로 나뉜다. 가능한 경우 완전한 compatibility가 알려져 있고 널리 사용되는 preferred license를 선택해야 한다. 이 file들은 kernel source tree의 LICENSES/preferred/ 아래에 있으며 full license text와 metatag를 포함한다. Filename은 source file에서 사용할 SPDX license identifier와 같다.

  • LICENSES/preferred/GPL-2.0: GPL version 2 license text와 필수 metatag
  • LICENSES/preferred/MIT: MIT license text와 필수 metatag
Metatag의미
Valid-License-IdentifierProject에서 이 license text를 가리키는 데 유효한 identifier. 보통 하나지만 or later option이면 두 identifier가 유효할 수 있다.
SPDX-URL해당 license의 추가 정보를 담은 SPDX page URL
Usage-Guidance사용 지침을 담는 freeform text. License identifier syntax 지침에 맞는 정확한 source-file 예제를 포함해야 한다.
License-Text이 tag 뒤의 모든 text를 original license text로 취급한다.
Valid-License-Identifier: GPL-2.0
Valid-License-Identifier: GPL-2.0+
SPDX-URL: https://spdx.org/licenses/GPL-2.0.html
Usage-Guide:
  To use this license in source code, put one of the following SPDX
  tag/value pairs into a comment according to the placement
  guidelines in the licensing rules documentation.
  For 'GNU General Public License (GPL) version 2 only' use:
    SPDX-License-Identifier: GPL-2.0
  For 'GNU General Public License (GPL) version 2 or any later version' use:
    SPDX-License-Identifier: GPL-2.0+
License-Text:
  Full license text
SPDX-License-Identifier: MIT
SPDX-URL: https://spdx.org/licenses/MIT.html
Usage-Guide:
  To use this license in source code, put the following SPDX
  tag/value pair into a comment according to the placement
  guidelines in the licensing rules documentation.
    SPDX-License-Identifier: MIT
License-Text:
  Full license text

위 metatag 이름과 예제의 Usage-Guide 표기는 Linux v6.18.37 원문을 그대로 보존했다.

Deprecated license

237-280

Deprecated license는 기존 code 또는 다른 project의 code를 import할 때만 사용해야 한다. Kernel source tree의 LICENSES/deprecated/ 아래에 full license text와 metatag가 있으며 filename은 source file에서 사용할 SPDX identifier와 같다.

  • LICENSES/deprecated/ISC: Internet Systems Consortium license text와 필수 metatag
  • LICENSES/deprecated/GPL-1.0: GPL version 1 license text와 필수 metatag

Metatag 요구 사항은 preferred license와 동일하다. ISC 예제는 새 kernel code에 이 license를 사용하는 것을 권장하지 않으며 이미 존재하는 project에서 code를 가져올 때만 사용하라고 명시한다.

Valid-License-Identifier: ISC
SPDX-URL: https://spdx.org/licenses/ISC.html
Usage-Guide:
  Usage of this license in the kernel for new code is discouraged
  and it should solely be used for importing code from an already
  existing project.
  To use this license in source code, put the following SPDX
  tag/value pair into a comment according to the placement
  guidelines in the licensing rules documentation.
    SPDX-License-Identifier: ISC
License-Text:
  Full license text

Dual Licensing Only category

284-329

이 category의 license는 preferred license와 함께 code를 dual license할 때만 사용해야 한다. File은 LICENSES/dual/ 아래에 있고 full license text와 metatag를 포함하며 filename은 source에서 사용할 SPDX identifier와 같다.

  • LICENSES/dual/MPL-1.1: Mozilla Public License version 1.1 text와 필수 metatag
  • LICENSES/dual/Apache-2.0: Apache License version 2.0 text와 필수 metatag

Metatag 요구 사항은 preferred license와 동일하다. MPL-1.1은 GPL2 compatible하지 않으므로 단독으로 사용해서는 안 된다. 다른 license가 GPL2 compatible한 dual-licensed file에서만 사용할 수 있으며 반드시 OR로 결합해야 한다.

Valid-License-Identifier: MPL-1.1
SPDX-URL: https://spdx.org/licenses/MPL-1.1.html
Usage-Guide:
  Do NOT use. The MPL-1.1 is not GPL2 compatible. It may only be used for
  dual-licensed files where the other license is GPL2 compatible.
  If you end up using this it MUST be used together with a GPL2 compatible
  license using "OR".
  To use the Mozilla Public License version 1.1 put the following SPDX
  tag/value pair into a comment according to the placement guidelines in
  the licensing rules documentation:
SPDX-License-Identifier: MPL-1.1
License-Text:
  Full license text

License exception과 exception metatag

333-423

일부 license는 original license가 주지 않는 특정 권리를 부여하는 exception으로 수정할 수 있다. Exception file은 LICENSES/exceptions/ 아래에 있으며 full exception text와 필수 exception metatag를 포함한다.

  • LICENSES/exceptions/Linux-syscall-note: Linux kernel COPYING에 설명된 syscall exception이며 UAPI header에 사용한다. 예: /* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */
  • LICENSES/exceptions/GCC-exception-2.0: GCC linking exception. 표시된 file의 compiled version과 binary license에 관계없이 link할 수 있게 하며 GPL과 호환되지 않는 source로 runnable executable을 만드는 데 필요하다.
Exception metatag의미
SPDX-Exception-IdentifierSPDX license identifier와 결합할 수 있는 exception identifier 하나
SPDX-URL해당 exception 추가 정보를 담은 SPDX page URL
SPDX-Licenses이 exception을 사용할 수 있는 SPDX license identifier의 comma-separated list
Usage-Guidance사용 지침과 License identifier syntax에 맞는 정확한 source-file 예제
Exception-Text이 tag 뒤의 모든 text를 original exception text로 취급
SPDX-Exception-Identifier: Linux-syscall-note
SPDX-URL: https://spdx.org/licenses/Linux-syscall-note.html
SPDX-Licenses: GPL-2.0, GPL-2.0+, GPL-1.0+, LGPL-2.0, LGPL-2.0+, LGPL-2.1, LGPL-2.1+
Usage-Guidance:
  This exception is used together with one of the above SPDX-Licenses
  to mark user-space API (uapi) header files so they can be included
  into non GPL compliant user-space application code.
  To use this exception add it with the keyword WITH to one of the
  identifiers in the SPDX-Licenses tag:
    SPDX-License-Identifier: <SPDX-License> WITH Linux-syscall-note
Exception-Text:
  Full exception text
SPDX-Exception-Identifier: GCC-exception-2.0
SPDX-URL: https://spdx.org/licenses/GCC-exception-2.0.html
SPDX-Licenses: GPL-2.0, GPL-2.0+
Usage-Guidance:
  The "GCC Runtime Library exception 2.0" is used together with one
  of the above SPDX-Licenses for code imported from the GCC runtime
  library.
  To use this exception add it with the keyword WITH to one of the
  identifiers in the SPDX-Licenses tag:
    SPDX-License-Identifier: <SPDX-License> WITH GCC-exception-2.0
Exception-Text:
  Full exception text

모든 SPDX license identifier와 exception에는 LICENSES 하위 directory에 대응하는 file이 있어야 한다. 그래야 checkpatch.pl 같은 도구가 검증할 수 있고, 여러 FOSS organization이 권장하는 대로 source에서 license를 바로 읽고 추출할 수 있다.

MODULE_LICENSE()의 제한된 역할

425-484

Loadable kernel module에는 MODULE_LICENSE() tag도 필요하다. 이 tag는 정확한 source code license 정보인 SPDX-License-Identifier를 대체하지 않으며 module source가 제공되는 정확한 license를 표현하거나 판정하는 수단도 아니다.

MODULE_LICENSE()의 유일한 목적은 kernel module loader와 user-space tool이 module이 free software인지 proprietary인지 판단하는 데 필요한 최소 정보를 제공하는 것이다.

MODULE_LICENSE string의미
"GPL"GPL version 2 module. GPL-2.0-only와 GPL-2.0-or-later를 구분하지 않으며 정확한 license는 source file의 license 정보로만 판정한다.
"GPL v2""GPL"과 같고 역사적인 이유로 존재한다.
"GPL and additional rights"GPL v2 variant와 MIT dual license를 나타내던 역사적 표현. 새 code에서는 사용하지 않는다.
"Dual MIT/GPL"GPL v2 variant 또는 MIT 중 선택 가능한 dual license의 올바른 표현
"Dual BSD/GPL"GPL v2 variant 또는 BSD 중 선택. 정확한 BSD variant는 source file의 license 정보로 판정한다.
"Dual MPL/GPL"GPL v2 variant 또는 MPL 중 선택. 정확한 MPL variant는 source file의 license 정보로 판정한다.
"Proprietary"GPLv2 compatible하지 않은 third-party module. Kernel tree 안의 source module에는 사용할 수 없다.

"Proprietary"는 오직 license가 GPLv2와 compatible하지 않다는 의미로 이해해야 한다. 이 tag의 module을 load하면 kernel에 P taint flag가 설정되고 module loader는 EXPORT_SYMBOL_GPL()로 export된 symbol에 해당 module을 link하는 것을 거부한다.