License cleanup: add SPDX GPL-2.0 license identifier to files with no license
Many source files in the tree are missing licensing information, which
makes it harder for compliance tools to determine the correct license.
By default all files without license information are under the default
license of the kernel, which is GPL version 2.
Update the files which contain no license information with the 'GPL-2.0'
SPDX license identifier. The SPDX identifier is a legally binding
shorthand, which can be used instead of the full boiler plate text.
This patch is based on work done by Thomas Gleixner and Kate Stewart and
Philippe Ombredanne.
How this work was done:
Patches were generated and checked against linux-4.14-rc6 for a subset of
the use cases:
- file had no licensing information it it.
- file was a */uapi/* one with no licensing information in it,
- file was a */uapi/* one with existing licensing information,
Further patches will be generated in subsequent months to fix up cases
where non-standard license headers were used, and references to license
had to be inferred by heuristics based on keywords.
The analysis to determine which SPDX License Identifier to be applied to
a file was done in a spreadsheet of side by side results from of the
output of two independent scanners (ScanCode & Windriver) producing SPDX
tag:value files created by Philippe Ombredanne. Philippe prepared the
base worksheet, and did an initial spot review of a few 1000 files.
The 4.13 kernel was the starting point of the analysis with 60,537 files
assessed. Kate Stewart did a file by file comparison of the scanner
results in the spreadsheet to determine which SPDX license identifier(s)
to be applied to the file. She confirmed any determination that was not
immediately clear with lawyers working with the Linux Foundation.
Criteria used to select files for SPDX license identifier tagging was:
- Files considered eligible had to be source code files.
- Make and config files were included as candidates if they contained >5
lines of source
- File already had some variant of a license header in it (even if <5
lines).
All documentation files were explicitly excluded.
The following heuristics were used to determine which SPDX license
identifiers to apply.
- when both scanners couldn't find any license traces, file was
considered to have no license information in it, and the top level
COPYING file license applied.
For non */uapi/* files that summary was:
SPDX license identifier # files
---------------------------------------------------|-------
GPL-2.0 11139
and resulted in the first patch in this series.
If that file was a */uapi/* path one, it was "GPL-2.0 WITH
Linux-syscall-note" otherwise it was "GPL-2.0". Results of that was:
SPDX license identifier # files
---------------------------------------------------|-------
GPL-2.0 WITH Linux-syscall-note 930
and resulted in the second patch in this series.
- if a file had some form of licensing information in it, and was one
of the */uapi/* ones, it was denoted with the Linux-syscall-note if
any GPL family license was found in the file or had no licensing in
it (per prior point). Results summary:
SPDX license identifier # files
---------------------------------------------------|------
GPL-2.0 WITH Linux-syscall-note 270
GPL-2.0+ WITH Linux-syscall-note 169
((GPL-2.0 WITH Linux-syscall-note) OR BSD-2-Clause) 21
((GPL-2.0 WITH Linux-syscall-note) OR BSD-3-Clause) 17
LGPL-2.1+ WITH Linux-syscall-note 15
GPL-1.0+ WITH Linux-syscall-note 14
((GPL-2.0+ WITH Linux-syscall-note) OR BSD-3-Clause) 5
LGPL-2.0+ WITH Linux-syscall-note 4
LGPL-2.1 WITH Linux-syscall-note 3
((GPL-2.0 WITH Linux-syscall-note) OR MIT) 3
((GPL-2.0 WITH Linux-syscall-note) AND MIT) 1
and that resulted in the third patch in this series.
- when the two scanners agreed on the detected license(s), that became
the concluded license(s).
- when there was disagreement between the two scanners (one detected a
license but the other didn't, or they both detected different
licenses) a manual inspection of the file occurred.
- In most cases a manual inspection of the information in the file
resulted in a clear resolution of the license that should apply (and
which scanner probably needed to revisit its heuristics).
- When it was not immediately clear, the license identifier was
confirmed with lawyers working with the Linux Foundation.
- If there was any question as to the appropriate license identifier,
the file was flagged for further research and to be revisited later
in time.
In total, over 70 hours of logged manual review was done on the
spreadsheet to determine the SPDX license identifiers to apply to the
source files by Kate, Philippe, Thomas and, in some cases, confirmation
by lawyers working with the Linux Foundation.
Kate also obtained a third independent scan of the 4.13 code base from
FOSSology, and compared selected files where the other two scanners
disagreed against that SPDX file, to see if there was new insights. The
Windriver scanner is based on an older version of FOSSology in part, so
they are related.
Thomas did random spot checks in about 500 files from the spreadsheets
for the uapi headers and agreed with SPDX license identifier in the
files he inspected. For the non-uapi files Thomas did random spot checks
in about 15000 files.
In initial set of patches against 4.14-rc6, 3 files were found to have
copy/paste license identifier errors, and have been fixed to reflect the
correct identifier.
Additionally Philippe spent 10 hours this week doing a detailed manual
inspection and review of the 12,461 patched files from the initial patch
version early this week with:
- a full scancode scan run, collecting the matched texts, detected
license ids and scores
- reviewing anything where there was a license detected (about 500+
files) to ensure that the applied SPDX license was correct
- reviewing anything where there was no detection but the patch license
was not GPL-2.0 WITH Linux-syscall-note to ensure that the applied
SPDX license was correct
This produced a worksheet with 20 files needing minor correction. This
worksheet was then exported into 3 different .csv files for the
different types of files to be modified.
These .csv files were then reviewed by Greg. Thomas wrote a script to
parse the csv files and add the proper SPDX tag to the file, in the
format that the file expected. This script was further refined by Greg
based on the output to detect more types of files automatically and to
distinguish between header and source .c files (which need different
comment types.) Finally Greg ran the script using the .csv files to
generate the patches.
Reviewed-by: Kate Stewart <kstewart@linuxfoundation.org>
Reviewed-by: Philippe Ombredanne <pombredanne@nexb.com>
Reviewed-by: Thomas Gleixner <tglx@linutronix.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-11-01 15:07:57 +01:00
|
|
|
|
2005-11-10 02:25:56 +01:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2007-07-18 15:47:52 -07:00
|
|
|
|
2005-11-10 02:25:56 +01:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
include cleanup: Update gfp.h and slab.h includes to prepare for breaking implicit slab.h inclusion from percpu.h
percpu.h is included by sched.h and module.h and thus ends up being
included when building most .c files. percpu.h includes slab.h which
in turn includes gfp.h making everything defined by the two files
universally available and complicating inclusion dependencies.
percpu.h -> slab.h dependency is about to be removed. Prepare for
this change by updating users of gfp and slab facilities include those
headers directly instead of assuming availability. As this conversion
needs to touch large number of source files, the following script is
used as the basis of conversion.
http://userweb.kernel.org/~tj/misc/slabh-sweep.py
The script does the followings.
* Scan files for gfp and slab usages and update includes such that
only the necessary includes are there. ie. if only gfp is used,
gfp.h, if slab is used, slab.h.
* When the script inserts a new include, it looks at the include
blocks and try to put the new include such that its order conforms
to its surrounding. It's put in the include block which contains
core kernel includes, in the same order that the rest are ordered -
alphabetical, Christmas tree, rev-Xmas-tree or at the end if there
doesn't seem to be any matching order.
* If the script can't find a place to put a new include (mostly
because the file doesn't have fitting include block), it prints out
an error message indicating which .h file needs to be added to the
file.
The conversion was done in the following steps.
1. The initial automatic conversion of all .c files updated slightly
over 4000 files, deleting around 700 includes and adding ~480 gfp.h
and ~3000 slab.h inclusions. The script emitted errors for ~400
files.
2. Each error was manually checked. Some didn't need the inclusion,
some needed manual addition while adding it to implementation .h or
embedding .c file was more appropriate for others. This step added
inclusions to around 150 files.
3. The script was run again and the output was compared to the edits
from #2 to make sure no file was left behind.
4. Several build tests were done and a couple of problems were fixed.
e.g. lib/decompress_*.c used malloc/free() wrappers around slab
APIs requiring slab.h to be added manually.
5. The script was run on all .h files but without automatically
editing them as sprinkling gfp.h and slab.h inclusions around .h
files could easily lead to inclusion dependency hell. Most gfp.h
inclusion directives were ignored as stuff from gfp.h was usually
wildly available and often used in preprocessor macros. Each
slab.h inclusion directive was examined and added manually as
necessary.
6. percpu.h was updated not to include slab.h.
7. Build test were done on the following configurations and failures
were fixed. CONFIG_GCOV_KERNEL was turned off for all tests (as my
distributed build env didn't work with gcov compiles) and a few
more options had to be turned off depending on archs to make things
build (like ipr on powerpc/64 which failed due to missing writeq).
* x86 and x86_64 UP and SMP allmodconfig and a custom test config.
* powerpc and powerpc64 SMP allmodconfig
* sparc and sparc64 SMP allmodconfig
* ia64 SMP allmodconfig
* s390 SMP allmodconfig
* alpha SMP allmodconfig
* um on x86_64 SMP allmodconfig
8. percpu.h modifications were reverted so that it could be applied as
a separate patch and serve as bisection point.
Given the fact that I had only a couple of failures from tests on step
6, I'm fairly confident about the coverage of this conversion patch.
If there is a breakage, it's likely to be something in one of the arch
headers which should be easily discoverable easily on most builds of
the specific arch.
Signed-off-by: Tejun Heo <tj@kernel.org>
Guess-its-ok-by: Christoph Lameter <cl@linux-foundation.org>
Cc: Ingo Molnar <mingo@redhat.com>
Cc: Lee Schermerhorn <Lee.Schermerhorn@hp.com>
2010-03-24 17:04:11 +09:00
|
|
|
|
2005-11-10 02:25:56 +01:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2023-02-08 15:31:52 +02:00
|
|
|
|
2005-11-10 02:25:56 +01:00
|
|
|
|
2006-03-26 01:37:14 -08:00
|
|
|
|
2007-07-18 15:47:52 -07:00
|
|
|
|
2013-04-23 07:48:30 +00:00
|
|
|
|
2016-10-24 14:40:04 +02:00
|
|
|
|
2005-11-10 02:25:56 +01:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2024-03-29 10:57:08 -07:00
|
|
|
|
|
|
|
|
|
2006-03-26 01:37:14 -08:00
|
|
|
|
2013-04-23 07:48:30 +00:00
|
|
|
|
2005-11-10 02:25:56 +01:00
|
|
|
|
2015-01-16 11:37:14 +01:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2010-04-02 06:19:05 +00:00
|
|
|
|
2005-11-10 02:25:56 +01:00
|
|
|
|
2006-03-26 01:37:14 -08:00
|
|
|
|
2005-11-10 02:25:56 +01:00
|
|
|
|
2010-04-02 06:19:05 +00:00
|
|
|
|
2005-11-10 02:25:56 +01:00
|
|
|
|
2010-04-02 06:19:05 +00:00
|
|
|
|
2005-11-10 02:25:56 +01:00
|
|
|
|
2006-03-26 01:37:14 -08:00
|
|
|
|
2005-11-10 02:25:56 +01:00
|
|
|
|
2010-04-02 06:19:05 +00:00
|
|
|
|
2005-11-10 02:25:56 +01:00
|
|
|
|
2013-04-23 07:48:30 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2023-08-14 14:47:14 -07:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2016-10-24 14:40:04 +02:00
|
|
|
|
2005-11-10 02:25:56 +01:00
|
|
|
|
2007-07-18 15:47:52 -07:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2013-11-19 15:19:32 +01:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2013-11-19 15:19:39 +01:00
|
|
|
|
|
|
|
|
|
2013-11-19 15:19:33 +01:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2013-11-24 21:09:26 +01:00
|
|
|
|
|
|
|
|
|
2007-07-18 15:47:52 -07:00
|
|
|
|
2013-11-19 15:19:39 +01:00
|
|
|
|
2013-11-24 21:09:26 +01:00
|
|
|
|
|
|
|
|
|
2007-07-18 15:47:52 -07:00
|
|
|
|
|
|
|
|
|
2005-11-10 02:25:56 +01:00
|
|
|
|
2022-10-21 12:35:32 -07:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2016-10-24 14:40:04 +02:00
|
|
|
|
2013-11-19 15:19:39 +01:00
|
|
|
|
|
|
|
|
|
2005-11-10 02:25:56 +01:00
|
|
|
|
2022-10-21 12:35:32 -07:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2022-11-04 12:13:42 -07:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2016-10-24 14:40:04 +02:00
|
|
|
|
2005-11-10 02:25:56 +01:00
|
|
|
|
2016-10-24 14:40:04 +02:00
|
|
|
|
2005-11-10 02:25:56 +01:00
|
|
|
|
|
|
|
|
|
2016-10-24 14:40:04 +02:00
|
|
|
|
2005-11-10 02:25:56 +01:00
|
|
|
|
2016-10-24 14:40:04 +02:00
|
|
|
|
|
|
|
|
|
2005-11-10 02:25:56 +01:00
|
|
|
|
2016-10-24 14:40:04 +02:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2005-11-10 02:25:56 +01:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2022-11-04 12:13:42 -07:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2020-10-02 14:49:53 -07:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2020-10-02 14:49:57 -07:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2022-10-21 12:35:32 -07:00
|
|
|
|
|
|
|
|
|
2020-10-02 14:49:53 -07:00
|
|
|
|
|
|
|
|
|
2020-10-03 10:44:46 +02:00
|
|
|
|
2020-10-02 14:49:53 -07:00
|
|
|
|
2005-11-10 02:25:56 +01:00
|
|
|
|
2013-11-14 17:14:44 +01:00
|
|
|
|
2005-11-10 02:25:56 +01:00
|
|
|
|
2013-11-14 17:14:44 +01:00
|
|
|
|
2020-10-02 14:49:53 -07:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2005-11-10 02:25:56 +01:00
|
|
|
|
2020-10-02 14:49:53 -07:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2020-10-02 14:49:57 -07:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2022-10-21 12:35:32 -07:00
|
|
|
|
|
|
|
|
|
2020-10-02 14:49:53 -07:00
|
|
|
|
|
|
|
|
|
2020-10-03 10:44:46 +02:00
|
|
|
|
2020-10-02 14:49:53 -07:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2022-11-04 12:13:42 -07:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2023-10-21 13:27:02 +02:00
|
|
|
|
|
|
|
|
|
2022-11-04 12:13:42 -07:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2026-03-10 20:28:37 -07:00
|
|
|
|
2022-11-04 12:13:42 -07:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2022-11-04 12:13:35 -07:00
|
|
|
|
2022-11-04 12:13:33 -07:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2022-11-04 12:13:35 -07:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2022-11-04 12:13:33 -07:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2022-11-04 12:13:34 -07:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2022-11-04 12:13:33 -07:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2022-11-04 12:13:35 -07:00
|
|
|
|
|
|
|
|
|
2022-11-04 12:13:33 -07:00
|
|
|
|
|
|
|
|
|
2022-11-09 10:32:54 -08:00
|
|
|
|
2022-11-04 12:13:33 -07:00
|
|
|
|
2022-11-04 12:13:38 -07:00
|
|
|
|
|
|
|
|
|
2022-11-04 12:13:33 -07:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2022-11-04 12:13:38 -07:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2022-11-04 12:13:42 -07:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2022-11-04 12:13:33 -07:00
|
|
|
|
2022-11-04 12:13:42 -07:00
|
|
|
|
2022-11-04 12:13:33 -07:00
|
|
|
|
|
|
|
|
|
2022-11-09 10:32:54 -08:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2022-11-04 12:13:39 -07:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2022-11-04 12:13:42 -07:00
|
|
|
|
|
|
|
|
|
2022-11-04 12:13:39 -07:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2022-11-04 12:13:42 -07:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2022-11-04 12:13:39 -07:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2022-11-04 12:13:41 -07:00
|
|
|
|
2022-11-04 12:13:42 -07:00
|
|
|
|
2022-11-04 12:13:39 -07:00
|
|
|
|
|
|
|
|
|
2022-11-04 12:13:42 -07:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2022-11-04 12:13:39 -07:00
|
|
|
|
2022-11-04 12:13:42 -07:00
|
|
|
|
2022-11-04 12:13:39 -07:00
|
|
|
|
2022-11-04 12:13:42 -07:00
|
|
|
|
2022-11-04 12:13:39 -07:00
|
|
|
|
2022-11-04 12:13:42 -07:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2022-11-04 12:13:39 -07:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2022-11-04 12:13:42 -07:00
|
|
|
|
2022-11-04 12:13:39 -07:00
|
|
|
|
|
|
|
|
|
2013-11-19 15:19:39 +01:00
|
|
|
|
2007-07-18 15:47:52 -07:00
|
|
|
|
|
|
|
|
|
2013-11-19 15:19:39 +01:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2007-07-18 15:47:52 -07:00
|
|
|
|
2013-11-19 15:19:39 +01:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2007-07-18 15:47:52 -07:00
|
|
|
|
2013-11-19 15:19:39 +01:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2016-01-13 10:28:06 -05:00
|
|
|
|
2013-11-19 15:19:39 +01:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2013-11-23 13:01:50 +01:00
|
|
|
|
2013-11-19 15:19:39 +01:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2023-02-08 15:31:52 +02:00
|
|
|
|
2013-11-19 15:19:39 +01:00
|
|
|
|
|
|
|
|
|
2007-07-18 15:47:52 -07:00
|
|
|
|
2013-11-19 15:19:32 +01:00
|
|
|
|
2013-11-19 15:19:39 +01:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2013-11-24 21:09:26 +01:00
|
|
|
|
2013-11-19 15:19:39 +01:00
|
|
|
|
|
|
|
|
|
2013-11-24 21:09:26 +01:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2013-11-19 15:19:39 +01:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2007-07-18 15:47:52 -07:00
|
|
|
|
|
|
|
|
|
2013-11-19 15:19:39 +01:00
|
|
|
|
|
|
|
|
|
2020-08-22 16:40:15 -07:00
|
|
|
|
2013-11-19 15:19:39 +01:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2009-07-10 09:51:34 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2009-09-12 03:03:15 +00:00
|
|
|
|
2009-07-10 09:51:34 +00:00
|
|
|
|
|
|
|
|
|
2009-09-12 03:03:15 +00:00
|
|
|
|
2009-07-10 09:51:34 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2013-11-19 15:19:39 +01:00
|
|
|
|
2009-07-10 09:51:34 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2009-09-12 03:03:15 +00:00
|
|
|
|
2009-07-10 09:51:34 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2007-07-18 15:47:52 -07:00
|
|
|
|
2013-11-19 15:19:39 +01:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2007-07-18 15:47:52 -07:00
|
|
|
|
2007-07-24 15:34:53 -07:00
|
|
|
|
2007-07-18 15:47:52 -07:00
|
|
|
|
2007-07-24 15:32:46 -07:00
|
|
|
|
2016-10-24 14:40:04 +02:00
|
|
|
|
2007-07-18 15:47:52 -07:00
|
|
|
|
2013-11-19 15:19:39 +01:00
|
|
|
|
|
|
|
|
|
2007-07-18 15:47:52 -07:00
|
|
|
|
2013-11-19 15:19:39 +01:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2007-07-18 15:47:52 -07:00
|
|
|
|
|
|
|
|
|
2022-11-04 12:13:42 -07:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2014-06-02 01:18:01 -07:00
|
|
|
|
2005-11-10 02:25:56 +01:00
|
|
|
|
2022-11-04 12:13:39 -07:00
|
|
|
|
2022-11-04 12:13:42 -07:00
|
|
|
|
2005-11-10 02:25:56 +01:00
|
|
|
|
2020-10-02 14:49:53 -07:00
|
|
|
|
2022-11-04 12:13:42 -07:00
|
|
|
|
|
|
|
|
|
2013-11-15 14:19:08 +01:00
|
|
|
|
|
|
|
|
|
2022-11-04 12:13:39 -07:00
|
|
|
|
|
|
|
|
|
2013-11-14 17:14:44 +01:00
|
|
|
|
2020-10-02 14:49:53 -07:00
|
|
|
|
2022-11-04 12:13:39 -07:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2013-11-14 17:14:44 +01:00
|
|
|
|
2020-10-02 14:49:53 -07:00
|
|
|
|
2005-11-10 02:25:56 +01:00
|
|
|
|
|
|
|
|
|
2022-11-04 12:13:42 -07:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2023-07-20 13:13:54 +02:00
|
|
|
|
2022-11-04 12:13:42 -07:00
|
|
|
|
2023-07-20 13:13:54 +02:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2022-11-04 12:13:42 -07:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2013-11-14 17:14:44 +01:00
|
|
|
|
2005-11-10 02:25:56 +01:00
|
|
|
|
|
|
|
|
|
2023-12-16 13:29:57 +01:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2026-02-21 16:37:42 -08:00
|
|
|
|
2023-12-16 13:29:57 +01:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2005-11-10 02:25:56 +01:00
|
|
|
|
2016-10-24 14:40:03 +02:00
|
|
|
|
2005-11-10 02:25:56 +01:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2016-10-24 14:40:03 +02:00
|
|
|
|
|
|
|
|
|
2013-11-15 14:19:08 +01:00
|
|
|
|
2005-11-10 02:25:56 +01:00
|
|
|
|
|
|
|
|
|
2016-10-24 14:40:03 +02:00
|
|
|
|
2005-11-10 02:25:56 +01:00
|
|
|
|
2016-10-24 14:40:02 +02:00
|
|
|
|
2016-10-24 14:40:04 +02:00
|
|
|
|
2005-11-10 02:25:56 +01:00
|
|
|
|
2013-11-15 14:19:08 +01:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2013-04-23 07:48:30 +00:00
|
|
|
|
2005-11-10 02:25:56 +01:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2023-12-16 13:29:57 +01:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2016-10-24 14:40:04 +02:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2016-10-24 14:40:02 +02:00
|
|
|
|
2016-10-24 14:40:04 +02:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2005-11-10 02:25:56 +01:00
|
|
|
|
|
|
|
|
|
2019-04-24 22:18:53 +02:00
|
|
|
|
|
|
|
|
|
2016-11-01 14:45:52 +00:00
|
|
|
|
|
|
|
|
|
2023-12-16 13:29:57 +01:00
|
|
|
|
2016-11-01 14:45:52 +00:00
|
|
|
|
2013-11-19 15:19:39 +01:00
|
|
|
|
2016-10-24 14:40:04 +02:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2013-04-23 07:48:30 +00:00
|
|
|
|
2005-11-10 02:25:56 +01:00
|
|
|
|
2013-11-19 15:19:39 +01:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2005-11-10 02:25:56 +01:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2016-10-24 14:40:04 +02:00
|
|
|
|
|
|
|
|
|
2023-12-16 13:29:57 +01:00
|
|
|
|
|
|
|
|
|
2005-11-10 02:25:56 +01:00
|
|
|
|
2013-04-23 07:48:30 +00:00
|
|
|
|
2005-11-10 02:25:56 +01:00
|
|
|
|
|
|
|
|
|
2016-10-24 14:40:03 +02:00
|
|
|
|
2005-11-10 02:25:56 +01:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2016-10-24 14:40:04 +02:00
|
|
|
|
2005-11-10 02:25:56 +01:00
|
|
|
|
2013-04-23 07:48:30 +00:00
|
|
|
|
2005-11-10 02:25:56 +01:00
|
|
|
|
2016-10-28 16:01:41 -07:00
|
|
|
|
2016-10-24 14:40:04 +02:00
|
|
|
|
|
|
|
|
|
2005-11-10 02:25:56 +01:00
|
|
|
|
|
|
|
|
|
2016-10-24 14:40:04 +02:00
|
|
|
|
2005-11-10 02:25:56 +01:00
|
|
|
|
2016-10-24 14:40:04 +02:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2023-12-16 13:29:57 +01:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2016-10-24 14:40:04 +02:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2005-11-10 02:25:56 +01:00
|
|
|
|
2010-07-25 20:46:01 +00:00
|
|
|
|
2005-11-10 02:25:56 +01:00
|
|
|
|
2012-01-30 15:22:06 -05:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2012-09-07 20:12:54 +00:00
|
|
|
|
2012-01-30 15:22:06 -05:00
|
|
|
|
|
|
|
|
|
2012-07-10 10:55:09 +00:00
|
|
|
|
2012-01-30 15:22:06 -05:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2012-09-07 20:12:54 +00:00
|
|
|
|
2016-10-24 14:40:04 +02:00
|
|
|
|
2012-01-30 15:22:06 -05:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2012-09-07 20:12:54 +00:00
|
|
|
|
2012-01-30 15:22:06 -05:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2019-10-05 20:04:34 +02:00
|
|
|
|
|
|
|
|
|
2026-02-21 16:37:42 -08:00
|
|
|
|
2019-10-05 20:04:34 +02:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2019-10-05 20:04:35 +02:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2022-11-04 12:13:33 -07:00
|
|
|
|
2019-10-05 20:04:35 +02:00
|
|
|
|
2020-06-12 00:16:55 -07:00
|
|
|
|
2019-10-05 20:04:35 +02:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2026-03-10 20:28:36 -07:00
|
|
|
|
2019-10-11 09:40:09 +02:00
|
|
|
|
|
|
|
|
|
2026-03-10 20:28:36 -07:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2019-10-05 20:04:35 +02:00
|
|
|
|
2020-10-02 14:49:57 -07:00
|
|
|
|
|
|
|
|
|
2020-02-21 19:42:13 +01:00
|
|
|
|
2020-06-27 00:12:24 -07:00
|
|
|
|
2019-10-05 20:04:35 +02:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2020-06-27 00:12:24 -07:00
|
|
|
|
2019-10-05 20:04:35 +02:00
|
|
|
|
2020-06-27 00:12:24 -07:00
|
|
|
|
2019-10-05 20:04:35 +02:00
|
|
|
|
|
|
|
|
|
genetlink: fix memory leaks in genl_family_rcv_msg_dumpit()
There are two kinds of memory leaks in genl_family_rcv_msg_dumpit():
1. Before we call ops->start(), whenever an error happens, we forget
to free the memory allocated in genl_family_rcv_msg_dumpit().
2. When ops->start() fails, the 'info' has been already installed on
the per socket control block, so we should not free it here. More
importantly, nlk->cb_running is still false at this point, so
netlink_sock_destruct() cannot free it either.
The first kind of memory leaks is easier to resolve, but the second
one requires some deeper thoughts.
After reviewing how netfilter handles this, the most elegant solution
I find is just to use a similar way to allocate the memory, that is,
moving memory allocations from caller into ops->start(). With this,
we can solve both kinds of memory leaks: for 1), no memory allocation
happens before ops->start(); for 2), ops->start() handles its own
failures and 'info' is installed to the socket control block only
when success. The only ugliness here is we have to pass all local
variables on stack via a struct, but this is not hard to understand.
Alternatively, we can introduce a ops->free() to solve this too,
but it is overkill as only genetlink has this problem so far.
Fixes: 1927f41a22a0 ("net: genetlink: introduce dump info struct to be available during dumpit op")
Reported-by: syzbot+21f04f481f449c8db840@syzkaller.appspotmail.com
Cc: "Jason A. Donenfeld" <Jason@zx2c4.com>
Cc: Florian Westphal <fw@strlen.de>
Cc: Pablo Neira Ayuso <pablo@netfilter.org>
Cc: Jiri Pirko <jiri@mellanox.com>
Cc: YueHaibing <yuehaibing@huawei.com>
Cc: Shaochun Chen <cscnull@gmail.com>
Signed-off-by: Cong Wang <xiyou.wangcong@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
2020-06-02 21:49:10 -07:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2022-11-04 12:13:33 -07:00
|
|
|
|
genetlink: fix memory leaks in genl_family_rcv_msg_dumpit()
There are two kinds of memory leaks in genl_family_rcv_msg_dumpit():
1. Before we call ops->start(), whenever an error happens, we forget
to free the memory allocated in genl_family_rcv_msg_dumpit().
2. When ops->start() fails, the 'info' has been already installed on
the per socket control block, so we should not free it here. More
importantly, nlk->cb_running is still false at this point, so
netlink_sock_destruct() cannot free it either.
The first kind of memory leaks is easier to resolve, but the second
one requires some deeper thoughts.
After reviewing how netfilter handles this, the most elegant solution
I find is just to use a similar way to allocate the memory, that is,
moving memory allocations from caller into ops->start(). With this,
we can solve both kinds of memory leaks: for 1), no memory allocation
happens before ops->start(); for 2), ops->start() handles its own
failures and 'info' is installed to the socket control block only
when success. The only ugliness here is we have to pass all local
variables on stack via a struct, but this is not hard to understand.
Alternatively, we can introduce a ops->free() to solve this too,
but it is overkill as only genetlink has this problem so far.
Fixes: 1927f41a22a0 ("net: genetlink: introduce dump info struct to be available during dumpit op")
Reported-by: syzbot+21f04f481f449c8db840@syzkaller.appspotmail.com
Cc: "Jason A. Donenfeld" <Jason@zx2c4.com>
Cc: Florian Westphal <fw@strlen.de>
Cc: Pablo Neira Ayuso <pablo@netfilter.org>
Cc: Jiri Pirko <jiri@mellanox.com>
Cc: YueHaibing <yuehaibing@huawei.com>
Cc: Shaochun Chen <cscnull@gmail.com>
Signed-off-by: Cong Wang <xiyou.wangcong@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
2020-06-02 21:49:10 -07:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2015-12-15 15:41:37 -08:00
|
|
|
|
genetlink: fix memory leaks in genl_family_rcv_msg_dumpit()
There are two kinds of memory leaks in genl_family_rcv_msg_dumpit():
1. Before we call ops->start(), whenever an error happens, we forget
to free the memory allocated in genl_family_rcv_msg_dumpit().
2. When ops->start() fails, the 'info' has been already installed on
the per socket control block, so we should not free it here. More
importantly, nlk->cb_running is still false at this point, so
netlink_sock_destruct() cannot free it either.
The first kind of memory leaks is easier to resolve, but the second
one requires some deeper thoughts.
After reviewing how netfilter handles this, the most elegant solution
I find is just to use a similar way to allocate the memory, that is,
moving memory allocations from caller into ops->start(). With this,
we can solve both kinds of memory leaks: for 1), no memory allocation
happens before ops->start(); for 2), ops->start() handles its own
failures and 'info' is installed to the socket control block only
when success. The only ugliness here is we have to pass all local
variables on stack via a struct, but this is not hard to understand.
Alternatively, we can introduce a ops->free() to solve this too,
but it is overkill as only genetlink has this problem so far.
Fixes: 1927f41a22a0 ("net: genetlink: introduce dump info struct to be available during dumpit op")
Reported-by: syzbot+21f04f481f449c8db840@syzkaller.appspotmail.com
Cc: "Jason A. Donenfeld" <Jason@zx2c4.com>
Cc: Florian Westphal <fw@strlen.de>
Cc: Pablo Neira Ayuso <pablo@netfilter.org>
Cc: Jiri Pirko <jiri@mellanox.com>
Cc: YueHaibing <yuehaibing@huawei.com>
Cc: Shaochun Chen <cscnull@gmail.com>
Signed-off-by: Cong Wang <xiyou.wangcong@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
2020-06-02 21:49:10 -07:00
|
|
|
|
2022-11-04 12:13:33 -07:00
|
|
|
|
genetlink: fix memory leaks in genl_family_rcv_msg_dumpit()
There are two kinds of memory leaks in genl_family_rcv_msg_dumpit():
1. Before we call ops->start(), whenever an error happens, we forget
to free the memory allocated in genl_family_rcv_msg_dumpit().
2. When ops->start() fails, the 'info' has been already installed on
the per socket control block, so we should not free it here. More
importantly, nlk->cb_running is still false at this point, so
netlink_sock_destruct() cannot free it either.
The first kind of memory leaks is easier to resolve, but the second
one requires some deeper thoughts.
After reviewing how netfilter handles this, the most elegant solution
I find is just to use a similar way to allocate the memory, that is,
moving memory allocations from caller into ops->start(). With this,
we can solve both kinds of memory leaks: for 1), no memory allocation
happens before ops->start(); for 2), ops->start() handles its own
failures and 'info' is installed to the socket control block only
when success. The only ugliness here is we have to pass all local
variables on stack via a struct, but this is not hard to understand.
Alternatively, we can introduce a ops->free() to solve this too,
but it is overkill as only genetlink has this problem so far.
Fixes: 1927f41a22a0 ("net: genetlink: introduce dump info struct to be available during dumpit op")
Reported-by: syzbot+21f04f481f449c8db840@syzkaller.appspotmail.com
Cc: "Jason A. Donenfeld" <Jason@zx2c4.com>
Cc: Florian Westphal <fw@strlen.de>
Cc: Pablo Neira Ayuso <pablo@netfilter.org>
Cc: Jiri Pirko <jiri@mellanox.com>
Cc: YueHaibing <yuehaibing@huawei.com>
Cc: Shaochun Chen <cscnull@gmail.com>
Signed-off-by: Cong Wang <xiyou.wangcong@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
2020-06-02 21:49:10 -07:00
|
|
|
|
|
|
|
|
|
2015-12-15 15:41:37 -08:00
|
|
|
|
|
|
|
|
|
2022-11-04 12:13:33 -07:00
|
|
|
|
2022-11-04 12:13:34 -07:00
|
|
|
|
|
|
|
|
|
genetlink: fix memory leaks in genl_family_rcv_msg_dumpit()
There are two kinds of memory leaks in genl_family_rcv_msg_dumpit():
1. Before we call ops->start(), whenever an error happens, we forget
to free the memory allocated in genl_family_rcv_msg_dumpit().
2. When ops->start() fails, the 'info' has been already installed on
the per socket control block, so we should not free it here. More
importantly, nlk->cb_running is still false at this point, so
netlink_sock_destruct() cannot free it either.
The first kind of memory leaks is easier to resolve, but the second
one requires some deeper thoughts.
After reviewing how netfilter handles this, the most elegant solution
I find is just to use a similar way to allocate the memory, that is,
moving memory allocations from caller into ops->start(). With this,
we can solve both kinds of memory leaks: for 1), no memory allocation
happens before ops->start(); for 2), ops->start() handles its own
failures and 'info' is installed to the socket control block only
when success. The only ugliness here is we have to pass all local
variables on stack via a struct, but this is not hard to understand.
Alternatively, we can introduce a ops->free() to solve this too,
but it is overkill as only genetlink has this problem so far.
Fixes: 1927f41a22a0 ("net: genetlink: introduce dump info struct to be available during dumpit op")
Reported-by: syzbot+21f04f481f449c8db840@syzkaller.appspotmail.com
Cc: "Jason A. Donenfeld" <Jason@zx2c4.com>
Cc: Florian Westphal <fw@strlen.de>
Cc: Pablo Neira Ayuso <pablo@netfilter.org>
Cc: Jiri Pirko <jiri@mellanox.com>
Cc: YueHaibing <yuehaibing@huawei.com>
Cc: Shaochun Chen <cscnull@gmail.com>
Signed-off-by: Cong Wang <xiyou.wangcong@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
2020-06-02 21:49:10 -07:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2020-06-12 00:16:55 -07:00
|
|
|
|
genetlink: fix memory leaks in genl_family_rcv_msg_dumpit()
There are two kinds of memory leaks in genl_family_rcv_msg_dumpit():
1. Before we call ops->start(), whenever an error happens, we forget
to free the memory allocated in genl_family_rcv_msg_dumpit().
2. When ops->start() fails, the 'info' has been already installed on
the per socket control block, so we should not free it here. More
importantly, nlk->cb_running is still false at this point, so
netlink_sock_destruct() cannot free it either.
The first kind of memory leaks is easier to resolve, but the second
one requires some deeper thoughts.
After reviewing how netfilter handles this, the most elegant solution
I find is just to use a similar way to allocate the memory, that is,
moving memory allocations from caller into ops->start(). With this,
we can solve both kinds of memory leaks: for 1), no memory allocation
happens before ops->start(); for 2), ops->start() handles its own
failures and 'info' is installed to the socket control block only
when success. The only ugliness here is we have to pass all local
variables on stack via a struct, but this is not hard to understand.
Alternatively, we can introduce a ops->free() to solve this too,
but it is overkill as only genetlink has this problem so far.
Fixes: 1927f41a22a0 ("net: genetlink: introduce dump info struct to be available during dumpit op")
Reported-by: syzbot+21f04f481f449c8db840@syzkaller.appspotmail.com
Cc: "Jason A. Donenfeld" <Jason@zx2c4.com>
Cc: Florian Westphal <fw@strlen.de>
Cc: Pablo Neira Ayuso <pablo@netfilter.org>
Cc: Jiri Pirko <jiri@mellanox.com>
Cc: YueHaibing <yuehaibing@huawei.com>
Cc: Shaochun Chen <cscnull@gmail.com>
Signed-off-by: Cong Wang <xiyou.wangcong@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
2020-06-02 21:49:10 -07:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2020-06-27 00:12:24 -07:00
|
|
|
|
genetlink: fix memory leaks in genl_family_rcv_msg_dumpit()
There are two kinds of memory leaks in genl_family_rcv_msg_dumpit():
1. Before we call ops->start(), whenever an error happens, we forget
to free the memory allocated in genl_family_rcv_msg_dumpit().
2. When ops->start() fails, the 'info' has been already installed on
the per socket control block, so we should not free it here. More
importantly, nlk->cb_running is still false at this point, so
netlink_sock_destruct() cannot free it either.
The first kind of memory leaks is easier to resolve, but the second
one requires some deeper thoughts.
After reviewing how netfilter handles this, the most elegant solution
I find is just to use a similar way to allocate the memory, that is,
moving memory allocations from caller into ops->start(). With this,
we can solve both kinds of memory leaks: for 1), no memory allocation
happens before ops->start(); for 2), ops->start() handles its own
failures and 'info' is installed to the socket control block only
when success. The only ugliness here is we have to pass all local
variables on stack via a struct, but this is not hard to understand.
Alternatively, we can introduce a ops->free() to solve this too,
but it is overkill as only genetlink has this problem so far.
Fixes: 1927f41a22a0 ("net: genetlink: introduce dump info struct to be available during dumpit op")
Reported-by: syzbot+21f04f481f449c8db840@syzkaller.appspotmail.com
Cc: "Jason A. Donenfeld" <Jason@zx2c4.com>
Cc: Florian Westphal <fw@strlen.de>
Cc: Pablo Neira Ayuso <pablo@netfilter.org>
Cc: Jiri Pirko <jiri@mellanox.com>
Cc: YueHaibing <yuehaibing@huawei.com>
Cc: Shaochun Chen <cscnull@gmail.com>
Signed-off-by: Cong Wang <xiyou.wangcong@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
2020-06-02 21:49:10 -07:00
|
|
|
|
|
|
|
|
|
2020-10-02 14:49:53 -07:00
|
|
|
|
2023-08-14 14:47:19 -07:00
|
|
|
|
2023-08-14 14:47:17 -07:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2024-10-09 10:09:47 +02:00
|
|
|
|
genetlink: fix memory leaks in genl_family_rcv_msg_dumpit()
There are two kinds of memory leaks in genl_family_rcv_msg_dumpit():
1. Before we call ops->start(), whenever an error happens, we forget
to free the memory allocated in genl_family_rcv_msg_dumpit().
2. When ops->start() fails, the 'info' has been already installed on
the per socket control block, so we should not free it here. More
importantly, nlk->cb_running is still false at this point, so
netlink_sock_destruct() cannot free it either.
The first kind of memory leaks is easier to resolve, but the second
one requires some deeper thoughts.
After reviewing how netfilter handles this, the most elegant solution
I find is just to use a similar way to allocate the memory, that is,
moving memory allocations from caller into ops->start(). With this,
we can solve both kinds of memory leaks: for 1), no memory allocation
happens before ops->start(); for 2), ops->start() handles its own
failures and 'info' is installed to the socket control block only
when success. The only ugliness here is we have to pass all local
variables on stack via a struct, but this is not hard to understand.
Alternatively, we can introduce a ops->free() to solve this too,
but it is overkill as only genetlink has this problem so far.
Fixes: 1927f41a22a0 ("net: genetlink: introduce dump info struct to be available during dumpit op")
Reported-by: syzbot+21f04f481f449c8db840@syzkaller.appspotmail.com
Cc: "Jason A. Donenfeld" <Jason@zx2c4.com>
Cc: Florian Westphal <fw@strlen.de>
Cc: Pablo Neira Ayuso <pablo@netfilter.org>
Cc: Jiri Pirko <jiri@mellanox.com>
Cc: YueHaibing <yuehaibing@huawei.com>
Cc: Shaochun Chen <cscnull@gmail.com>
Signed-off-by: Cong Wang <xiyou.wangcong@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
2020-06-02 21:49:10 -07:00
|
|
|
|
|
|
|
|
|
2015-12-15 15:41:37 -08:00
|
|
|
|
2023-08-14 14:47:14 -07:00
|
|
|
|
2015-12-15 15:41:37 -08:00
|
|
|
|
2023-08-14 14:47:14 -07:00
|
|
|
|
genetlink: fix memory leaks in genl_family_rcv_msg_dumpit()
There are two kinds of memory leaks in genl_family_rcv_msg_dumpit():
1. Before we call ops->start(), whenever an error happens, we forget
to free the memory allocated in genl_family_rcv_msg_dumpit().
2. When ops->start() fails, the 'info' has been already installed on
the per socket control block, so we should not free it here. More
importantly, nlk->cb_running is still false at this point, so
netlink_sock_destruct() cannot free it either.
The first kind of memory leaks is easier to resolve, but the second
one requires some deeper thoughts.
After reviewing how netfilter handles this, the most elegant solution
I find is just to use a similar way to allocate the memory, that is,
moving memory allocations from caller into ops->start(). With this,
we can solve both kinds of memory leaks: for 1), no memory allocation
happens before ops->start(); for 2), ops->start() handles its own
failures and 'info' is installed to the socket control block only
when success. The only ugliness here is we have to pass all local
variables on stack via a struct, but this is not hard to understand.
Alternatively, we can introduce a ops->free() to solve this too,
but it is overkill as only genetlink has this problem so far.
Fixes: 1927f41a22a0 ("net: genetlink: introduce dump info struct to be available during dumpit op")
Reported-by: syzbot+21f04f481f449c8db840@syzkaller.appspotmail.com
Cc: "Jason A. Donenfeld" <Jason@zx2c4.com>
Cc: Florian Westphal <fw@strlen.de>
Cc: Pablo Neira Ayuso <pablo@netfilter.org>
Cc: Jiri Pirko <jiri@mellanox.com>
Cc: YueHaibing <yuehaibing@huawei.com>
Cc: Shaochun Chen <cscnull@gmail.com>
Signed-off-by: Cong Wang <xiyou.wangcong@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
2020-06-02 21:49:10 -07:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2023-08-14 14:47:18 -07:00
|
|
|
|
genetlink: fix memory leaks in genl_family_rcv_msg_dumpit()
There are two kinds of memory leaks in genl_family_rcv_msg_dumpit():
1. Before we call ops->start(), whenever an error happens, we forget
to free the memory allocated in genl_family_rcv_msg_dumpit().
2. When ops->start() fails, the 'info' has been already installed on
the per socket control block, so we should not free it here. More
importantly, nlk->cb_running is still false at this point, so
netlink_sock_destruct() cannot free it either.
The first kind of memory leaks is easier to resolve, but the second
one requires some deeper thoughts.
After reviewing how netfilter handles this, the most elegant solution
I find is just to use a similar way to allocate the memory, that is,
moving memory allocations from caller into ops->start(). With this,
we can solve both kinds of memory leaks: for 1), no memory allocation
happens before ops->start(); for 2), ops->start() handles its own
failures and 'info' is installed to the socket control block only
when success. The only ugliness here is we have to pass all local
variables on stack via a struct, but this is not hard to understand.
Alternatively, we can introduce a ops->free() to solve this too,
but it is overkill as only genetlink has this problem so far.
Fixes: 1927f41a22a0 ("net: genetlink: introduce dump info struct to be available during dumpit op")
Reported-by: syzbot+21f04f481f449c8db840@syzkaller.appspotmail.com
Cc: "Jason A. Donenfeld" <Jason@zx2c4.com>
Cc: Florian Westphal <fw@strlen.de>
Cc: Pablo Neira Ayuso <pablo@netfilter.org>
Cc: Jiri Pirko <jiri@mellanox.com>
Cc: YueHaibing <yuehaibing@huawei.com>
Cc: Shaochun Chen <cscnull@gmail.com>
Signed-off-by: Cong Wang <xiyou.wangcong@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
2020-06-02 21:49:10 -07:00
|
|
|
|
|
|
|
|
|
2015-12-15 15:41:37 -08:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2023-08-14 14:47:14 -07:00
|
|
|
|
2013-08-23 12:44:55 -07:00
|
|
|
|
2023-08-14 14:47:19 -07:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2013-08-23 12:44:55 -07:00
|
|
|
|
|
|
|
|
|
2023-08-14 14:47:19 -07:00
|
|
|
|
2023-08-14 14:47:17 -07:00
|
|
|
|
2023-08-14 14:47:14 -07:00
|
|
|
|
2013-08-23 12:44:55 -07:00
|
|
|
|
2023-08-14 14:47:14 -07:00
|
|
|
|
2013-08-23 12:44:55 -07:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2023-08-14 14:47:14 -07:00
|
|
|
|
2013-08-23 12:44:55 -07:00
|
|
|
|
2023-08-14 14:47:19 -07:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2013-08-23 12:44:55 -07:00
|
|
|
|
|
|
|
|
|
2023-08-14 14:47:19 -07:00
|
|
|
|
2023-08-14 14:47:17 -07:00
|
|
|
|
2013-08-23 12:44:55 -07:00
|
|
|
|
2023-08-14 14:47:14 -07:00
|
|
|
|
2013-08-23 12:44:55 -07:00
|
|
|
|
2023-08-14 14:47:14 -07:00
|
|
|
|
2013-08-23 12:44:55 -07:00
|
|
|
|
2023-08-14 14:47:19 -07:00
|
|
|
|
|
|
|
|
|
2019-10-05 20:04:34 +02:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2019-10-05 20:04:33 +02:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2022-11-04 12:13:33 -07:00
|
|
|
|
2019-10-05 20:04:33 +02:00
|
|
|
|
2005-11-10 02:25:56 +01:00
|
|
|
|
genetlink: fix memory leaks in genl_family_rcv_msg_dumpit()
There are two kinds of memory leaks in genl_family_rcv_msg_dumpit():
1. Before we call ops->start(), whenever an error happens, we forget
to free the memory allocated in genl_family_rcv_msg_dumpit().
2. When ops->start() fails, the 'info' has been already installed on
the per socket control block, so we should not free it here. More
importantly, nlk->cb_running is still false at this point, so
netlink_sock_destruct() cannot free it either.
The first kind of memory leaks is easier to resolve, but the second
one requires some deeper thoughts.
After reviewing how netfilter handles this, the most elegant solution
I find is just to use a similar way to allocate the memory, that is,
moving memory allocations from caller into ops->start(). With this,
we can solve both kinds of memory leaks: for 1), no memory allocation
happens before ops->start(); for 2), ops->start() handles its own
failures and 'info' is installed to the socket control block only
when success. The only ugliness here is we have to pass all local
variables on stack via a struct, but this is not hard to understand.
Alternatively, we can introduce a ops->free() to solve this too,
but it is overkill as only genetlink has this problem so far.
Fixes: 1927f41a22a0 ("net: genetlink: introduce dump info struct to be available during dumpit op")
Reported-by: syzbot+21f04f481f449c8db840@syzkaller.appspotmail.com
Cc: "Jason A. Donenfeld" <Jason@zx2c4.com>
Cc: Florian Westphal <fw@strlen.de>
Cc: Pablo Neira Ayuso <pablo@netfilter.org>
Cc: Jiri Pirko <jiri@mellanox.com>
Cc: YueHaibing <yuehaibing@huawei.com>
Cc: Shaochun Chen <cscnull@gmail.com>
Signed-off-by: Cong Wang <xiyou.wangcong@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
2020-06-02 21:49:10 -07:00
|
|
|
|
2023-08-14 14:47:14 -07:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2019-10-05 20:04:33 +02:00
|
|
|
|
2005-11-10 02:25:56 +01:00
|
|
|
|
genetlink: fix memory leaks in genl_family_rcv_msg_dumpit()
There are two kinds of memory leaks in genl_family_rcv_msg_dumpit():
1. Before we call ops->start(), whenever an error happens, we forget
to free the memory allocated in genl_family_rcv_msg_dumpit().
2. When ops->start() fails, the 'info' has been already installed on
the per socket control block, so we should not free it here. More
importantly, nlk->cb_running is still false at this point, so
netlink_sock_destruct() cannot free it either.
The first kind of memory leaks is easier to resolve, but the second
one requires some deeper thoughts.
After reviewing how netfilter handles this, the most elegant solution
I find is just to use a similar way to allocate the memory, that is,
moving memory allocations from caller into ops->start(). With this,
we can solve both kinds of memory leaks: for 1), no memory allocation
happens before ops->start(); for 2), ops->start() handles its own
failures and 'info' is installed to the socket control block only
when success. The only ugliness here is we have to pass all local
variables on stack via a struct, but this is not hard to understand.
Alternatively, we can introduce a ops->free() to solve this too,
but it is overkill as only genetlink has this problem so far.
Fixes: 1927f41a22a0 ("net: genetlink: introduce dump info struct to be available during dumpit op")
Reported-by: syzbot+21f04f481f449c8db840@syzkaller.appspotmail.com
Cc: "Jason A. Donenfeld" <Jason@zx2c4.com>
Cc: Florian Westphal <fw@strlen.de>
Cc: Pablo Neira Ayuso <pablo@netfilter.org>
Cc: Jiri Pirko <jiri@mellanox.com>
Cc: YueHaibing <yuehaibing@huawei.com>
Cc: Shaochun Chen <cscnull@gmail.com>
Signed-off-by: Cong Wang <xiyou.wangcong@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
2020-06-02 21:49:10 -07:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2019-10-05 20:04:34 +02:00
|
|
|
|
2023-08-14 14:47:14 -07:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2019-10-05 20:04:33 +02:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2022-11-04 12:13:33 -07:00
|
|
|
|
2019-10-05 20:04:33 +02:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2019-10-05 20:04:35 +02:00
|
|
|
|
|
|
|
|
|
2020-06-12 00:16:55 -07:00
|
|
|
|
2019-10-05 20:04:35 +02:00
|
|
|
|
|
|
|
|
|
2005-11-10 02:25:56 +01:00
|
|
|
|
|
|
|
|
|
2012-09-07 20:12:54 +00:00
|
|
|
|
2023-08-14 14:47:19 -07:00
|
|
|
|
2005-11-10 02:25:56 +01:00
|
|
|
|
|
|
|
|
|
2013-04-23 07:48:30 +00:00
|
|
|
|
2017-04-12 14:34:05 +02:00
|
|
|
|
2009-07-10 09:51:34 +00:00
|
|
|
|
2024-10-09 10:09:47 +02:00
|
|
|
|
2005-11-10 02:25:56 +01:00
|
|
|
|
2022-11-04 12:13:33 -07:00
|
|
|
|
|
|
|
|
|
2010-10-04 21:14:03 +02:00
|
|
|
|
2013-04-26 15:34:16 +00:00
|
|
|
|
2010-10-04 21:14:03 +02:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2022-11-04 12:13:33 -07:00
|
|
|
|
|
|
|
|
|
2010-10-04 21:14:03 +02:00
|
|
|
|
2013-04-26 15:34:16 +00:00
|
|
|
|
2020-06-27 00:12:24 -07:00
|
|
|
|
2013-04-23 07:48:30 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2022-09-29 07:28:09 -07:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2019-10-05 20:04:33 +02:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2022-11-04 12:13:33 -07:00
|
|
|
|
2019-10-05 20:04:33 +02:00
|
|
|
|
2022-11-04 12:13:33 -07:00
|
|
|
|
2019-10-05 20:04:33 +02:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2022-09-29 07:28:09 -07:00
|
|
|
|
2022-08-24 17:18:30 -07:00
|
|
|
|
|
|
|
|
|
2022-11-04 12:13:33 -07:00
|
|
|
|
|
|
|
|
|
2022-11-04 12:13:38 -07:00
|
|
|
|
2019-10-05 20:04:33 +02:00
|
|
|
|
|
|
|
|
|
2020-10-02 14:49:53 -07:00
|
|
|
|
2019-10-05 20:04:33 +02:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2020-10-02 14:49:53 -07:00
|
|
|
|
2019-10-05 20:04:33 +02:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2022-11-04 12:13:33 -07:00
|
|
|
|
2019-10-05 20:04:33 +02:00
|
|
|
|
2020-10-02 14:49:53 -07:00
|
|
|
|
2019-10-05 20:04:33 +02:00
|
|
|
|
|
|
|
|
|
2020-10-02 14:49:53 -07:00
|
|
|
|
2019-10-05 20:04:33 +02:00
|
|
|
|
|
|
|
|
|
2017-04-12 14:34:04 +02:00
|
|
|
|
|
|
|
|
|
2013-04-23 07:48:30 +00:00
|
|
|
|
2016-10-24 14:40:04 +02:00
|
|
|
|
2013-04-23 07:48:30 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2023-08-14 14:47:14 -07:00
|
|
|
|
2017-04-12 14:34:05 +02:00
|
|
|
|
2023-08-14 14:47:14 -07:00
|
|
|
|
2013-04-23 07:48:30 +00:00
|
|
|
|
2010-10-04 21:14:03 +02:00
|
|
|
|
2005-11-10 02:25:56 +01:00
|
|
|
|
|
|
|
|
|
2007-10-10 21:15:29 -07:00
|
|
|
|
2005-11-10 02:25:56 +01:00
|
|
|
|
2013-04-23 07:48:30 +00:00
|
|
|
|
2007-10-10 21:15:29 -07:00
|
|
|
|
2013-04-23 07:48:30 +00:00
|
|
|
|
2005-11-10 02:25:56 +01:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2016-10-24 14:40:03 +02:00
|
|
|
|
2006-11-14 19:46:02 -08:00
|
|
|
|
2016-10-24 14:40:04 +02:00
|
|
|
|
2005-11-10 02:25:56 +01:00
|
|
|
|
|
|
|
|
|
2022-11-04 12:13:39 -07:00
|
|
|
|
2005-11-10 02:25:56 +01:00
|
|
|
|
|
|
|
|
|
2012-09-07 20:12:54 +00:00
|
|
|
|
2005-11-10 02:25:56 +01:00
|
|
|
|
2024-03-02 21:24:08 -08:00
|
|
|
|
2005-11-10 02:25:56 +01:00
|
|
|
|
2012-03-29 23:25:11 -04:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2006-09-18 00:01:59 -07:00
|
|
|
|
2022-11-04 12:13:39 -07:00
|
|
|
|
2006-11-23 11:44:37 -08:00
|
|
|
|
2006-09-18 00:01:59 -07:00
|
|
|
|
2019-04-26 11:13:06 +02:00
|
|
|
|
2006-11-23 11:44:37 -08:00
|
|
|
|
2006-09-18 00:01:59 -07:00
|
|
|
|
|
|
|
|
|
2022-11-04 12:13:39 -07:00
|
|
|
|
2006-11-23 11:44:37 -08:00
|
|
|
|
2020-10-02 14:49:53 -07:00
|
|
|
|
2013-11-14 17:14:45 +01:00
|
|
|
|
2022-11-04 12:13:39 -07:00
|
|
|
|
|
|
|
|
|
2013-11-18 20:54:58 +01:00
|
|
|
|
2006-09-18 00:01:59 -07:00
|
|
|
|
2022-11-04 12:13:39 -07:00
|
|
|
|
2006-11-23 11:44:37 -08:00
|
|
|
|
|
|
|
|
|
2006-09-18 00:01:59 -07:00
|
|
|
|
2022-11-04 12:13:39 -07:00
|
|
|
|
2013-11-18 20:54:58 +01:00
|
|
|
|
2012-03-29 23:25:11 -04:00
|
|
|
|
2006-09-18 00:01:59 -07:00
|
|
|
|
2006-11-23 11:44:37 -08:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2006-09-18 00:01:59 -07:00
|
|
|
|
|
|
|
|
|
2013-11-19 15:19:39 +01:00
|
|
|
|
2007-07-18 15:47:52 -07:00
|
|
|
|
2013-11-19 15:19:39 +01:00
|
|
|
|
2007-07-18 15:47:52 -07:00
|
|
|
|
2019-04-26 11:13:06 +02:00
|
|
|
|
2007-07-18 15:47:52 -07:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2013-11-19 15:19:39 +01:00
|
|
|
|
2007-07-18 15:47:52 -07:00
|
|
|
|
2013-11-19 15:19:39 +01:00
|
|
|
|
2007-07-18 15:47:52 -07:00
|
|
|
|
2013-11-19 15:19:39 +01:00
|
|
|
|
|
|
|
|
|
2019-04-26 11:13:06 +02:00
|
|
|
|
2007-07-18 15:47:52 -07:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2013-11-19 15:19:39 +01:00
|
|
|
|
|
|
|
|
|
2012-03-29 23:25:11 -04:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2007-07-18 15:47:52 -07:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2015-01-16 22:09:00 +01:00
|
|
|
|
|
|
|
|
|
2007-07-18 15:47:52 -07:00
|
|
|
|
|
|
|
|
|
2008-06-03 16:36:54 -07:00
|
|
|
|
|
|
|
|
|
2007-07-18 15:47:52 -07:00
|
|
|
|
|
|
|
|
|
2016-10-24 14:40:04 +02:00
|
|
|
|
2013-11-19 15:19:39 +01:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2007-07-18 15:47:52 -07:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2012-09-07 20:12:54 +00:00
|
|
|
|
2007-07-18 15:47:52 -07:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2013-11-19 15:19:36 +01:00
|
|
|
|
|
|
|
|
|
2012-03-29 23:25:11 -04:00
|
|
|
|
2007-07-18 15:47:52 -07:00
|
|
|
|
2019-04-26 11:13:06 +02:00
|
|
|
|
2007-07-18 15:47:52 -07:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2019-04-26 11:13:06 +02:00
|
|
|
|
2007-07-18 15:47:52 -07:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2013-11-19 15:19:39 +01:00
|
|
|
|
2012-03-29 23:25:11 -04:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2007-07-18 15:47:52 -07:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2015-01-16 22:09:00 +01:00
|
|
|
|
|
|
|
|
|
2005-11-10 02:25:56 +01:00
|
|
|
|
|
|
|
|
|
2008-06-03 16:36:54 -07:00
|
|
|
|
|
|
|
|
|
2005-11-10 02:25:56 +01:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2016-10-24 14:40:04 +02:00
|
|
|
|
2005-11-10 02:25:56 +01:00
|
|
|
|
2009-07-10 09:51:34 +00:00
|
|
|
|
2016-10-24 14:40:04 +02:00
|
|
|
|
|
|
|
|
|
2024-03-02 21:24:08 -08:00
|
|
|
|
2005-11-10 02:25:56 +01:00
|
|
|
|
2016-10-24 14:40:04 +02:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2005-11-10 02:25:56 +01:00
|
|
|
|
2016-10-24 14:40:04 +02:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2024-03-02 21:24:08 -08:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2017-03-22 16:08:33 +01:00
|
|
|
|
2016-10-24 14:40:04 +02:00
|
|
|
|
2017-03-22 16:08:33 +01:00
|
|
|
|
2005-11-10 02:25:56 +01:00
|
|
|
|
|
|
|
|
|
2016-10-24 14:40:04 +02:00
|
|
|
|
2024-03-02 21:24:08 -08:00
|
|
|
|
2005-11-10 02:25:56 +01:00
|
|
|
|
|
|
|
|
|
2016-10-24 14:40:04 +02:00
|
|
|
|
2012-09-07 20:12:54 +00:00
|
|
|
|
2005-11-10 02:25:56 +01:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2006-11-10 14:10:15 -08:00
|
|
|
|
2005-11-10 02:25:56 +01:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2012-09-07 20:12:54 +00:00
|
|
|
|
2005-11-10 02:25:56 +01:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2013-11-19 15:19:39 +01:00
|
|
|
|
2016-10-24 14:40:04 +02:00
|
|
|
|
2013-11-19 15:19:39 +01:00
|
|
|
|
|
|
|
|
|
2007-07-18 15:47:52 -07:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2013-11-19 15:19:39 +01:00
|
|
|
|
|
|
|
|
|
2007-07-18 15:47:52 -07:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2020-10-02 14:50:00 -07:00
|
|
|
|
2005-11-10 02:25:56 +01:00
|
|
|
|
2006-08-26 20:13:18 -07:00
|
|
|
|
|
|
|
|
|
2005-11-10 02:25:56 +01:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2016-10-24 14:40:04 +02:00
|
|
|
|
2005-11-10 02:25:56 +01:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2009-07-10 09:51:34 +00:00
|
|
|
|
2005-11-10 02:25:56 +01:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2006-08-26 20:13:18 -07:00
|
|
|
|
2005-11-10 02:25:56 +01:00
|
|
|
|
2006-08-26 20:13:18 -07:00
|
|
|
|
2005-11-10 02:25:56 +01:00
|
|
|
|
2011-12-28 13:48:55 -05:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2013-07-26 11:00:10 +02:00
|
|
|
|
2012-05-29 09:30:41 +00:00
|
|
|
|
2011-12-28 13:48:55 -05:00
|
|
|
|
2013-07-26 11:00:10 +02:00
|
|
|
|
2011-12-28 13:48:55 -05:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2009-07-10 09:51:34 +00:00
|
|
|
|
2005-11-10 02:25:56 +01:00
|
|
|
|
|
|
|
|
|
2009-07-10 09:51:34 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2005-11-10 02:25:56 +01:00
|
|
|
|
|
|
|
|
|
2012-09-07 20:12:54 +00:00
|
|
|
|
2007-07-18 15:47:52 -07:00
|
|
|
|
2009-07-10 09:51:34 +00:00
|
|
|
|
|
|
|
|
|
2005-11-10 02:25:56 +01:00
|
|
|
|
2009-07-10 09:51:34 +00:00
|
|
|
|
2005-11-10 02:25:56 +01:00
|
|
|
|
|
|
|
|
|
2016-10-24 14:40:04 +02:00
|
|
|
|
2013-11-19 15:19:39 +01:00
|
|
|
|
|
|
|
|
|
2005-11-10 02:25:56 +01:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2009-07-10 09:51:34 +00:00
|
|
|
|
|
|
|
|
|
2005-11-10 02:25:56 +01:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2013-11-19 15:19:36 +01:00
|
|
|
|
2009-07-10 09:51:34 +00:00
|
|
|
|
2007-07-18 15:47:52 -07:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2013-11-19 15:19:36 +01:00
|
|
|
|
2013-11-19 15:19:39 +01:00
|
|
|
|
2005-11-10 02:25:56 +01:00
|
|
|
|
2009-07-10 09:51:34 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2024-10-11 17:12:17 +00:00
|
|
|
|
2013-11-19 15:19:38 +01:00
|
|
|
|
2013-11-19 15:19:39 +01:00
|
|
|
|
2024-10-11 17:12:17 +00:00
|
|
|
|
|
|
|
|
|
2005-11-10 02:25:56 +01:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2020-10-02 14:49:55 -07:00
|
|
|
|
|
|
|
|
|
2020-10-03 10:44:45 +02:00
|
|
|
|
2022-11-04 12:13:40 -07:00
|
|
|
|
2020-10-03 10:44:46 +02:00
|
|
|
|
2020-10-02 14:49:55 -07:00
|
|
|
|
2022-11-04 12:13:40 -07:00
|
|
|
|
2020-10-03 10:44:46 +02:00
|
|
|
|
2020-10-02 14:49:55 -07:00
|
|
|
|
|
|
|
|
|
2020-10-02 14:50:00 -07:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2020-10-03 10:44:46 +02:00
|
|
|
|
2020-10-02 14:50:00 -07:00
|
|
|
|
|
|
|
|
|
2020-10-02 14:49:56 -07:00
|
|
|
|
netlink: add infrastructure to expose policies to userspace
Add, and use in generic netlink, helpers to dump out a netlink
policy to userspace, including all the range validation data,
nested policies etc.
This lets userspace discover what the kernel understands.
For families/commands other than generic netlink, the helpers
need to be used directly in an appropriate command, or we can
add some infrastructure (a new netlink family) that those can
register their policies with for introspection. I'm not that
familiar with non-generic netlink, so that's left out for now.
The data exposed to userspace also includes min and max length
for binary/string data, I've done that instead of letting the
userspace tools figure out whether min/max is intended based
on the type so that we can extend this later in the kernel, we
might want to just use the range data for example.
Because of this, I opted to not directly expose the NLA_*
values, even if some of them are already exposed via BPF, as
with min/max length we don't need to have different types here
for NLA_BINARY/NLA_MIN_LEN/NLA_EXACT_LEN, we just make them
all NL_ATTR_TYPE_BINARY with min/max length optionally set.
Similarly, we don't really need NLA_MSECS, and perhaps can
remove it in the future - but not if we encode it into the
userspace API now. It gets mapped to NL_ATTR_TYPE_U64 here.
Note that the exposing here corresponds to the strict policy
interpretation, and NLA_UNSPEC items are omitted entirely.
To get those, change them to NLA_MIN_LEN which behaves in
exactly the same way, but is exposed.
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
2020-04-30 22:13:12 +02:00
|
|
|
|
2020-10-02 14:49:59 -07:00
|
|
|
|
2020-10-02 14:49:55 -07:00
|
|
|
|
2023-08-14 14:47:18 -07:00
|
|
|
|
netlink: add infrastructure to expose policies to userspace
Add, and use in generic netlink, helpers to dump out a netlink
policy to userspace, including all the range validation data,
nested policies etc.
This lets userspace discover what the kernel understands.
For families/commands other than generic netlink, the helpers
need to be used directly in an appropriate command, or we can
add some infrastructure (a new netlink family) that those can
register their policies with for introspection. I'm not that
familiar with non-generic netlink, so that's left out for now.
The data exposed to userspace also includes min and max length
for binary/string data, I've done that instead of letting the
userspace tools figure out whether min/max is intended based
on the type so that we can extend this later in the kernel, we
might want to just use the range data for example.
Because of this, I opted to not directly expose the NLA_*
values, even if some of them are already exposed via BPF, as
with min/max length we don't need to have different types here
for NLA_BINARY/NLA_MIN_LEN/NLA_EXACT_LEN, we just make them
all NL_ATTR_TYPE_BINARY with min/max length optionally set.
Similarly, we don't really need NLA_MSECS, and perhaps can
remove it in the future - but not if we encode it into the
userspace API now. It gets mapped to NL_ATTR_TYPE_U64 here.
Note that the exposing here corresponds to the strict policy
interpretation, and NLA_UNSPEC items are omitted entirely.
To get those, change them to NLA_MIN_LEN which behaves in
exactly the same way, but is exposed.
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
2020-04-30 22:13:12 +02:00
|
|
|
|
2022-11-04 12:13:39 -07:00
|
|
|
|
|
|
|
|
|
netlink: add infrastructure to expose policies to userspace
Add, and use in generic netlink, helpers to dump out a netlink
policy to userspace, including all the range validation data,
nested policies etc.
This lets userspace discover what the kernel understands.
For families/commands other than generic netlink, the helpers
need to be used directly in an appropriate command, or we can
add some infrastructure (a new netlink family) that those can
register their policies with for introspection. I'm not that
familiar with non-generic netlink, so that's left out for now.
The data exposed to userspace also includes min and max length
for binary/string data, I've done that instead of letting the
userspace tools figure out whether min/max is intended based
on the type so that we can extend this later in the kernel, we
might want to just use the range data for example.
Because of this, I opted to not directly expose the NLA_*
values, even if some of them are already exposed via BPF, as
with min/max length we don't need to have different types here
for NLA_BINARY/NLA_MIN_LEN/NLA_EXACT_LEN, we just make them
all NL_ATTR_TYPE_BINARY with min/max length optionally set.
Similarly, we don't really need NLA_MSECS, and perhaps can
remove it in the future - but not if we encode it into the
userspace API now. It gets mapped to NL_ATTR_TYPE_U64 here.
Note that the exposing here corresponds to the strict policy
interpretation, and NLA_UNSPEC items are omitted entirely.
To get those, change them to NLA_MIN_LEN which behaves in
exactly the same way, but is exposed.
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
2020-04-30 22:13:12 +02:00
|
|
|
|
2020-10-02 14:49:55 -07:00
|
|
|
|
|
|
|
|
|
2020-10-02 14:49:56 -07:00
|
|
|
|
|
|
|
|
|
netlink: add infrastructure to expose policies to userspace
Add, and use in generic netlink, helpers to dump out a netlink
policy to userspace, including all the range validation data,
nested policies etc.
This lets userspace discover what the kernel understands.
For families/commands other than generic netlink, the helpers
need to be used directly in an appropriate command, or we can
add some infrastructure (a new netlink family) that those can
register their policies with for introspection. I'm not that
familiar with non-generic netlink, so that's left out for now.
The data exposed to userspace also includes min and max length
for binary/string data, I've done that instead of letting the
userspace tools figure out whether min/max is intended based
on the type so that we can extend this later in the kernel, we
might want to just use the range data for example.
Because of this, I opted to not directly expose the NLA_*
values, even if some of them are already exposed via BPF, as
with min/max length we don't need to have different types here
for NLA_BINARY/NLA_MIN_LEN/NLA_EXACT_LEN, we just make them
all NL_ATTR_TYPE_BINARY with min/max length optionally set.
Similarly, we don't really need NLA_MSECS, and perhaps can
remove it in the future - but not if we encode it into the
userspace API now. It gets mapped to NL_ATTR_TYPE_U64 here.
Note that the exposing here corresponds to the strict policy
interpretation, and NLA_UNSPEC items are omitted entirely.
To get those, change them to NLA_MIN_LEN which behaves in
exactly the same way, but is exposed.
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
2020-04-30 22:13:12 +02:00
|
|
|
|
2020-10-02 14:49:56 -07:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
netlink: add infrastructure to expose policies to userspace
Add, and use in generic netlink, helpers to dump out a netlink
policy to userspace, including all the range validation data,
nested policies etc.
This lets userspace discover what the kernel understands.
For families/commands other than generic netlink, the helpers
need to be used directly in an appropriate command, or we can
add some infrastructure (a new netlink family) that those can
register their policies with for introspection. I'm not that
familiar with non-generic netlink, so that's left out for now.
The data exposed to userspace also includes min and max length
for binary/string data, I've done that instead of letting the
userspace tools figure out whether min/max is intended based
on the type so that we can extend this later in the kernel, we
might want to just use the range data for example.
Because of this, I opted to not directly expose the NLA_*
values, even if some of them are already exposed via BPF, as
with min/max length we don't need to have different types here
for NLA_BINARY/NLA_MIN_LEN/NLA_EXACT_LEN, we just make them
all NL_ATTR_TYPE_BINARY with min/max length optionally set.
Similarly, we don't really need NLA_MSECS, and perhaps can
remove it in the future - but not if we encode it into the
userspace API now. It gets mapped to NL_ATTR_TYPE_U64 here.
Note that the exposing here corresponds to the strict policy
interpretation, and NLA_UNSPEC items are omitted entirely.
To get those, change them to NLA_MIN_LEN which behaves in
exactly the same way, but is exposed.
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
2020-04-30 22:13:12 +02:00
|
|
|
|
|
|
|
|
|
2020-10-02 14:49:55 -07:00
|
|
|
|
netlink: add infrastructure to expose policies to userspace
Add, and use in generic netlink, helpers to dump out a netlink
policy to userspace, including all the range validation data,
nested policies etc.
This lets userspace discover what the kernel understands.
For families/commands other than generic netlink, the helpers
need to be used directly in an appropriate command, or we can
add some infrastructure (a new netlink family) that those can
register their policies with for introspection. I'm not that
familiar with non-generic netlink, so that's left out for now.
The data exposed to userspace also includes min and max length
for binary/string data, I've done that instead of letting the
userspace tools figure out whether min/max is intended based
on the type so that we can extend this later in the kernel, we
might want to just use the range data for example.
Because of this, I opted to not directly expose the NLA_*
values, even if some of them are already exposed via BPF, as
with min/max length we don't need to have different types here
for NLA_BINARY/NLA_MIN_LEN/NLA_EXACT_LEN, we just make them
all NL_ATTR_TYPE_BINARY with min/max length optionally set.
Similarly, we don't really need NLA_MSECS, and perhaps can
remove it in the future - but not if we encode it into the
userspace API now. It gets mapped to NL_ATTR_TYPE_U64 here.
Note that the exposing here corresponds to the strict policy
interpretation, and NLA_UNSPEC items are omitted entirely.
To get those, change them to NLA_MIN_LEN which behaves in
exactly the same way, but is exposed.
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
2020-04-30 22:13:12 +02:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2020-10-03 10:44:45 +02:00
|
|
|
|
netlink: add infrastructure to expose policies to userspace
Add, and use in generic netlink, helpers to dump out a netlink
policy to userspace, including all the range validation data,
nested policies etc.
This lets userspace discover what the kernel understands.
For families/commands other than generic netlink, the helpers
need to be used directly in an appropriate command, or we can
add some infrastructure (a new netlink family) that those can
register their policies with for introspection. I'm not that
familiar with non-generic netlink, so that's left out for now.
The data exposed to userspace also includes min and max length
for binary/string data, I've done that instead of letting the
userspace tools figure out whether min/max is intended based
on the type so that we can extend this later in the kernel, we
might want to just use the range data for example.
Because of this, I opted to not directly expose the NLA_*
values, even if some of them are already exposed via BPF, as
with min/max length we don't need to have different types here
for NLA_BINARY/NLA_MIN_LEN/NLA_EXACT_LEN, we just make them
all NL_ATTR_TYPE_BINARY with min/max length optionally set.
Similarly, we don't really need NLA_MSECS, and perhaps can
remove it in the future - but not if we encode it into the
userspace API now. It gets mapped to NL_ATTR_TYPE_U64 here.
Note that the exposing here corresponds to the strict policy
interpretation, and NLA_UNSPEC items are omitted entirely.
To get those, change them to NLA_MIN_LEN which behaves in
exactly the same way, but is exposed.
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
2020-04-30 22:13:12 +02:00
|
|
|
|
2020-10-03 10:44:46 +02:00
|
|
|
|
2022-11-04 12:13:36 -07:00
|
|
|
|
|
|
|
|
|
2020-10-03 10:44:46 +02:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2022-11-09 10:32:54 -08:00
|
|
|
|
|
|
|
|
|
2020-10-03 10:44:46 +02:00
|
|
|
|
2022-11-09 10:32:54 -08:00
|
|
|
|
2020-10-03 10:44:46 +02:00
|
|
|
|
|
|
|
|
|
2022-11-04 12:13:36 -07:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2020-10-03 10:44:46 +02:00
|
|
|
|
2022-11-04 12:13:36 -07:00
|
|
|
|
|
|
|
|
|
2022-11-04 12:13:40 -07:00
|
|
|
|
|
|
|
|
|
2022-11-04 12:13:36 -07:00
|
|
|
|
2020-10-03 10:44:46 +02:00
|
|
|
|
|
|
|
|
|
2026-02-21 16:37:42 -08:00
|
|
|
|
2022-11-04 12:13:40 -07:00
|
|
|
|
|
|
|
|
|
2022-11-08 12:41:28 -08:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2022-11-04 12:13:40 -07:00
|
|
|
|
2022-11-04 12:13:39 -07:00
|
|
|
|
|
|
|
|
|
2020-10-03 10:44:45 +02:00
|
|
|
|
2022-11-04 12:13:39 -07:00
|
|
|
|
|
|
|
|
|
2022-11-04 12:13:36 -07:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2022-11-04 12:13:39 -07:00
|
|
|
|
2022-11-04 12:13:36 -07:00
|
|
|
|
2022-11-04 12:13:39 -07:00
|
|
|
|
|
|
|
|
|
2020-10-03 10:44:45 +02:00
|
|
|
|
2022-08-16 09:19:39 -07:00
|
|
|
|
2020-10-03 10:44:45 +02:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2022-11-04 12:13:40 -07:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2020-10-03 10:44:45 +02:00
|
|
|
|
2022-08-16 09:19:39 -07:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2022-11-04 12:13:40 -07:00
|
|
|
|
|
|
|
|
|
2022-08-16 09:19:39 -07:00
|
|
|
|
2020-10-02 14:49:56 -07:00
|
|
|
|
|
|
|
|
|
2020-10-03 10:44:44 +02:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2020-10-03 10:44:45 +02:00
|
|
|
|
|
|
|
|
|
2022-11-04 12:13:37 -07:00
|
|
|
|
|
|
|
|
|
2020-10-03 10:44:45 +02:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2022-11-04 12:13:37 -07:00
|
|
|
|
2020-10-03 10:44:45 +02:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2022-11-04 12:13:37 -07:00
|
|
|
|
2020-10-03 10:44:45 +02:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2022-11-04 12:13:37 -07:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2020-10-03 10:44:45 +02:00
|
|
|
|
2022-11-04 12:13:37 -07:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2020-10-03 10:44:45 +02:00
|
|
|
|
2022-11-04 12:13:37 -07:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2020-10-03 10:44:45 +02:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2020-10-02 14:49:56 -07:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2020-10-03 10:44:45 +02:00
|
|
|
|
|
|
|
|
|
2022-11-04 12:13:40 -07:00
|
|
|
|
2022-11-04 12:13:31 -07:00
|
|
|
|
2022-11-04 12:13:40 -07:00
|
|
|
|
|
|
|
|
|
2022-11-09 10:32:54 -08:00
|
|
|
|
|
|
|
|
|
2022-11-04 12:13:37 -07:00
|
|
|
|
2022-11-04 12:13:31 -07:00
|
|
|
|
2022-11-04 12:13:37 -07:00
|
|
|
|
2022-11-04 12:13:31 -07:00
|
|
|
|
|
|
|
|
|
2022-11-04 12:13:40 -07:00
|
|
|
|
|
|
|
|
|
2022-11-04 12:13:31 -07:00
|
|
|
|
|
|
|
|
|
2022-11-04 12:13:40 -07:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2020-10-03 10:44:45 +02:00
|
|
|
|
|
|
|
|
|
2022-11-04 12:13:40 -07:00
|
|
|
|
2020-10-03 10:44:45 +02:00
|
|
|
|
|
|
|
|
|
netlink: add infrastructure to expose policies to userspace
Add, and use in generic netlink, helpers to dump out a netlink
policy to userspace, including all the range validation data,
nested policies etc.
This lets userspace discover what the kernel understands.
For families/commands other than generic netlink, the helpers
need to be used directly in an appropriate command, or we can
add some infrastructure (a new netlink family) that those can
register their policies with for introspection. I'm not that
familiar with non-generic netlink, so that's left out for now.
The data exposed to userspace also includes min and max length
for binary/string data, I've done that instead of letting the
userspace tools figure out whether min/max is intended based
on the type so that we can extend this later in the kernel, we
might want to just use the range data for example.
Because of this, I opted to not directly expose the NLA_*
values, even if some of them are already exposed via BPF, as
with min/max length we don't need to have different types here
for NLA_BINARY/NLA_MIN_LEN/NLA_EXACT_LEN, we just make them
all NL_ATTR_TYPE_BINARY with min/max length optionally set.
Similarly, we don't really need NLA_MSECS, and perhaps can
remove it in the future - but not if we encode it into the
userspace API now. It gets mapped to NL_ATTR_TYPE_U64 here.
Note that the exposing here corresponds to the strict policy
interpretation, and NLA_UNSPEC items are omitted entirely.
To get those, change them to NLA_MIN_LEN which behaves in
exactly the same way, but is exposed.
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
2020-04-30 22:13:12 +02:00
|
|
|
|
2020-10-02 14:49:55 -07:00
|
|
|
|
netlink: add infrastructure to expose policies to userspace
Add, and use in generic netlink, helpers to dump out a netlink
policy to userspace, including all the range validation data,
nested policies etc.
This lets userspace discover what the kernel understands.
For families/commands other than generic netlink, the helpers
need to be used directly in an appropriate command, or we can
add some infrastructure (a new netlink family) that those can
register their policies with for introspection. I'm not that
familiar with non-generic netlink, so that's left out for now.
The data exposed to userspace also includes min and max length
for binary/string data, I've done that instead of letting the
userspace tools figure out whether min/max is intended based
on the type so that we can extend this later in the kernel, we
might want to just use the range data for example.
Because of this, I opted to not directly expose the NLA_*
values, even if some of them are already exposed via BPF, as
with min/max length we don't need to have different types here
for NLA_BINARY/NLA_MIN_LEN/NLA_EXACT_LEN, we just make them
all NL_ATTR_TYPE_BINARY with min/max length optionally set.
Similarly, we don't really need NLA_MSECS, and perhaps can
remove it in the future - but not if we encode it into the
userspace API now. It gets mapped to NL_ATTR_TYPE_U64 here.
Note that the exposing here corresponds to the strict policy
interpretation, and NLA_UNSPEC items are omitted entirely.
To get those, change them to NLA_MIN_LEN which behaves in
exactly the same way, but is exposed.
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
2020-04-30 22:13:12 +02:00
|
|
|
|
|
|
|
|
|
2020-10-03 10:44:44 +02:00
|
|
|
|
netlink: add infrastructure to expose policies to userspace
Add, and use in generic netlink, helpers to dump out a netlink
policy to userspace, including all the range validation data,
nested policies etc.
This lets userspace discover what the kernel understands.
For families/commands other than generic netlink, the helpers
need to be used directly in an appropriate command, or we can
add some infrastructure (a new netlink family) that those can
register their policies with for introspection. I'm not that
familiar with non-generic netlink, so that's left out for now.
The data exposed to userspace also includes min and max length
for binary/string data, I've done that instead of letting the
userspace tools figure out whether min/max is intended based
on the type so that we can extend this later in the kernel, we
might want to just use the range data for example.
Because of this, I opted to not directly expose the NLA_*
values, even if some of them are already exposed via BPF, as
with min/max length we don't need to have different types here
for NLA_BINARY/NLA_MIN_LEN/NLA_EXACT_LEN, we just make them
all NL_ATTR_TYPE_BINARY with min/max length optionally set.
Similarly, we don't really need NLA_MSECS, and perhaps can
remove it in the future - but not if we encode it into the
userspace API now. It gets mapped to NL_ATTR_TYPE_U64 here.
Note that the exposing here corresponds to the strict policy
interpretation, and NLA_UNSPEC items are omitted entirely.
To get those, change them to NLA_MIN_LEN which behaves in
exactly the same way, but is exposed.
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
2020-04-30 22:13:12 +02:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2020-10-02 14:49:55 -07:00
|
|
|
|
netlink: add infrastructure to expose policies to userspace
Add, and use in generic netlink, helpers to dump out a netlink
policy to userspace, including all the range validation data,
nested policies etc.
This lets userspace discover what the kernel understands.
For families/commands other than generic netlink, the helpers
need to be used directly in an appropriate command, or we can
add some infrastructure (a new netlink family) that those can
register their policies with for introspection. I'm not that
familiar with non-generic netlink, so that's left out for now.
The data exposed to userspace also includes min and max length
for binary/string data, I've done that instead of letting the
userspace tools figure out whether min/max is intended based
on the type so that we can extend this later in the kernel, we
might want to just use the range data for example.
Because of this, I opted to not directly expose the NLA_*
values, even if some of them are already exposed via BPF, as
with min/max length we don't need to have different types here
for NLA_BINARY/NLA_MIN_LEN/NLA_EXACT_LEN, we just make them
all NL_ATTR_TYPE_BINARY with min/max length optionally set.
Similarly, we don't really need NLA_MSECS, and perhaps can
remove it in the future - but not if we encode it into the
userspace API now. It gets mapped to NL_ATTR_TYPE_U64 here.
Note that the exposing here corresponds to the strict policy
interpretation, and NLA_UNSPEC items are omitted entirely.
To get those, change them to NLA_MIN_LEN which behaves in
exactly the same way, but is exposed.
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
2020-04-30 22:13:12 +02:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2020-10-03 10:44:45 +02:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
netlink: add infrastructure to expose policies to userspace
Add, and use in generic netlink, helpers to dump out a netlink
policy to userspace, including all the range validation data,
nested policies etc.
This lets userspace discover what the kernel understands.
For families/commands other than generic netlink, the helpers
need to be used directly in an appropriate command, or we can
add some infrastructure (a new netlink family) that those can
register their policies with for introspection. I'm not that
familiar with non-generic netlink, so that's left out for now.
The data exposed to userspace also includes min and max length
for binary/string data, I've done that instead of letting the
userspace tools figure out whether min/max is intended based
on the type so that we can extend this later in the kernel, we
might want to just use the range data for example.
Because of this, I opted to not directly expose the NLA_*
values, even if some of them are already exposed via BPF, as
with min/max length we don't need to have different types here
for NLA_BINARY/NLA_MIN_LEN/NLA_EXACT_LEN, we just make them
all NL_ATTR_TYPE_BINARY with min/max length optionally set.
Similarly, we don't really need NLA_MSECS, and perhaps can
remove it in the future - but not if we encode it into the
userspace API now. It gets mapped to NL_ATTR_TYPE_U64 here.
Note that the exposing here corresponds to the strict policy
interpretation, and NLA_UNSPEC items are omitted entirely.
To get those, change them to NLA_MIN_LEN which behaves in
exactly the same way, but is exposed.
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
2020-04-30 22:13:12 +02:00
|
|
|
|
|
|
|
|
|
2020-10-02 09:46:04 +02:00
|
|
|
|
|
|
|
|
|
2020-10-02 14:49:55 -07:00
|
|
|
|
|
|
|
|
|
2022-11-04 12:13:40 -07:00
|
|
|
|
2020-10-02 14:49:55 -07:00
|
|
|
|
2020-10-02 09:46:04 +02:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2022-11-04 12:13:43 -07:00
|
|
|
|
2013-11-19 15:19:31 +01:00
|
|
|
|
|
|
|
|
|
2022-11-04 12:13:43 -07:00
|
|
|
|
2020-10-02 14:50:00 -07:00
|
|
|
|
|
|
|
|
|
2013-11-19 15:19:31 +01:00
|
|
|
|
2022-11-04 12:13:43 -07:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2013-11-19 15:19:31 +01:00
|
|
|
|
2022-11-04 12:13:43 -07:00
|
|
|
|
2013-11-19 15:19:31 +01:00
|
|
|
|
netlink: add infrastructure to expose policies to userspace
Add, and use in generic netlink, helpers to dump out a netlink
policy to userspace, including all the range validation data,
nested policies etc.
This lets userspace discover what the kernel understands.
For families/commands other than generic netlink, the helpers
need to be used directly in an appropriate command, or we can
add some infrastructure (a new netlink family) that those can
register their policies with for introspection. I'm not that
familiar with non-generic netlink, so that's left out for now.
The data exposed to userspace also includes min and max length
for binary/string data, I've done that instead of letting the
userspace tools figure out whether min/max is intended based
on the type so that we can extend this later in the kernel, we
might want to just use the range data for example.
Because of this, I opted to not directly expose the NLA_*
values, even if some of them are already exposed via BPF, as
with min/max length we don't need to have different types here
for NLA_BINARY/NLA_MIN_LEN/NLA_EXACT_LEN, we just make them
all NL_ATTR_TYPE_BINARY with min/max length optionally set.
Similarly, we don't really need NLA_MSECS, and perhaps can
remove it in the future - but not if we encode it into the
userspace API now. It gets mapped to NL_ATTR_TYPE_U64 here.
Note that the exposing here corresponds to the strict policy
interpretation, and NLA_UNSPEC items are omitted entirely.
To get those, change them to NLA_MIN_LEN which behaves in
exactly the same way, but is exposed.
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
2020-04-30 22:13:12 +02:00
|
|
|
|
|
|
|
|
|
2020-10-02 14:50:00 -07:00
|
|
|
|
|
|
|
|
|
2020-10-02 14:49:56 -07:00
|
|
|
|
netlink: add infrastructure to expose policies to userspace
Add, and use in generic netlink, helpers to dump out a netlink
policy to userspace, including all the range validation data,
nested policies etc.
This lets userspace discover what the kernel understands.
For families/commands other than generic netlink, the helpers
need to be used directly in an appropriate command, or we can
add some infrastructure (a new netlink family) that those can
register their policies with for introspection. I'm not that
familiar with non-generic netlink, so that's left out for now.
The data exposed to userspace also includes min and max length
for binary/string data, I've done that instead of letting the
userspace tools figure out whether min/max is intended based
on the type so that we can extend this later in the kernel, we
might want to just use the range data for example.
Because of this, I opted to not directly expose the NLA_*
values, even if some of them are already exposed via BPF, as
with min/max length we don't need to have different types here
for NLA_BINARY/NLA_MIN_LEN/NLA_EXACT_LEN, we just make them
all NL_ATTR_TYPE_BINARY with min/max length optionally set.
Similarly, we don't really need NLA_MSECS, and perhaps can
remove it in the future - but not if we encode it into the
userspace API now. It gets mapped to NL_ATTR_TYPE_U64 here.
Note that the exposing here corresponds to the strict policy
interpretation, and NLA_UNSPEC items are omitted entirely.
To get those, change them to NLA_MIN_LEN which behaves in
exactly the same way, but is exposed.
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
2020-04-30 22:13:12 +02:00
|
|
|
|
2020-10-02 09:46:04 +02:00
|
|
|
|
2022-11-04 12:13:43 -07:00
|
|
|
|
netlink: add infrastructure to expose policies to userspace
Add, and use in generic netlink, helpers to dump out a netlink
policy to userspace, including all the range validation data,
nested policies etc.
This lets userspace discover what the kernel understands.
For families/commands other than generic netlink, the helpers
need to be used directly in an appropriate command, or we can
add some infrastructure (a new netlink family) that those can
register their policies with for introspection. I'm not that
familiar with non-generic netlink, so that's left out for now.
The data exposed to userspace also includes min and max length
for binary/string data, I've done that instead of letting the
userspace tools figure out whether min/max is intended based
on the type so that we can extend this later in the kernel, we
might want to just use the range data for example.
Because of this, I opted to not directly expose the NLA_*
values, even if some of them are already exposed via BPF, as
with min/max length we don't need to have different types here
for NLA_BINARY/NLA_MIN_LEN/NLA_EXACT_LEN, we just make them
all NL_ATTR_TYPE_BINARY with min/max length optionally set.
Similarly, we don't really need NLA_MSECS, and perhaps can
remove it in the future - but not if we encode it into the
userspace API now. It gets mapped to NL_ATTR_TYPE_U64 here.
Note that the exposing here corresponds to the strict policy
interpretation, and NLA_UNSPEC items are omitted entirely.
To get those, change them to NLA_MIN_LEN which behaves in
exactly the same way, but is exposed.
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
2020-04-30 22:13:12 +02:00
|
|
|
|
2005-11-10 02:25:56 +01:00
|
|
|
|
|
|
|
|
|
2016-08-31 15:22:00 -07:00
|
|
|
|
2013-11-19 15:19:39 +01:00
|
|
|
|
2007-07-18 15:47:52 -07:00
|
|
|
|
|
|
|
|
|
2016-10-24 14:40:05 +02:00
|
|
|
|
2016-10-24 14:40:03 +02:00
|
|
|
|
2022-11-04 12:13:43 -07:00
|
|
|
|
|
|
|
|
|
2022-08-24 17:18:30 -07:00
|
|
|
|
2016-10-24 14:40:03 +02:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2021-02-12 15:59:59 -08:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2022-08-25 10:19:40 +02:00
|
|
|
|
2021-02-12 15:59:59 -08:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2023-12-20 17:43:58 +02:00
|
|
|
|
2021-02-12 15:59:59 -08:00
|
|
|
|
|
|
|
|
|
2023-12-20 17:43:58 +02:00
|
|
|
|
drop_monitor: Require 'CAP_SYS_ADMIN' when joining "events" group
The "NET_DM" generic netlink family notifies drop locations over the
"events" multicast group. This is problematic since by default generic
netlink allows non-root users to listen to these notifications.
Fix by adding a new field to the generic netlink multicast group
structure that when set prevents non-root users or root without the
'CAP_SYS_ADMIN' capability (in the user namespace owning the network
namespace) from joining the group. Set this field for the "events"
group. Use 'CAP_SYS_ADMIN' rather than 'CAP_NET_ADMIN' because of the
nature of the information that is shared over this group.
Note that the capability check in this case will always be performed
against the initial user namespace since the family is not netns aware
and only operates in the initial network namespace.
A new field is added to the structure rather than using the "flags"
field because the existing field uses uAPI flags and it is inappropriate
to add a new uAPI flag for an internal kernel check. In net-next we can
rework the "flags" field to use internal flags and fold the new field
into it. But for now, in order to reduce the amount of changes, add a
new field.
Since the information can only be consumed by root, mark the control
plane operations that start and stop the tracing as root-only using the
'GENL_ADMIN_PERM' flag.
Tested using [1].
Before:
# capsh -- -c ./dm_repo
# capsh --drop=cap_sys_admin -- -c ./dm_repo
After:
# capsh -- -c ./dm_repo
# capsh --drop=cap_sys_admin -- -c ./dm_repo
Failed to join "events" multicast group
[1]
$ cat dm.c
#include <stdio.h>
#include <netlink/genl/ctrl.h>
#include <netlink/genl/genl.h>
#include <netlink/socket.h>
int main(int argc, char **argv)
{
struct nl_sock *sk;
int grp, err;
sk = nl_socket_alloc();
if (!sk) {
fprintf(stderr, "Failed to allocate socket\n");
return -1;
}
err = genl_connect(sk);
if (err) {
fprintf(stderr, "Failed to connect socket\n");
return err;
}
grp = genl_ctrl_resolve_grp(sk, "NET_DM", "events");
if (grp < 0) {
fprintf(stderr,
"Failed to resolve \"events\" multicast group\n");
return grp;
}
err = nl_socket_add_memberships(sk, grp, NFNLGRP_NONE);
if (err) {
fprintf(stderr, "Failed to join \"events\" multicast group\n");
return err;
}
return 0;
}
$ gcc -I/usr/include/libnl3 -lnl-3 -lnl-genl-3 -o dm_repo dm.c
Fixes: 9a8afc8d3962 ("Network Drop Monitor: Adding drop monitor implementation & Netlink protocol")
Reported-by: "The UK's National Cyber Security Centre (NCSC)" <security@ncsc.gov.uk>
Signed-off-by: Ido Schimmel <idosch@nvidia.com>
Reviewed-by: Jacob Keller <jacob.e.keller@intel.com>
Reviewed-by: Jiri Pirko <jiri@nvidia.com>
Link: https://lore.kernel.org/r/20231206213102.1824398-3-idosch@nvidia.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
2023-12-06 23:31:02 +02:00
|
|
|
|
|
|
|
|
|
2021-02-12 15:59:59 -08:00
|
|
|
|
2025-09-05 06:57:27 -07:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2024-02-12 17:16:13 +01:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2021-02-12 15:59:59 -08:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2022-08-25 10:19:40 +02:00
|
|
|
|
2021-02-12 15:59:59 -08:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2024-02-12 17:16:13 +01:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2009-07-10 09:51:34 +00:00
|
|
|
|
|
|
|
|
|
2012-06-29 06:15:21 +00:00
|
|
|
|
|
|
|
|
|
2012-09-08 02:53:53 +00:00
|
|
|
|
2021-02-12 15:59:59 -08:00
|
|
|
|
2024-02-12 17:16:13 +01:00
|
|
|
|
2023-12-16 13:29:57 +01:00
|
|
|
|
2012-06-29 06:15:21 +00:00
|
|
|
|
|
|
|
|
|
2009-07-10 09:51:34 +00:00
|
|
|
|
2012-09-08 02:53:54 +00:00
|
|
|
|
2009-07-10 09:51:34 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2005-11-10 02:25:56 +01:00
|
|
|
|
|
|
|
|
|
2016-10-24 14:40:04 +02:00
|
|
|
|
2005-11-10 02:25:56 +01:00
|
|
|
|
2016-10-24 14:40:03 +02:00
|
|
|
|
2005-11-10 02:25:56 +01:00
|
|
|
|
2009-07-10 09:51:34 +00:00
|
|
|
|
2005-11-10 02:25:56 +01:00
|
|
|
|
2009-07-10 09:51:34 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2005-11-10 02:25:56 +01:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2009-07-10 09:51:34 +00:00
|
|
|
|
2005-11-10 02:25:56 +01:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2020-07-15 09:41:18 +02:00
|
|
|
|
2005-11-10 02:25:56 +01:00
|
|
|
|
2024-10-11 17:12:17 +00:00
|
|
|
|
2009-07-10 09:51:34 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2018-02-06 14:48:32 +01:00
|
|
|
|
2009-07-10 09:51:34 +00:00
|
|
|
|
|
|
|
|
|
2024-10-11 17:12:17 +00:00
|
|
|
|
2009-07-10 09:51:34 +00:00
|
|
|
|
|
|
|
|
|
2024-10-11 17:12:17 +00:00
|
|
|
|
2009-07-10 09:51:34 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2024-10-11 17:12:17 +00:00
|
|
|
|
2018-02-06 14:48:32 +01:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2009-07-10 09:51:34 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2024-10-11 17:12:17 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2009-07-10 09:51:34 +00:00
|
|
|
|
2018-02-06 14:48:32 +01:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2018-03-14 21:10:23 +01:00
|
|
|
|
2018-02-06 14:48:32 +01:00
|
|
|
|
2009-07-10 09:51:34 +00:00
|
|
|
|
2024-10-11 17:12:17 +00:00
|
|
|
|
|
|
|
|
|
2009-07-10 09:51:34 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2016-10-24 14:40:04 +02:00
|
|
|
|
|
|
|
|
|
2024-10-11 17:12:17 +00:00
|
|
|
|
2009-07-10 09:51:34 +00:00
|
|
|
|
genetlink: free the skb on 'group >= family->n_mcgrps'
These methods generally consume ownership of the provided skb, so even
if an error path is encountered, the skb is freed. This is because the
very first thing they do after some initial setup is to unconditionally
consume the skb via consume_skb(skb). Any subsequent errors lead to the
core netlink layer freeing the skb.
However, there is one check that occurs before ownership is passed,
which is the check for the group index. So if this error condition is
encountered, then the skb is leaked. This error condition is generally
considered a violation of the netlink API, so it's not expected to occur
under normal circumstances. For the same reason, no callers check for
this error condition, and no callers need to be adjusted. However, we
should still follow the same ownership semantics of the rest of the
function. Thus, free the skb in this codepath.
Suggested-by: Andrew Lunn <andrew@lunn.ch>
Suggested-by: Matthew Maurer <mmaurer@google.com>
Fixes: 2a94fe48f32c ("genetlink: make multicast groups const, prevent abuse")
Link: https://lore.kernel.org/r/845b36ba-7b3a-41f2-acb2-b284f253e2ca@lunn.ch
Signed-off-by: Alice Ryhl <aliceryhl@google.com>
Link: https://patch.msgid.link/20260506-genlmsg-return-v2-1-a63ee2a055d6@google.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
2026-05-06 20:07:13 +00:00
|
|
|
|
|
|
|
|
|
2013-11-19 15:19:39 +01:00
|
|
|
|
genetlink: free the skb on 'group >= family->n_mcgrps'
These methods generally consume ownership of the provided skb, so even
if an error path is encountered, the skb is freed. This is because the
very first thing they do after some initial setup is to unconditionally
consume the skb via consume_skb(skb). Any subsequent errors lead to the
core netlink layer freeing the skb.
However, there is one check that occurs before ownership is passed,
which is the check for the group index. So if this error condition is
encountered, then the skb is leaked. This error condition is generally
considered a violation of the netlink API, so it's not expected to occur
under normal circumstances. For the same reason, no callers check for
this error condition, and no callers need to be adjusted. However, we
should still follow the same ownership semantics of the rest of the
function. Thus, free the skb in this codepath.
Suggested-by: Andrew Lunn <andrew@lunn.ch>
Suggested-by: Matthew Maurer <mmaurer@google.com>
Fixes: 2a94fe48f32c ("genetlink: make multicast groups const, prevent abuse")
Link: https://lore.kernel.org/r/845b36ba-7b3a-41f2-acb2-b284f253e2ca@lunn.ch
Signed-off-by: Alice Ryhl <aliceryhl@google.com>
Link: https://patch.msgid.link/20260506-genlmsg-return-v2-1-a63ee2a055d6@google.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
2026-05-06 20:07:13 +00:00
|
|
|
|
2021-07-27 11:41:41 +08:00
|
|
|
|
2013-11-19 15:19:39 +01:00
|
|
|
|
2024-10-11 17:12:17 +00:00
|
|
|
|
2009-07-10 09:51:34 +00:00
|
|
|
|
|
|
|
|
|
2011-11-10 19:14:37 -08:00
|
|
|
|
2016-10-24 14:40:04 +02:00
|
|
|
|
2015-09-22 18:56:43 +02:00
|
|
|
|
2011-11-10 19:14:37 -08:00
|
|
|
|
2015-09-22 18:56:43 +02:00
|
|
|
|
2011-11-10 19:14:37 -08:00
|
|
|
|
|
|
|
|
|
genetlink: free the skb on 'group >= family->n_mcgrps'
These methods generally consume ownership of the provided skb, so even
if an error path is encountered, the skb is freed. This is because the
very first thing they do after some initial setup is to unconditionally
consume the skb via consume_skb(skb). Any subsequent errors lead to the
core netlink layer freeing the skb.
However, there is one check that occurs before ownership is passed,
which is the check for the group index. So if this error condition is
encountered, then the skb is leaked. This error condition is generally
considered a violation of the netlink API, so it's not expected to occur
under normal circumstances. For the same reason, no callers check for
this error condition, and no callers need to be adjusted. However, we
should still follow the same ownership semantics of the rest of the
function. Thus, free the skb in this codepath.
Suggested-by: Andrew Lunn <andrew@lunn.ch>
Suggested-by: Matthew Maurer <mmaurer@google.com>
Fixes: 2a94fe48f32c ("genetlink: make multicast groups const, prevent abuse")
Link: https://lore.kernel.org/r/845b36ba-7b3a-41f2-acb2-b284f253e2ca@lunn.ch
Signed-off-by: Alice Ryhl <aliceryhl@google.com>
Link: https://patch.msgid.link/20260506-genlmsg-return-v2-1-a63ee2a055d6@google.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
2026-05-06 20:07:13 +00:00
|
|
|
|
|
|
|
|
|
2013-11-19 15:19:39 +01:00
|
|
|
|
genetlink: free the skb on 'group >= family->n_mcgrps'
These methods generally consume ownership of the provided skb, so even
if an error path is encountered, the skb is freed. This is because the
very first thing they do after some initial setup is to unconditionally
consume the skb via consume_skb(skb). Any subsequent errors lead to the
core netlink layer freeing the skb.
However, there is one check that occurs before ownership is passed,
which is the check for the group index. So if this error condition is
encountered, then the skb is leaked. This error condition is generally
considered a violation of the netlink API, so it's not expected to occur
under normal circumstances. For the same reason, no callers check for
this error condition, and no callers need to be adjusted. However, we
should still follow the same ownership semantics of the rest of the
function. Thus, free the skb in this codepath.
Suggested-by: Andrew Lunn <andrew@lunn.ch>
Suggested-by: Matthew Maurer <mmaurer@google.com>
Fixes: 2a94fe48f32c ("genetlink: make multicast groups const, prevent abuse")
Link: https://lore.kernel.org/r/845b36ba-7b3a-41f2-acb2-b284f253e2ca@lunn.ch
Signed-off-by: Alice Ryhl <aliceryhl@google.com>
Link: https://patch.msgid.link/20260506-genlmsg-return-v2-1-a63ee2a055d6@google.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
2026-05-06 20:07:13 +00:00
|
|
|
|
2021-07-27 11:41:41 +08:00
|
|
|
|
2013-11-19 15:19:39 +01:00
|
|
|
|
2021-07-27 11:41:41 +08:00
|
|
|
|
|
|
|
|
|
2011-11-10 19:14:37 -08:00
|
|
|
|
|
|
|
|
|