Kernel
Threads by month
- ----- 2025 -----
- May
- April
- March
- February
- January
- ----- 2024 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2023 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2022 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2021 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2020 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2019 -----
- December
- 38 participants
- 18142 discussions

[PATCH openEuler-1.0-LTS 1/2] dm btree spine: remove paranoid node_check call in node_prep_for_write()
by Yongqiang Liu 28 Jul '22
by Yongqiang Liu 28 Jul '22
28 Jul '22
From: Joe Thornber <ejt(a)redhat.com>
mainline inclusion
from mainline-v5.13-rc1
commit f73e2e70ec48c9a9d45494c4866230a5059062ad
category: bugfix
bugzilla: https://gitee.com/openeuler/kernel/issues/I5JCAH
CVE: NA
--------------------------------
Remove this extra BUG_ON() that calls node_check() -- which avoids extra crc checking.
Signed-off-by: Joe Thornber <ejt(a)redhat.com>
Signed-off-by: Mike Snitzer <snitzer(a)redhat.com>
Signed-off-by: Zhang Xiaoxu <zhangxiaoxu5(a)huawei.com>
Reviewed-by: Hou Tao <houtao1(a)huawei.com>
Reviewed-by: Jason Yan <yanaijie(a)huawei.com>
Signed-off-by: Yongqiang Liu <liuyongqiang13(a)huawei.com>
---
drivers/md/persistent-data/dm-btree-spine.c | 2 --
1 file changed, 2 deletions(-)
diff --git a/drivers/md/persistent-data/dm-btree-spine.c b/drivers/md/persistent-data/dm-btree-spine.c
index b27b8091a1ca..52f11a7bad92 100644
--- a/drivers/md/persistent-data/dm-btree-spine.c
+++ b/drivers/md/persistent-data/dm-btree-spine.c
@@ -30,8 +30,6 @@ static void node_prepare_for_write(struct dm_block_validator *v,
h->csum = cpu_to_le32(dm_bm_checksum(&h->flags,
block_size - sizeof(__le32),
BTREE_CSUM_XOR));
-
- BUG_ON(node_check(v, b, 4096));
}
static int node_check(struct dm_block_validator *v,
--
2.25.1
1
1
Add script for check patch header, including inclusion, commit,
category, bugzilla sections.
Signed-off-by: Zheng Zengkai <zhengzengkai(a)huawei.com>
---
pr_checkformat.py | 166 ++++++++++++++++++++++++++++++++++++++++++++++
1 file changed, 166 insertions(+)
create mode 100644 pr_checkformat.py
diff --git a/pr_checkformat.py b/pr_checkformat.py
new file mode 100644
index 000000000000..9a799fe290d9
--- /dev/null
+++ b/pr_checkformat.py
@@ -0,0 +1,166 @@
+#!/usr/bin/python3
+
+import os
+import re
+import sys
+import subprocess
+import shlex
+
+def exec_shell(cmd, workdir = None):
+ p = subprocess.Popen(shlex.split(cmd), stdin = subprocess.PIPE, stdout = subprocess.PIPE,
+ stderr = subprocess.PIPE, cwd = workdir)
+ output, err = p.communicate(timeout = 180)
+ return p.returncode, str(output, 'utf-8'), str(err, 'utf-8')
+
+commit_format = {
+ "[Backport]":
+ [
+ [
+ [r'mainline inclusion\n' ,r''],
+ [r'from mainline(-v\d*\.\d*-rc\d*)?\n' ,r'miss "from mainline"'],
+ [r'commit [a-f0-9]{40}\n' ,r'miss commit or commit-id not 40char'],
+ [r'(category: .*\n)?' ,r''],
+ [r'bugzilla: .*\n' ,r'miss bugzilla'],
+ [r'(CVE: CVE-\d{4}-\d+\n)?' ,r''],
+ [r'\n' ,r'miss \n'],
+ [r'(Reference: .*\n)+' ,r'miss Reference'],
+ [r'\n' ,r'miss \n'],
+ [r'-{16,80}\n' ,r'miss parting line 16~80 "-"'],
+ [r'\n' ,r'miss \n'],
+ ],
+ [
+ [r'stable inclusion\n' ,r''],
+ [r'from stable-v\d*\.\d*\.\d*\n' ,r'miss "from stable"'],
+ [r'commit [a-f0-9]{40}\n' ,r'miss commit or commit-id not 40char'],
+ [r'(category: .*\n)?' ,r''],
+ [r'bugzilla: .*\n' ,r'miss bugzilla'],
+ [r'(CVE: CVE-\d{4}-\d+\n)?' ,r''],
+ [r'\n' ,r'miss \n'],
+ [r'(Reference: .*\n)+' ,r'miss Reference'],
+ [r'\n' ,r'miss \n'],
+ [r'-{16,80}\n' ,r'miss parting line 16~80 "-"'],
+ [r'\n' ,r'miss \n'],
+ ],
+ [
+ [r'.* inclusion\n' ,r'miss inclusion'],
+ [r'(category: .*\n)?' ,r''],
+ [r'bugzilla: .*\n' ,r'miss bugzilla'],
+ [r'(CVE: CVE-\d{4}-\d+\n)?' ,r''],
+ [r'\n' ,r'miss \n'],
+ [r'(Reference: .*\n)+' ,r'miss Reference'],
+ [r'\n' ,r'miss \n'],
+ [r'-{16,80}\n' ,r'miss parting line 16~80 "-"'],
+ [r'\n' ,r'miss \n'],
+ ],
+
+ ],
+ }
+
+def check_employee_id(body):
+ m = re.findall(r'Signed-off-by.*\n', body)
+ if len(m) == 0:
+ return False, "miss Signed-off-by\n"
+ else:
+ for sig in m:
+ __m = re.findall(r'Signed-off-by.*[a-zA-Z][0-9]{8}.*(a)huawei.com', sig)
+ if __m:
+ return False, "incorrect Signed-off-by: %s\n"%(__m);
+
+ m = re.findall(r'Reviewed-by.*\n', body)
+ for rew in m:
+ __m = re.findall(r'Reviewed-by.*[a-zA-Z][0-9]{8}.*(a)huawei.com', rew)
+ if __m:
+ return False, "incorrect Reviewed-by: %s\n"%(__m);
+
+ m = re.findall(r'Author:.*\n', body)
+ for author in m:
+ __m = re.findall(r'Author.*[a-zA-Z][0-9]{8}.*(a)huawei.com', author)
+ if __m:
+ return False, "incorrect author: %s\n"%(__m);
+
+ return True, ""
+
+def format_print(__format, line):
+ description = ""
+ for i in range(0, len(__format)):
+ __line = __format[i][0].replace("\\n","")
+ if i == line:
+ __line += "\t<------" + __format[i][1]
+ description += __line + "\n"
+ return description
+
+def match_format(__format, body):
+ regex = r''
+ match = False
+
+ for i in range(0, len(__format)):
+ regex = regex + __format[i][0]
+ m = re.match(regex, body)
+ if not m:
+ return match, format_print(__format, i)
+ match = True
+
+ return True, ""
+
+def error_description(description):
+ return description
+
+def do_checkformat(patch, workdir = None):
+ commit = patch.split(" ")[0]
+
+ description = ""
+
+ #check subject begin with hw
+ subject = exec_shell('git log --pretty=%s -n 1 %s'%('%s', commit), workdir)[1]
+ subject_type = subject.split(" ")[0]
+ if not subject_type in commit_format:
+ description = "subject should be begin with "
+ for __subject_type in commit_format:
+ description = description + __subject_type + ","
+ return False, error_description(description)
+
+ #check Sig/Review/Author has Job number
+ body = exec_shell('git log -n 1 %s'%(commit), workdir)[1]
+ ret, description = check_employee_id(body)
+ if ret == False:
+ return False, error_description(description)
+
+ #check commit message header
+ body = exec_shell('git log --pretty=%s -n 1 %s'%('%b', commit), workdir)[1]
+ for __format in commit_format[subject_type]:
+ match, description = match_format(__format, body)
+ if match == True:
+ if description == "":
+ return True, "checkformat success"
+ else:
+ return False, error_description(description)
+
+ #not match any template
+ description = "do not match any template!\n"
+ for __subject_type in commit_format:
+ description = description + __subject_type
+ for __format in commit_format[__subject_type]:
+ description += "^^^^^^^^^^\n"
+ description += format_print(__format, -1)
+ description = description + "^^^^^^^^^^\n"
+ return False, error_description(description)
+
+def main():
+ ForT = True
+ tag=sys.argv[1]
+ patches = os.popen("git log --oneline " + tag + "..HEAD").readlines()
+ for patch in patches:
+ ret, description = do_checkformat(patch)
+ if ret == False:
+ print("check " + patch + " failed")
+ print(description)
+ ForT = False
+ if ForT == False:
+ return False
+
+ print("check " + str(len(patches)) + " patch(es) success")
+ return True
+
+if __name__ == "__main__":
+ # execute only if run as a script
+ main()
--
2.20.1
1
0
From: Zheng Zengkai <zhengzengkai(a)huawei.com>
Rust for openEuler
Boqun Feng (1):
kallsyms: avoid hardcoding the buffer size
Gary Guo (2):
rust: add `build_error` crate
vsprintf: add new `%pA` format specifier
Miguel Ojeda (17):
kallsyms: support "big" kernel symbols
kallsyms: increase maximum kernel symbol length to 512
rust: add C helpers
rust: add `compiler_builtins` crate
rust: import upstream `alloc` crate
rust: adapt `alloc` crate to the kernel
rust: add `macros` crate
rust: export generated symbols
scripts: checkpatch: diagnose uses of `%pA` in the C side
scripts: checkpatch: enable language-independent checks for Rust
scripts: add `rustdoc_test_{builder,gen}.py` scripts
scripts: add `generate_rust_analyzer.py` scripts
scripts: decode_stacktrace: demangle Rust symbols
docs: add Rust documentation
Kbuild: add Rust support
samples: add Rust examples
MAINTAINERS: Rust
Wedson Almeida Filho (3):
rust: add `kernel` crate's `sync` module
rust: add `kernel` crate
drivers: gpio: PrimeCell PL061 in Rust
Weilong Chen (1):
Adaptation of rust for openEuler
.gitignore | 5 +
.rustfmt.toml | 12 +
Documentation/core-api/printk-formats.rst | 10 +
Documentation/doc-guide/kernel-doc.rst | 3 +
Documentation/index.rst | 1 +
Documentation/kbuild/kbuild.rst | 17 +
Documentation/kbuild/makefiles.rst | 50 +-
Documentation/process/changes.rst | 41 +
Documentation/rust/arch-support.rst | 25 +
Documentation/rust/coding-guidelines.rst | 216 ++
Documentation/rust/general-information.rst | 79 +
Documentation/rust/index.rst | 22 +
Documentation/rust/quick-start.rst | 232 ++
MAINTAINERS | 15 +
Makefile | 176 +-
arch/Kconfig | 6 +
arch/arm/Kconfig | 1 +
arch/arm64/Kconfig | 1 +
arch/powerpc/Kconfig | 1 +
arch/riscv/Kconfig | 1 +
arch/riscv/Makefile | 5 +
arch/um/Kconfig | 1 +
arch/x86/Kconfig | 1 +
arch/x86/Makefile | 13 +
drivers/gpio/Kconfig | 8 +
drivers/gpio/Makefile | 1 +
drivers/gpio/gpio_pl061_rust.rs | 370 ++
include/linux/kallsyms.h | 2 +-
include/linux/spinlock.h | 25 +-
init/Kconfig | 42 +
kernel/kallsyms.c | 26 +-
kernel/livepatch/core.c | 4 +-
lib/Kconfig.debug | 155 +
lib/vsprintf.c | 13 +
rust/.gitignore | 10 +
rust/Makefile | 398 +++
rust/alloc/README.md | 33 +
rust/alloc/alloc.rs | 440 +++
rust/alloc/borrow.rs | 498 +++
rust/alloc/boxed.rs | 2026 +++++++++++
rust/alloc/boxed/thin.rs | 217 ++
rust/alloc/collections/mod.rs | 156 +
rust/alloc/fmt.rs | 614 ++++
rust/alloc/lib.rs | 239 ++
rust/alloc/macros.rs | 128 +
rust/alloc/raw_vec.rs | 567 +++
rust/alloc/slice.rs | 1295 +++++++
rust/alloc/str.rs | 641 ++++
rust/alloc/string.rs | 2944 +++++++++++++++
rust/alloc/vec/drain.rs | 186 +
rust/alloc/vec/drain_filter.rs | 145 +
rust/alloc/vec/into_iter.rs | 356 ++
rust/alloc/vec/is_zero.rs | 106 +
rust/alloc/vec/mod.rs | 3362 ++++++++++++++++++
rust/alloc/vec/partial_eq.rs | 49 +
rust/alloc/vec/set_len_on_drop.rs | 30 +
rust/alloc/vec/spec_extend.rs | 174 +
rust/bindgen_parameters | 17 +
rust/build_error.rs | 29 +
rust/compiler_builtins.rs | 79 +
rust/exports.c | 20 +
rust/helpers.c | 644 ++++
rust/kernel/allocator.rs | 65 +
rust/kernel/amba.rs | 258 ++
rust/kernel/bindings.rs | 47 +
rust/kernel/bindings_helper.h | 46 +
rust/kernel/build_assert.rs | 82 +
rust/kernel/c_types.rs | 119 +
rust/kernel/chrdev.rs | 207 ++
rust/kernel/clk.rs | 79 +
rust/kernel/cred.rs | 46 +
rust/kernel/device.rs | 546 +++
rust/kernel/driver.rs | 442 +++
rust/kernel/error.rs | 565 +++
rust/kernel/file.rs | 864 +++++
rust/kernel/gpio.rs | 478 +++
rust/kernel/hwrng.rs | 242 ++
rust/kernel/io_buffer.rs | 153 +
rust/kernel/io_mem.rs | 275 ++
rust/kernel/iov_iter.rs | 81 +
rust/kernel/irq.rs | 411 +++
rust/kernel/kasync.rs | 6 +
rust/kernel/kasync/net.rs | 322 ++
rust/kernel/kunit.rs | 91 +
rust/kernel/lib.rs | 261 ++
rust/kernel/linked_list.rs | 247 ++
rust/kernel/miscdev.rs | 291 ++
rust/kernel/mm.rs | 149 +
rust/kernel/module_param.rs | 498 +++
rust/kernel/net.rs | 391 ++
rust/kernel/net/filter.rs | 447 +++
rust/kernel/of.rs | 63 +
rust/kernel/pages.rs | 144 +
rust/kernel/platform.rs | 223 ++
rust/kernel/power.rs | 118 +
rust/kernel/prelude.rs | 36 +
rust/kernel/print.rs | 405 +++
rust/kernel/random.rs | 42 +
rust/kernel/raw_list.rs | 361 ++
rust/kernel/rbtree.rs | 563 +++
rust/kernel/revocable.rs | 161 +
rust/kernel/security.rs | 38 +
rust/kernel/static_assert.rs | 38 +
rust/kernel/std_vendor.rs | 160 +
rust/kernel/str.rs | 597 ++++
rust/kernel/sync.rs | 161 +
rust/kernel/sync/arc.rs | 503 +++
rust/kernel/sync/condvar.rs | 138 +
rust/kernel/sync/guard.rs | 169 +
rust/kernel/sync/locked_by.rs | 111 +
rust/kernel/sync/mutex.rs | 153 +
rust/kernel/sync/nowait.rs | 188 +
rust/kernel/sync/revocable.rs | 250 ++
rust/kernel/sync/rwsem.rs | 197 +
rust/kernel/sync/seqlock.rs | 202 ++
rust/kernel/sync/smutex.rs | 295 ++
rust/kernel/sync/spinlock.rs | 360 ++
rust/kernel/sysctl.rs | 199 ++
rust/kernel/task.rs | 175 +
rust/kernel/types.rs | 679 ++++
rust/kernel/user_ptr.rs | 175 +
rust/macros/helpers.rs | 79 +
rust/macros/lib.rs | 94 +
rust/macros/module.rs | 631 ++++
samples/Kconfig | 2 +
samples/Makefile | 1 +
samples/rust/Kconfig | 140 +
samples/rust/Makefile | 15 +
samples/rust/hostprogs/.gitignore | 3 +
samples/rust/hostprogs/Makefile | 5 +
samples/rust/hostprogs/a.rs | 7 +
samples/rust/hostprogs/b.rs | 5 +
samples/rust/hostprogs/single.rs | 12 +
samples/rust/rust_chrdev.rs | 50 +
samples/rust/rust_minimal.rs | 35 +
samples/rust/rust_miscdev.rs | 143 +
samples/rust/rust_module_parameters.rs | 69 +
samples/rust/rust_netfilter.rs | 54 +
samples/rust/rust_platform.rs | 22 +
samples/rust/rust_print.rs | 54 +
samples/rust/rust_random.rs | 60 +
samples/rust/rust_semaphore.rs | 171 +
samples/rust/rust_semaphore_c.c | 212 ++
samples/rust/rust_stack_probing.rs | 36 +
samples/rust/rust_sync.rs | 93 +
scripts/Kconfig.include | 2 +-
scripts/Makefile | 3 +
scripts/Makefile.build | 60 +
scripts/Makefile.host | 34 +-
scripts/Makefile.lib | 12 +
scripts/cc-version.sh | 72 +
scripts/checkpatch.pl | 8 +-
scripts/decode_stacktrace.sh | 14 +
scripts/generate_rust_analyzer.py | 134 +
scripts/generate_rust_target.rs | 227 ++
scripts/is_rust_module.sh | 13 +
scripts/kallsyms.c | 47 +-
scripts/kconfig/confdata.c | 156 +-
scripts/min-tool-version.sh | 43 +
scripts/rust-is-available-bindgen-libclang.h | 2 +
scripts/rust-is-available.sh | 158 +
scripts/rustdoc_test_builder.py | 59 +
scripts/rustdoc_test_gen.py | 164 +
tools/include/linux/kallsyms.h | 2 +-
tools/lib/perf/include/perf/event.h | 2 +-
tools/lib/symbol/kallsyms.h | 2 +-
166 files changed, 34760 insertions(+), 43 deletions(-)
create mode 100644 .rustfmt.toml
create mode 100644 Documentation/rust/arch-support.rst
create mode 100644 Documentation/rust/coding-guidelines.rst
create mode 100644 Documentation/rust/general-information.rst
create mode 100644 Documentation/rust/index.rst
create mode 100644 Documentation/rust/quick-start.rst
create mode 100644 drivers/gpio/gpio_pl061_rust.rs
create mode 100644 rust/.gitignore
create mode 100644 rust/Makefile
create mode 100644 rust/alloc/README.md
create mode 100644 rust/alloc/alloc.rs
create mode 100644 rust/alloc/borrow.rs
create mode 100644 rust/alloc/boxed.rs
create mode 100644 rust/alloc/boxed/thin.rs
create mode 100644 rust/alloc/collections/mod.rs
create mode 100644 rust/alloc/fmt.rs
create mode 100644 rust/alloc/lib.rs
create mode 100644 rust/alloc/macros.rs
create mode 100644 rust/alloc/raw_vec.rs
create mode 100644 rust/alloc/slice.rs
create mode 100644 rust/alloc/str.rs
create mode 100644 rust/alloc/string.rs
create mode 100644 rust/alloc/vec/drain.rs
create mode 100644 rust/alloc/vec/drain_filter.rs
create mode 100644 rust/alloc/vec/into_iter.rs
create mode 100644 rust/alloc/vec/is_zero.rs
create mode 100644 rust/alloc/vec/mod.rs
create mode 100644 rust/alloc/vec/partial_eq.rs
create mode 100644 rust/alloc/vec/set_len_on_drop.rs
create mode 100644 rust/alloc/vec/spec_extend.rs
create mode 100644 rust/bindgen_parameters
create mode 100644 rust/build_error.rs
create mode 100644 rust/compiler_builtins.rs
create mode 100644 rust/exports.c
create mode 100644 rust/helpers.c
create mode 100644 rust/kernel/allocator.rs
create mode 100644 rust/kernel/amba.rs
create mode 100644 rust/kernel/bindings.rs
create mode 100644 rust/kernel/bindings_helper.h
create mode 100644 rust/kernel/build_assert.rs
create mode 100644 rust/kernel/c_types.rs
create mode 100644 rust/kernel/chrdev.rs
create mode 100644 rust/kernel/clk.rs
create mode 100644 rust/kernel/cred.rs
create mode 100644 rust/kernel/device.rs
create mode 100644 rust/kernel/driver.rs
create mode 100644 rust/kernel/error.rs
create mode 100644 rust/kernel/file.rs
create mode 100644 rust/kernel/gpio.rs
create mode 100644 rust/kernel/hwrng.rs
create mode 100644 rust/kernel/io_buffer.rs
create mode 100644 rust/kernel/io_mem.rs
create mode 100644 rust/kernel/iov_iter.rs
create mode 100644 rust/kernel/irq.rs
create mode 100644 rust/kernel/kasync.rs
create mode 100644 rust/kernel/kasync/net.rs
create mode 100644 rust/kernel/kunit.rs
create mode 100644 rust/kernel/lib.rs
create mode 100644 rust/kernel/linked_list.rs
create mode 100644 rust/kernel/miscdev.rs
create mode 100644 rust/kernel/mm.rs
create mode 100644 rust/kernel/module_param.rs
create mode 100644 rust/kernel/net.rs
create mode 100644 rust/kernel/net/filter.rs
create mode 100644 rust/kernel/of.rs
create mode 100644 rust/kernel/pages.rs
create mode 100644 rust/kernel/platform.rs
create mode 100644 rust/kernel/power.rs
create mode 100644 rust/kernel/prelude.rs
create mode 100644 rust/kernel/print.rs
create mode 100644 rust/kernel/random.rs
create mode 100644 rust/kernel/raw_list.rs
create mode 100644 rust/kernel/rbtree.rs
create mode 100644 rust/kernel/revocable.rs
create mode 100644 rust/kernel/security.rs
create mode 100644 rust/kernel/static_assert.rs
create mode 100644 rust/kernel/std_vendor.rs
create mode 100644 rust/kernel/str.rs
create mode 100644 rust/kernel/sync.rs
create mode 100644 rust/kernel/sync/arc.rs
create mode 100644 rust/kernel/sync/condvar.rs
create mode 100644 rust/kernel/sync/guard.rs
create mode 100644 rust/kernel/sync/locked_by.rs
create mode 100644 rust/kernel/sync/mutex.rs
create mode 100644 rust/kernel/sync/nowait.rs
create mode 100644 rust/kernel/sync/revocable.rs
create mode 100644 rust/kernel/sync/rwsem.rs
create mode 100644 rust/kernel/sync/seqlock.rs
create mode 100644 rust/kernel/sync/smutex.rs
create mode 100644 rust/kernel/sync/spinlock.rs
create mode 100644 rust/kernel/sysctl.rs
create mode 100644 rust/kernel/task.rs
create mode 100644 rust/kernel/types.rs
create mode 100644 rust/kernel/user_ptr.rs
create mode 100644 rust/macros/helpers.rs
create mode 100644 rust/macros/lib.rs
create mode 100644 rust/macros/module.rs
create mode 100644 samples/rust/Kconfig
create mode 100644 samples/rust/Makefile
create mode 100644 samples/rust/hostprogs/.gitignore
create mode 100644 samples/rust/hostprogs/Makefile
create mode 100644 samples/rust/hostprogs/a.rs
create mode 100644 samples/rust/hostprogs/b.rs
create mode 100644 samples/rust/hostprogs/single.rs
create mode 100644 samples/rust/rust_chrdev.rs
create mode 100644 samples/rust/rust_minimal.rs
create mode 100644 samples/rust/rust_miscdev.rs
create mode 100644 samples/rust/rust_module_parameters.rs
create mode 100644 samples/rust/rust_netfilter.rs
create mode 100644 samples/rust/rust_platform.rs
create mode 100644 samples/rust/rust_print.rs
create mode 100644 samples/rust/rust_random.rs
create mode 100644 samples/rust/rust_semaphore.rs
create mode 100644 samples/rust/rust_semaphore_c.c
create mode 100644 samples/rust/rust_stack_probing.rs
create mode 100644 samples/rust/rust_sync.rs
create mode 100755 scripts/cc-version.sh
create mode 100755 scripts/generate_rust_analyzer.py
create mode 100644 scripts/generate_rust_target.rs
create mode 100755 scripts/is_rust_module.sh
create mode 100755 scripts/min-tool-version.sh
create mode 100644 scripts/rust-is-available-bindgen-libclang.h
create mode 100755 scripts/rust-is-available.sh
create mode 100755 scripts/rustdoc_test_builder.py
create mode 100755 scripts/rustdoc_test_gen.py
--
2.20.1
1
24
From: Zheng Zengkai <zhengzengkai(a)huawei.com>
Rust for openEuler
Boqun Feng (1):
kallsyms: avoid hardcoding the buffer size
Gary Guo (2):
rust: add `build_error` crate
vsprintf: add new `%pA` format specifier
Miguel Ojeda (17):
kallsyms: support "big" kernel symbols
kallsyms: increase maximum kernel symbol length to 512
rust: add C helpers
rust: add `compiler_builtins` crate
rust: import upstream `alloc` crate
rust: adapt `alloc` crate to the kernel
rust: add `macros` crate
rust: export generated symbols
scripts: checkpatch: diagnose uses of `%pA` in the C side
scripts: checkpatch: enable language-independent checks for Rust
scripts: add `rustdoc_test_{builder,gen}.py` scripts
scripts: add `generate_rust_analyzer.py` scripts
scripts: decode_stacktrace: demangle Rust symbols
docs: add Rust documentation
Kbuild: add Rust support
samples: add Rust examples
MAINTAINERS: Rust
Wedson Almeida Filho (3):
rust: add `kernel` crate's `sync` module
rust: add `kernel` crate
drivers: gpio: PrimeCell PL061 in Rust
Weilong Chen (1):
Adaptation of rust for openEuler
.gitignore | 5 +
.rustfmt.toml | 12 +
Documentation/core-api/printk-formats.rst | 10 +
Documentation/doc-guide/kernel-doc.rst | 3 +
Documentation/index.rst | 1 +
Documentation/kbuild/kbuild.rst | 17 +
Documentation/kbuild/makefiles.rst | 50 +-
Documentation/process/changes.rst | 41 +
Documentation/rust/arch-support.rst | 25 +
Documentation/rust/coding-guidelines.rst | 216 ++
Documentation/rust/general-information.rst | 79 +
Documentation/rust/index.rst | 22 +
Documentation/rust/quick-start.rst | 232 ++
MAINTAINERS | 15 +
Makefile | 176 +-
arch/Kconfig | 6 +
arch/arm/Kconfig | 1 +
arch/arm64/Kconfig | 1 +
arch/powerpc/Kconfig | 1 +
arch/riscv/Kconfig | 1 +
arch/riscv/Makefile | 5 +
arch/um/Kconfig | 1 +
arch/x86/Kconfig | 1 +
arch/x86/Makefile | 13 +
drivers/gpio/Kconfig | 8 +
drivers/gpio/Makefile | 1 +
drivers/gpio/gpio_pl061_rust.rs | 370 ++
include/linux/kallsyms.h | 2 +-
include/linux/spinlock.h | 25 +-
init/Kconfig | 42 +
kernel/kallsyms.c | 26 +-
kernel/livepatch/core.c | 4 +-
lib/Kconfig.debug | 155 +
lib/vsprintf.c | 13 +
rust/.gitignore | 10 +
rust/Makefile | 398 +++
rust/alloc/README.md | 33 +
rust/alloc/alloc.rs | 440 +++
rust/alloc/borrow.rs | 498 +++
rust/alloc/boxed.rs | 2026 +++++++++++
rust/alloc/boxed/thin.rs | 217 ++
rust/alloc/collections/mod.rs | 156 +
rust/alloc/fmt.rs | 614 ++++
rust/alloc/lib.rs | 239 ++
rust/alloc/macros.rs | 128 +
rust/alloc/raw_vec.rs | 567 +++
rust/alloc/slice.rs | 1295 +++++++
rust/alloc/str.rs | 641 ++++
rust/alloc/string.rs | 2944 +++++++++++++++
rust/alloc/vec/drain.rs | 186 +
rust/alloc/vec/drain_filter.rs | 145 +
rust/alloc/vec/into_iter.rs | 356 ++
rust/alloc/vec/is_zero.rs | 106 +
rust/alloc/vec/mod.rs | 3362 ++++++++++++++++++
rust/alloc/vec/partial_eq.rs | 49 +
rust/alloc/vec/set_len_on_drop.rs | 30 +
rust/alloc/vec/spec_extend.rs | 174 +
rust/bindgen_parameters | 17 +
rust/build_error.rs | 29 +
rust/compiler_builtins.rs | 79 +
rust/exports.c | 20 +
rust/helpers.c | 644 ++++
rust/kernel/allocator.rs | 65 +
rust/kernel/amba.rs | 258 ++
rust/kernel/bindings.rs | 47 +
rust/kernel/bindings_helper.h | 46 +
rust/kernel/build_assert.rs | 82 +
rust/kernel/c_types.rs | 119 +
rust/kernel/chrdev.rs | 207 ++
rust/kernel/clk.rs | 79 +
rust/kernel/cred.rs | 46 +
rust/kernel/device.rs | 546 +++
rust/kernel/driver.rs | 442 +++
rust/kernel/error.rs | 565 +++
rust/kernel/file.rs | 864 +++++
rust/kernel/gpio.rs | 478 +++
rust/kernel/hwrng.rs | 242 ++
rust/kernel/io_buffer.rs | 153 +
rust/kernel/io_mem.rs | 275 ++
rust/kernel/iov_iter.rs | 81 +
rust/kernel/irq.rs | 411 +++
rust/kernel/kasync.rs | 6 +
rust/kernel/kasync/net.rs | 322 ++
rust/kernel/kunit.rs | 91 +
rust/kernel/lib.rs | 261 ++
rust/kernel/linked_list.rs | 247 ++
rust/kernel/miscdev.rs | 291 ++
rust/kernel/mm.rs | 149 +
rust/kernel/module_param.rs | 498 +++
rust/kernel/net.rs | 391 ++
rust/kernel/net/filter.rs | 447 +++
rust/kernel/of.rs | 63 +
rust/kernel/pages.rs | 144 +
rust/kernel/platform.rs | 223 ++
rust/kernel/power.rs | 118 +
rust/kernel/prelude.rs | 36 +
rust/kernel/print.rs | 405 +++
rust/kernel/random.rs | 42 +
rust/kernel/raw_list.rs | 361 ++
rust/kernel/rbtree.rs | 563 +++
rust/kernel/revocable.rs | 161 +
rust/kernel/security.rs | 38 +
rust/kernel/static_assert.rs | 38 +
rust/kernel/std_vendor.rs | 160 +
rust/kernel/str.rs | 597 ++++
rust/kernel/sync.rs | 161 +
rust/kernel/sync/arc.rs | 503 +++
rust/kernel/sync/condvar.rs | 138 +
rust/kernel/sync/guard.rs | 169 +
rust/kernel/sync/locked_by.rs | 111 +
rust/kernel/sync/mutex.rs | 153 +
rust/kernel/sync/nowait.rs | 188 +
rust/kernel/sync/revocable.rs | 250 ++
rust/kernel/sync/rwsem.rs | 197 +
rust/kernel/sync/seqlock.rs | 202 ++
rust/kernel/sync/smutex.rs | 295 ++
rust/kernel/sync/spinlock.rs | 360 ++
rust/kernel/sysctl.rs | 199 ++
rust/kernel/task.rs | 175 +
rust/kernel/types.rs | 679 ++++
rust/kernel/user_ptr.rs | 175 +
rust/macros/helpers.rs | 79 +
rust/macros/lib.rs | 94 +
rust/macros/module.rs | 631 ++++
samples/Kconfig | 2 +
samples/Makefile | 1 +
samples/rust/Kconfig | 140 +
samples/rust/Makefile | 15 +
samples/rust/hostprogs/.gitignore | 3 +
samples/rust/hostprogs/Makefile | 5 +
samples/rust/hostprogs/a.rs | 7 +
samples/rust/hostprogs/b.rs | 5 +
samples/rust/hostprogs/single.rs | 12 +
samples/rust/rust_chrdev.rs | 50 +
samples/rust/rust_minimal.rs | 35 +
samples/rust/rust_miscdev.rs | 143 +
samples/rust/rust_module_parameters.rs | 69 +
samples/rust/rust_netfilter.rs | 54 +
samples/rust/rust_platform.rs | 22 +
samples/rust/rust_print.rs | 54 +
samples/rust/rust_random.rs | 60 +
samples/rust/rust_semaphore.rs | 171 +
samples/rust/rust_semaphore_c.c | 212 ++
samples/rust/rust_stack_probing.rs | 36 +
samples/rust/rust_sync.rs | 93 +
scripts/Kconfig.include | 2 +-
scripts/Makefile | 3 +
scripts/Makefile.build | 60 +
scripts/Makefile.host | 34 +-
scripts/Makefile.lib | 12 +
scripts/cc-version.sh | 72 +
scripts/checkpatch.pl | 8 +-
scripts/decode_stacktrace.sh | 14 +
scripts/generate_rust_analyzer.py | 134 +
scripts/generate_rust_target.rs | 227 ++
scripts/is_rust_module.sh | 13 +
scripts/kallsyms.c | 47 +-
scripts/kconfig/confdata.c | 156 +-
scripts/min-tool-version.sh | 43 +
scripts/rust-is-available-bindgen-libclang.h | 2 +
scripts/rust-is-available.sh | 158 +
scripts/rustdoc_test_builder.py | 59 +
scripts/rustdoc_test_gen.py | 164 +
tools/include/linux/kallsyms.h | 2 +-
tools/lib/perf/include/perf/event.h | 2 +-
tools/lib/symbol/kallsyms.h | 2 +-
166 files changed, 34760 insertions(+), 43 deletions(-)
create mode 100644 .rustfmt.toml
create mode 100644 Documentation/rust/arch-support.rst
create mode 100644 Documentation/rust/coding-guidelines.rst
create mode 100644 Documentation/rust/general-information.rst
create mode 100644 Documentation/rust/index.rst
create mode 100644 Documentation/rust/quick-start.rst
create mode 100644 drivers/gpio/gpio_pl061_rust.rs
create mode 100644 rust/.gitignore
create mode 100644 rust/Makefile
create mode 100644 rust/alloc/README.md
create mode 100644 rust/alloc/alloc.rs
create mode 100644 rust/alloc/borrow.rs
create mode 100644 rust/alloc/boxed.rs
create mode 100644 rust/alloc/boxed/thin.rs
create mode 100644 rust/alloc/collections/mod.rs
create mode 100644 rust/alloc/fmt.rs
create mode 100644 rust/alloc/lib.rs
create mode 100644 rust/alloc/macros.rs
create mode 100644 rust/alloc/raw_vec.rs
create mode 100644 rust/alloc/slice.rs
create mode 100644 rust/alloc/str.rs
create mode 100644 rust/alloc/string.rs
create mode 100644 rust/alloc/vec/drain.rs
create mode 100644 rust/alloc/vec/drain_filter.rs
create mode 100644 rust/alloc/vec/into_iter.rs
create mode 100644 rust/alloc/vec/is_zero.rs
create mode 100644 rust/alloc/vec/mod.rs
create mode 100644 rust/alloc/vec/partial_eq.rs
create mode 100644 rust/alloc/vec/set_len_on_drop.rs
create mode 100644 rust/alloc/vec/spec_extend.rs
create mode 100644 rust/bindgen_parameters
create mode 100644 rust/build_error.rs
create mode 100644 rust/compiler_builtins.rs
create mode 100644 rust/exports.c
create mode 100644 rust/helpers.c
create mode 100644 rust/kernel/allocator.rs
create mode 100644 rust/kernel/amba.rs
create mode 100644 rust/kernel/bindings.rs
create mode 100644 rust/kernel/bindings_helper.h
create mode 100644 rust/kernel/build_assert.rs
create mode 100644 rust/kernel/c_types.rs
create mode 100644 rust/kernel/chrdev.rs
create mode 100644 rust/kernel/clk.rs
create mode 100644 rust/kernel/cred.rs
create mode 100644 rust/kernel/device.rs
create mode 100644 rust/kernel/driver.rs
create mode 100644 rust/kernel/error.rs
create mode 100644 rust/kernel/file.rs
create mode 100644 rust/kernel/gpio.rs
create mode 100644 rust/kernel/hwrng.rs
create mode 100644 rust/kernel/io_buffer.rs
create mode 100644 rust/kernel/io_mem.rs
create mode 100644 rust/kernel/iov_iter.rs
create mode 100644 rust/kernel/irq.rs
create mode 100644 rust/kernel/kasync.rs
create mode 100644 rust/kernel/kasync/net.rs
create mode 100644 rust/kernel/kunit.rs
create mode 100644 rust/kernel/lib.rs
create mode 100644 rust/kernel/linked_list.rs
create mode 100644 rust/kernel/miscdev.rs
create mode 100644 rust/kernel/mm.rs
create mode 100644 rust/kernel/module_param.rs
create mode 100644 rust/kernel/net.rs
create mode 100644 rust/kernel/net/filter.rs
create mode 100644 rust/kernel/of.rs
create mode 100644 rust/kernel/pages.rs
create mode 100644 rust/kernel/platform.rs
create mode 100644 rust/kernel/power.rs
create mode 100644 rust/kernel/prelude.rs
create mode 100644 rust/kernel/print.rs
create mode 100644 rust/kernel/random.rs
create mode 100644 rust/kernel/raw_list.rs
create mode 100644 rust/kernel/rbtree.rs
create mode 100644 rust/kernel/revocable.rs
create mode 100644 rust/kernel/security.rs
create mode 100644 rust/kernel/static_assert.rs
create mode 100644 rust/kernel/std_vendor.rs
create mode 100644 rust/kernel/str.rs
create mode 100644 rust/kernel/sync.rs
create mode 100644 rust/kernel/sync/arc.rs
create mode 100644 rust/kernel/sync/condvar.rs
create mode 100644 rust/kernel/sync/guard.rs
create mode 100644 rust/kernel/sync/locked_by.rs
create mode 100644 rust/kernel/sync/mutex.rs
create mode 100644 rust/kernel/sync/nowait.rs
create mode 100644 rust/kernel/sync/revocable.rs
create mode 100644 rust/kernel/sync/rwsem.rs
create mode 100644 rust/kernel/sync/seqlock.rs
create mode 100644 rust/kernel/sync/smutex.rs
create mode 100644 rust/kernel/sync/spinlock.rs
create mode 100644 rust/kernel/sysctl.rs
create mode 100644 rust/kernel/task.rs
create mode 100644 rust/kernel/types.rs
create mode 100644 rust/kernel/user_ptr.rs
create mode 100644 rust/macros/helpers.rs
create mode 100644 rust/macros/lib.rs
create mode 100644 rust/macros/module.rs
create mode 100644 samples/rust/Kconfig
create mode 100644 samples/rust/Makefile
create mode 100644 samples/rust/hostprogs/.gitignore
create mode 100644 samples/rust/hostprogs/Makefile
create mode 100644 samples/rust/hostprogs/a.rs
create mode 100644 samples/rust/hostprogs/b.rs
create mode 100644 samples/rust/hostprogs/single.rs
create mode 100644 samples/rust/rust_chrdev.rs
create mode 100644 samples/rust/rust_minimal.rs
create mode 100644 samples/rust/rust_miscdev.rs
create mode 100644 samples/rust/rust_module_parameters.rs
create mode 100644 samples/rust/rust_netfilter.rs
create mode 100644 samples/rust/rust_platform.rs
create mode 100644 samples/rust/rust_print.rs
create mode 100644 samples/rust/rust_random.rs
create mode 100644 samples/rust/rust_semaphore.rs
create mode 100644 samples/rust/rust_semaphore_c.c
create mode 100644 samples/rust/rust_stack_probing.rs
create mode 100644 samples/rust/rust_sync.rs
create mode 100755 scripts/cc-version.sh
create mode 100755 scripts/generate_rust_analyzer.py
create mode 100644 scripts/generate_rust_target.rs
create mode 100755 scripts/is_rust_module.sh
create mode 100755 scripts/min-tool-version.sh
create mode 100644 scripts/rust-is-available-bindgen-libclang.h
create mode 100755 scripts/rust-is-available.sh
create mode 100755 scripts/rustdoc_test_builder.py
create mode 100755 scripts/rustdoc_test_gen.py
--
2.20.1
1
24
From: Zheng Zengkai <zhengzengkai(a)huawei.com>
Rust for openEuler
Boqun Feng (1):
kallsyms: avoid hardcoding the buffer size
Gary Guo (2):
rust: add `build_error` crate
vsprintf: add new `%pA` format specifier
Miguel Ojeda (17):
kallsyms: support "big" kernel symbols
kallsyms: increase maximum kernel symbol length to 512
rust: add C helpers
rust: add `compiler_builtins` crate
rust: import upstream `alloc` crate
rust: adapt `alloc` crate to the kernel
rust: add `macros` crate
rust: export generated symbols
scripts: checkpatch: diagnose uses of `%pA` in the C side
scripts: checkpatch: enable language-independent checks for Rust
scripts: add `rustdoc_test_{builder,gen}.py` scripts
scripts: add `generate_rust_analyzer.py` scripts
scripts: decode_stacktrace: demangle Rust symbols
docs: add Rust documentation
Kbuild: add Rust support
samples: add Rust examples
MAINTAINERS: Rust
Wedson Almeida Filho (3):
rust: add `kernel` crate's `sync` module
rust: add `kernel` crate
drivers: gpio: PrimeCell PL061 in Rust
Weilong Chen (1):
Adaptation of rust for openEuler
.gitignore | 5 +
.rustfmt.toml | 12 +
Documentation/core-api/printk-formats.rst | 10 +
Documentation/doc-guide/kernel-doc.rst | 3 +
Documentation/index.rst | 1 +
Documentation/kbuild/kbuild.rst | 17 +
Documentation/kbuild/makefiles.rst | 50 +-
Documentation/process/changes.rst | 41 +
Documentation/rust/arch-support.rst | 25 +
Documentation/rust/coding-guidelines.rst | 216 ++
Documentation/rust/general-information.rst | 79 +
Documentation/rust/index.rst | 22 +
Documentation/rust/quick-start.rst | 232 ++
MAINTAINERS | 15 +
Makefile | 176 +-
arch/Kconfig | 6 +
arch/arm/Kconfig | 1 +
arch/arm64/Kconfig | 1 +
arch/powerpc/Kconfig | 1 +
arch/riscv/Kconfig | 1 +
arch/riscv/Makefile | 5 +
arch/um/Kconfig | 1 +
arch/x86/Kconfig | 1 +
arch/x86/Makefile | 13 +
drivers/gpio/Kconfig | 8 +
drivers/gpio/Makefile | 1 +
drivers/gpio/gpio_pl061_rust.rs | 370 ++
include/linux/kallsyms.h | 2 +-
include/linux/spinlock.h | 25 +-
init/Kconfig | 42 +
kernel/kallsyms.c | 26 +-
kernel/livepatch/core.c | 4 +-
lib/Kconfig.debug | 155 +
lib/vsprintf.c | 13 +
rust/.gitignore | 10 +
rust/Makefile | 398 +++
rust/alloc/README.md | 33 +
rust/alloc/alloc.rs | 440 +++
rust/alloc/borrow.rs | 498 +++
rust/alloc/boxed.rs | 2026 +++++++++++
rust/alloc/boxed/thin.rs | 217 ++
rust/alloc/collections/mod.rs | 156 +
rust/alloc/fmt.rs | 614 ++++
rust/alloc/lib.rs | 239 ++
rust/alloc/macros.rs | 128 +
rust/alloc/raw_vec.rs | 567 +++
rust/alloc/slice.rs | 1295 +++++++
rust/alloc/str.rs | 641 ++++
rust/alloc/string.rs | 2944 +++++++++++++++
rust/alloc/vec/drain.rs | 186 +
rust/alloc/vec/drain_filter.rs | 145 +
rust/alloc/vec/into_iter.rs | 356 ++
rust/alloc/vec/is_zero.rs | 106 +
rust/alloc/vec/mod.rs | 3362 ++++++++++++++++++
rust/alloc/vec/partial_eq.rs | 49 +
rust/alloc/vec/set_len_on_drop.rs | 30 +
rust/alloc/vec/spec_extend.rs | 174 +
rust/bindgen_parameters | 17 +
rust/build_error.rs | 29 +
rust/compiler_builtins.rs | 79 +
rust/exports.c | 20 +
rust/helpers.c | 644 ++++
rust/kernel/allocator.rs | 65 +
rust/kernel/amba.rs | 258 ++
rust/kernel/bindings.rs | 47 +
rust/kernel/bindings_helper.h | 46 +
rust/kernel/build_assert.rs | 82 +
rust/kernel/c_types.rs | 119 +
rust/kernel/chrdev.rs | 207 ++
rust/kernel/clk.rs | 79 +
rust/kernel/cred.rs | 46 +
rust/kernel/device.rs | 546 +++
rust/kernel/driver.rs | 442 +++
rust/kernel/error.rs | 565 +++
rust/kernel/file.rs | 864 +++++
rust/kernel/gpio.rs | 478 +++
rust/kernel/hwrng.rs | 242 ++
rust/kernel/io_buffer.rs | 153 +
rust/kernel/io_mem.rs | 275 ++
rust/kernel/iov_iter.rs | 81 +
rust/kernel/irq.rs | 411 +++
rust/kernel/kasync.rs | 6 +
rust/kernel/kasync/net.rs | 322 ++
rust/kernel/kunit.rs | 91 +
rust/kernel/lib.rs | 261 ++
rust/kernel/linked_list.rs | 247 ++
rust/kernel/miscdev.rs | 291 ++
rust/kernel/mm.rs | 149 +
rust/kernel/module_param.rs | 498 +++
rust/kernel/net.rs | 391 ++
rust/kernel/net/filter.rs | 447 +++
rust/kernel/of.rs | 63 +
rust/kernel/pages.rs | 144 +
rust/kernel/platform.rs | 223 ++
rust/kernel/power.rs | 118 +
rust/kernel/prelude.rs | 36 +
rust/kernel/print.rs | 405 +++
rust/kernel/random.rs | 42 +
rust/kernel/raw_list.rs | 361 ++
rust/kernel/rbtree.rs | 563 +++
rust/kernel/revocable.rs | 161 +
rust/kernel/security.rs | 38 +
rust/kernel/static_assert.rs | 38 +
rust/kernel/std_vendor.rs | 160 +
rust/kernel/str.rs | 597 ++++
rust/kernel/sync.rs | 161 +
rust/kernel/sync/arc.rs | 503 +++
rust/kernel/sync/condvar.rs | 138 +
rust/kernel/sync/guard.rs | 169 +
rust/kernel/sync/locked_by.rs | 111 +
rust/kernel/sync/mutex.rs | 153 +
rust/kernel/sync/nowait.rs | 188 +
rust/kernel/sync/revocable.rs | 250 ++
rust/kernel/sync/rwsem.rs | 197 +
rust/kernel/sync/seqlock.rs | 202 ++
rust/kernel/sync/smutex.rs | 295 ++
rust/kernel/sync/spinlock.rs | 360 ++
rust/kernel/sysctl.rs | 199 ++
rust/kernel/task.rs | 175 +
rust/kernel/types.rs | 679 ++++
rust/kernel/user_ptr.rs | 175 +
rust/macros/helpers.rs | 79 +
rust/macros/lib.rs | 94 +
rust/macros/module.rs | 631 ++++
samples/Kconfig | 2 +
samples/Makefile | 1 +
samples/rust/Kconfig | 140 +
samples/rust/Makefile | 15 +
samples/rust/hostprogs/.gitignore | 3 +
samples/rust/hostprogs/Makefile | 5 +
samples/rust/hostprogs/a.rs | 7 +
samples/rust/hostprogs/b.rs | 5 +
samples/rust/hostprogs/single.rs | 12 +
samples/rust/rust_chrdev.rs | 50 +
samples/rust/rust_minimal.rs | 35 +
samples/rust/rust_miscdev.rs | 143 +
samples/rust/rust_module_parameters.rs | 69 +
samples/rust/rust_netfilter.rs | 54 +
samples/rust/rust_platform.rs | 22 +
samples/rust/rust_print.rs | 54 +
samples/rust/rust_random.rs | 60 +
samples/rust/rust_semaphore.rs | 171 +
samples/rust/rust_semaphore_c.c | 212 ++
samples/rust/rust_stack_probing.rs | 36 +
samples/rust/rust_sync.rs | 93 +
scripts/Kconfig.include | 2 +-
scripts/Makefile | 3 +
scripts/Makefile.build | 60 +
scripts/Makefile.host | 34 +-
scripts/Makefile.lib | 12 +
scripts/cc-version.sh | 72 +
scripts/checkpatch.pl | 8 +-
scripts/decode_stacktrace.sh | 14 +
scripts/generate_rust_analyzer.py | 134 +
scripts/generate_rust_target.rs | 227 ++
scripts/is_rust_module.sh | 13 +
scripts/kallsyms.c | 47 +-
scripts/kconfig/confdata.c | 156 +-
scripts/min-tool-version.sh | 43 +
scripts/rust-is-available-bindgen-libclang.h | 2 +
scripts/rust-is-available.sh | 158 +
scripts/rustdoc_test_builder.py | 59 +
scripts/rustdoc_test_gen.py | 164 +
tools/include/linux/kallsyms.h | 2 +-
tools/lib/perf/include/perf/event.h | 2 +-
tools/lib/symbol/kallsyms.h | 2 +-
166 files changed, 34760 insertions(+), 43 deletions(-)
create mode 100644 .rustfmt.toml
create mode 100644 Documentation/rust/arch-support.rst
create mode 100644 Documentation/rust/coding-guidelines.rst
create mode 100644 Documentation/rust/general-information.rst
create mode 100644 Documentation/rust/index.rst
create mode 100644 Documentation/rust/quick-start.rst
create mode 100644 drivers/gpio/gpio_pl061_rust.rs
create mode 100644 rust/.gitignore
create mode 100644 rust/Makefile
create mode 100644 rust/alloc/README.md
create mode 100644 rust/alloc/alloc.rs
create mode 100644 rust/alloc/borrow.rs
create mode 100644 rust/alloc/boxed.rs
create mode 100644 rust/alloc/boxed/thin.rs
create mode 100644 rust/alloc/collections/mod.rs
create mode 100644 rust/alloc/fmt.rs
create mode 100644 rust/alloc/lib.rs
create mode 100644 rust/alloc/macros.rs
create mode 100644 rust/alloc/raw_vec.rs
create mode 100644 rust/alloc/slice.rs
create mode 100644 rust/alloc/str.rs
create mode 100644 rust/alloc/string.rs
create mode 100644 rust/alloc/vec/drain.rs
create mode 100644 rust/alloc/vec/drain_filter.rs
create mode 100644 rust/alloc/vec/into_iter.rs
create mode 100644 rust/alloc/vec/is_zero.rs
create mode 100644 rust/alloc/vec/mod.rs
create mode 100644 rust/alloc/vec/partial_eq.rs
create mode 100644 rust/alloc/vec/set_len_on_drop.rs
create mode 100644 rust/alloc/vec/spec_extend.rs
create mode 100644 rust/bindgen_parameters
create mode 100644 rust/build_error.rs
create mode 100644 rust/compiler_builtins.rs
create mode 100644 rust/exports.c
create mode 100644 rust/helpers.c
create mode 100644 rust/kernel/allocator.rs
create mode 100644 rust/kernel/amba.rs
create mode 100644 rust/kernel/bindings.rs
create mode 100644 rust/kernel/bindings_helper.h
create mode 100644 rust/kernel/build_assert.rs
create mode 100644 rust/kernel/c_types.rs
create mode 100644 rust/kernel/chrdev.rs
create mode 100644 rust/kernel/clk.rs
create mode 100644 rust/kernel/cred.rs
create mode 100644 rust/kernel/device.rs
create mode 100644 rust/kernel/driver.rs
create mode 100644 rust/kernel/error.rs
create mode 100644 rust/kernel/file.rs
create mode 100644 rust/kernel/gpio.rs
create mode 100644 rust/kernel/hwrng.rs
create mode 100644 rust/kernel/io_buffer.rs
create mode 100644 rust/kernel/io_mem.rs
create mode 100644 rust/kernel/iov_iter.rs
create mode 100644 rust/kernel/irq.rs
create mode 100644 rust/kernel/kasync.rs
create mode 100644 rust/kernel/kasync/net.rs
create mode 100644 rust/kernel/kunit.rs
create mode 100644 rust/kernel/lib.rs
create mode 100644 rust/kernel/linked_list.rs
create mode 100644 rust/kernel/miscdev.rs
create mode 100644 rust/kernel/mm.rs
create mode 100644 rust/kernel/module_param.rs
create mode 100644 rust/kernel/net.rs
create mode 100644 rust/kernel/net/filter.rs
create mode 100644 rust/kernel/of.rs
create mode 100644 rust/kernel/pages.rs
create mode 100644 rust/kernel/platform.rs
create mode 100644 rust/kernel/power.rs
create mode 100644 rust/kernel/prelude.rs
create mode 100644 rust/kernel/print.rs
create mode 100644 rust/kernel/random.rs
create mode 100644 rust/kernel/raw_list.rs
create mode 100644 rust/kernel/rbtree.rs
create mode 100644 rust/kernel/revocable.rs
create mode 100644 rust/kernel/security.rs
create mode 100644 rust/kernel/static_assert.rs
create mode 100644 rust/kernel/std_vendor.rs
create mode 100644 rust/kernel/str.rs
create mode 100644 rust/kernel/sync.rs
create mode 100644 rust/kernel/sync/arc.rs
create mode 100644 rust/kernel/sync/condvar.rs
create mode 100644 rust/kernel/sync/guard.rs
create mode 100644 rust/kernel/sync/locked_by.rs
create mode 100644 rust/kernel/sync/mutex.rs
create mode 100644 rust/kernel/sync/nowait.rs
create mode 100644 rust/kernel/sync/revocable.rs
create mode 100644 rust/kernel/sync/rwsem.rs
create mode 100644 rust/kernel/sync/seqlock.rs
create mode 100644 rust/kernel/sync/smutex.rs
create mode 100644 rust/kernel/sync/spinlock.rs
create mode 100644 rust/kernel/sysctl.rs
create mode 100644 rust/kernel/task.rs
create mode 100644 rust/kernel/types.rs
create mode 100644 rust/kernel/user_ptr.rs
create mode 100644 rust/macros/helpers.rs
create mode 100644 rust/macros/lib.rs
create mode 100644 rust/macros/module.rs
create mode 100644 samples/rust/Kconfig
create mode 100644 samples/rust/Makefile
create mode 100644 samples/rust/hostprogs/.gitignore
create mode 100644 samples/rust/hostprogs/Makefile
create mode 100644 samples/rust/hostprogs/a.rs
create mode 100644 samples/rust/hostprogs/b.rs
create mode 100644 samples/rust/hostprogs/single.rs
create mode 100644 samples/rust/rust_chrdev.rs
create mode 100644 samples/rust/rust_minimal.rs
create mode 100644 samples/rust/rust_miscdev.rs
create mode 100644 samples/rust/rust_module_parameters.rs
create mode 100644 samples/rust/rust_netfilter.rs
create mode 100644 samples/rust/rust_platform.rs
create mode 100644 samples/rust/rust_print.rs
create mode 100644 samples/rust/rust_random.rs
create mode 100644 samples/rust/rust_semaphore.rs
create mode 100644 samples/rust/rust_semaphore_c.c
create mode 100644 samples/rust/rust_stack_probing.rs
create mode 100644 samples/rust/rust_sync.rs
create mode 100755 scripts/cc-version.sh
create mode 100755 scripts/generate_rust_analyzer.py
create mode 100644 scripts/generate_rust_target.rs
create mode 100755 scripts/is_rust_module.sh
create mode 100755 scripts/min-tool-version.sh
create mode 100644 scripts/rust-is-available-bindgen-libclang.h
create mode 100755 scripts/rust-is-available.sh
create mode 100755 scripts/rustdoc_test_builder.py
create mode 100755 scripts/rustdoc_test_gen.py
--
2.20.1
1
24

27 Jul '22
From: Jan Kara <jack(a)suse.cz>
hulk inclusion
category: bugfix
bugzilla: 186975, https://gitee.com/openeuler/kernel/issues/I5HT6F
CVE: NA
Reference: https://patchwork.ozlabs.org/project/linux-ext4/list/?series=309169
--------------------------------
Do not reclaim entries that are currently used by somebody from a
shrinker. Firstly, these entries are likely useful. Secondly, we will
need to keep such entries to protect pending increment of xattr block
refcount.
CC: stable(a)vger.kernel.org
Fixes: 82939d7999df ("ext4: convert to mbcache2")
Signed-off-by: Jan Kara <jack(a)suse.cz>
Signed-off-by: Zhihao Cheng <chengzhihao1(a)huawei.com>
Reviewed-by: Zhang Yi <yi.zhang(a)huawei.com>
Signed-off-by: Yongqiang Liu <liuyongqiang13(a)huawei.com>
---
fs/mbcache.c | 10 +++++++++-
1 file changed, 9 insertions(+), 1 deletion(-)
diff --git a/fs/mbcache.c b/fs/mbcache.c
index 081ccf0caee3..12203e5a91e7 100644
--- a/fs/mbcache.c
+++ b/fs/mbcache.c
@@ -287,7 +287,7 @@ static unsigned long mb_cache_shrink(struct mb_cache *cache,
while (nr_to_scan-- && !list_empty(&cache->c_list)) {
entry = list_first_entry(&cache->c_list,
struct mb_cache_entry, e_list);
- if (entry->e_referenced) {
+ if (entry->e_referenced || atomic_read(&entry->e_refcnt) > 2) {
entry->e_referenced = 0;
list_move_tail(&entry->e_list, &cache->c_list);
continue;
@@ -301,6 +301,14 @@ static unsigned long mb_cache_shrink(struct mb_cache *cache,
spin_unlock(&cache->c_list_lock);
head = mb_cache_entry_head(cache, entry->e_key);
hlist_bl_lock(head);
+ /* Now a reliable check if the entry didn't get used... */
+ if (atomic_read(&entry->e_refcnt) > 2) {
+ hlist_bl_unlock(head);
+ spin_lock(&cache->c_list_lock);
+ list_add_tail(&entry->e_list, &cache->c_list);
+ cache->c_entry_count++;
+ continue;
+ }
if (!hlist_bl_unhashed(&entry->e_hash_list)) {
hlist_bl_del_init(&entry->e_hash_list);
atomic_dec(&entry->e_refcnt);
--
2.25.1
1
4
From: Zheng Zengkai <zhengzengkai(a)huawei.com>
Rust for openEuler
Boqun Feng (1):
kallsyms: avoid hardcoding the buffer size
Gary Guo (2):
rust: add `build_error` crate
vsprintf: add new `%pA` format specifier
Miguel Ojeda (17):
kallsyms: support "big" kernel symbols
kallsyms: increase maximum kernel symbol length to 512
rust: add C helpers
rust: add `compiler_builtins` crate
rust: import upstream `alloc` crate
rust: adapt `alloc` crate to the kernel
rust: add `macros` crate
rust: export generated symbols
scripts: checkpatch: diagnose uses of `%pA` in the C side
scripts: checkpatch: enable language-independent checks for Rust
scripts: add `rustdoc_test_{builder,gen}.py` scripts
scripts: add `generate_rust_analyzer.py` scripts
scripts: decode_stacktrace: demangle Rust symbols
docs: add Rust documentation
Kbuild: add Rust support
samples: add Rust examples
MAINTAINERS: Rust
Wedson Almeida Filho (3):
rust: add `kernel` crate's `sync` module
rust: add `kernel` crate
drivers: gpio: PrimeCell PL061 in Rust
Weilong Chen (1):
Adaptation of rust for openEuler
.gitignore | 5 +
.rustfmt.toml | 12 +
Documentation/core-api/printk-formats.rst | 10 +
Documentation/doc-guide/kernel-doc.rst | 3 +
Documentation/index.rst | 1 +
Documentation/kbuild/kbuild.rst | 17 +
Documentation/kbuild/makefiles.rst | 50 +-
Documentation/process/changes.rst | 41 +
Documentation/rust/arch-support.rst | 25 +
Documentation/rust/coding-guidelines.rst | 216 ++
Documentation/rust/general-information.rst | 79 +
Documentation/rust/index.rst | 22 +
Documentation/rust/quick-start.rst | 232 ++
MAINTAINERS | 15 +
Makefile | 176 +-
arch/Kconfig | 6 +
arch/arm/Kconfig | 1 +
arch/arm64/Kconfig | 1 +
arch/powerpc/Kconfig | 1 +
arch/riscv/Kconfig | 1 +
arch/riscv/Makefile | 5 +
arch/um/Kconfig | 1 +
arch/x86/Kconfig | 1 +
arch/x86/Makefile | 13 +
drivers/gpio/Kconfig | 8 +
drivers/gpio/Makefile | 1 +
drivers/gpio/gpio_pl061_rust.rs | 370 ++
include/linux/kallsyms.h | 2 +-
include/linux/spinlock.h | 25 +-
init/Kconfig | 42 +
kernel/kallsyms.c | 26 +-
kernel/livepatch/core.c | 4 +-
lib/Kconfig.debug | 155 +
lib/vsprintf.c | 13 +
rust/.gitignore | 10 +
rust/Makefile | 398 +++
rust/alloc/README.md | 33 +
rust/alloc/alloc.rs | 440 +++
rust/alloc/borrow.rs | 498 +++
rust/alloc/boxed.rs | 2026 +++++++++++
rust/alloc/boxed/thin.rs | 217 ++
rust/alloc/collections/mod.rs | 156 +
rust/alloc/fmt.rs | 614 ++++
rust/alloc/lib.rs | 239 ++
rust/alloc/macros.rs | 128 +
rust/alloc/raw_vec.rs | 567 +++
rust/alloc/slice.rs | 1295 +++++++
rust/alloc/str.rs | 641 ++++
rust/alloc/string.rs | 2944 +++++++++++++++
rust/alloc/vec/drain.rs | 186 +
rust/alloc/vec/drain_filter.rs | 145 +
rust/alloc/vec/into_iter.rs | 356 ++
rust/alloc/vec/is_zero.rs | 106 +
rust/alloc/vec/mod.rs | 3362 ++++++++++++++++++
rust/alloc/vec/partial_eq.rs | 49 +
rust/alloc/vec/set_len_on_drop.rs | 30 +
rust/alloc/vec/spec_extend.rs | 174 +
rust/bindgen_parameters | 17 +
rust/build_error.rs | 29 +
rust/compiler_builtins.rs | 79 +
rust/exports.c | 20 +
rust/helpers.c | 644 ++++
rust/kernel/allocator.rs | 65 +
rust/kernel/amba.rs | 258 ++
rust/kernel/bindings.rs | 47 +
rust/kernel/bindings_helper.h | 46 +
rust/kernel/build_assert.rs | 82 +
rust/kernel/c_types.rs | 119 +
rust/kernel/chrdev.rs | 207 ++
rust/kernel/clk.rs | 79 +
rust/kernel/cred.rs | 46 +
rust/kernel/device.rs | 546 +++
rust/kernel/driver.rs | 442 +++
rust/kernel/error.rs | 565 +++
rust/kernel/file.rs | 864 +++++
rust/kernel/gpio.rs | 478 +++
rust/kernel/hwrng.rs | 242 ++
rust/kernel/io_buffer.rs | 153 +
rust/kernel/io_mem.rs | 275 ++
rust/kernel/iov_iter.rs | 81 +
rust/kernel/irq.rs | 411 +++
rust/kernel/kasync.rs | 6 +
rust/kernel/kasync/net.rs | 322 ++
rust/kernel/kunit.rs | 91 +
rust/kernel/lib.rs | 261 ++
rust/kernel/linked_list.rs | 247 ++
rust/kernel/miscdev.rs | 291 ++
rust/kernel/mm.rs | 149 +
rust/kernel/module_param.rs | 498 +++
rust/kernel/net.rs | 391 ++
rust/kernel/net/filter.rs | 447 +++
rust/kernel/of.rs | 63 +
rust/kernel/pages.rs | 144 +
rust/kernel/platform.rs | 223 ++
rust/kernel/power.rs | 118 +
rust/kernel/prelude.rs | 36 +
rust/kernel/print.rs | 405 +++
rust/kernel/random.rs | 42 +
rust/kernel/raw_list.rs | 361 ++
rust/kernel/rbtree.rs | 563 +++
rust/kernel/revocable.rs | 161 +
rust/kernel/security.rs | 38 +
rust/kernel/static_assert.rs | 38 +
rust/kernel/std_vendor.rs | 160 +
rust/kernel/str.rs | 597 ++++
rust/kernel/sync.rs | 161 +
rust/kernel/sync/arc.rs | 503 +++
rust/kernel/sync/condvar.rs | 138 +
rust/kernel/sync/guard.rs | 169 +
rust/kernel/sync/locked_by.rs | 111 +
rust/kernel/sync/mutex.rs | 153 +
rust/kernel/sync/nowait.rs | 188 +
rust/kernel/sync/revocable.rs | 250 ++
rust/kernel/sync/rwsem.rs | 197 +
rust/kernel/sync/seqlock.rs | 202 ++
rust/kernel/sync/smutex.rs | 295 ++
rust/kernel/sync/spinlock.rs | 360 ++
rust/kernel/sysctl.rs | 199 ++
rust/kernel/task.rs | 175 +
rust/kernel/types.rs | 679 ++++
rust/kernel/user_ptr.rs | 175 +
rust/macros/helpers.rs | 79 +
rust/macros/lib.rs | 94 +
rust/macros/module.rs | 631 ++++
samples/Kconfig | 2 +
samples/Makefile | 1 +
samples/rust/Kconfig | 140 +
samples/rust/Makefile | 15 +
samples/rust/hostprogs/.gitignore | 3 +
samples/rust/hostprogs/Makefile | 5 +
samples/rust/hostprogs/a.rs | 7 +
samples/rust/hostprogs/b.rs | 5 +
samples/rust/hostprogs/single.rs | 12 +
samples/rust/rust_chrdev.rs | 50 +
samples/rust/rust_minimal.rs | 35 +
samples/rust/rust_miscdev.rs | 143 +
samples/rust/rust_module_parameters.rs | 69 +
samples/rust/rust_netfilter.rs | 54 +
samples/rust/rust_platform.rs | 22 +
samples/rust/rust_print.rs | 54 +
samples/rust/rust_random.rs | 60 +
samples/rust/rust_semaphore.rs | 171 +
samples/rust/rust_semaphore_c.c | 212 ++
samples/rust/rust_stack_probing.rs | 36 +
samples/rust/rust_sync.rs | 93 +
scripts/Kconfig.include | 2 +-
scripts/Makefile | 3 +
scripts/Makefile.build | 60 +
scripts/Makefile.host | 34 +-
scripts/Makefile.lib | 12 +
scripts/cc-version.sh | 72 +
scripts/checkpatch.pl | 8 +-
scripts/decode_stacktrace.sh | 14 +
scripts/generate_rust_analyzer.py | 134 +
scripts/generate_rust_target.rs | 227 ++
scripts/is_rust_module.sh | 13 +
scripts/kallsyms.c | 47 +-
scripts/kconfig/confdata.c | 156 +-
scripts/min-tool-version.sh | 43 +
scripts/rust-is-available-bindgen-libclang.h | 2 +
scripts/rust-is-available.sh | 158 +
scripts/rustdoc_test_builder.py | 59 +
scripts/rustdoc_test_gen.py | 164 +
tools/include/linux/kallsyms.h | 2 +-
tools/lib/perf/include/perf/event.h | 2 +-
tools/lib/symbol/kallsyms.h | 2 +-
166 files changed, 34760 insertions(+), 43 deletions(-)
create mode 100644 .rustfmt.toml
create mode 100644 Documentation/rust/arch-support.rst
create mode 100644 Documentation/rust/coding-guidelines.rst
create mode 100644 Documentation/rust/general-information.rst
create mode 100644 Documentation/rust/index.rst
create mode 100644 Documentation/rust/quick-start.rst
create mode 100644 drivers/gpio/gpio_pl061_rust.rs
create mode 100644 rust/.gitignore
create mode 100644 rust/Makefile
create mode 100644 rust/alloc/README.md
create mode 100644 rust/alloc/alloc.rs
create mode 100644 rust/alloc/borrow.rs
create mode 100644 rust/alloc/boxed.rs
create mode 100644 rust/alloc/boxed/thin.rs
create mode 100644 rust/alloc/collections/mod.rs
create mode 100644 rust/alloc/fmt.rs
create mode 100644 rust/alloc/lib.rs
create mode 100644 rust/alloc/macros.rs
create mode 100644 rust/alloc/raw_vec.rs
create mode 100644 rust/alloc/slice.rs
create mode 100644 rust/alloc/str.rs
create mode 100644 rust/alloc/string.rs
create mode 100644 rust/alloc/vec/drain.rs
create mode 100644 rust/alloc/vec/drain_filter.rs
create mode 100644 rust/alloc/vec/into_iter.rs
create mode 100644 rust/alloc/vec/is_zero.rs
create mode 100644 rust/alloc/vec/mod.rs
create mode 100644 rust/alloc/vec/partial_eq.rs
create mode 100644 rust/alloc/vec/set_len_on_drop.rs
create mode 100644 rust/alloc/vec/spec_extend.rs
create mode 100644 rust/bindgen_parameters
create mode 100644 rust/build_error.rs
create mode 100644 rust/compiler_builtins.rs
create mode 100644 rust/exports.c
create mode 100644 rust/helpers.c
create mode 100644 rust/kernel/allocator.rs
create mode 100644 rust/kernel/amba.rs
create mode 100644 rust/kernel/bindings.rs
create mode 100644 rust/kernel/bindings_helper.h
create mode 100644 rust/kernel/build_assert.rs
create mode 100644 rust/kernel/c_types.rs
create mode 100644 rust/kernel/chrdev.rs
create mode 100644 rust/kernel/clk.rs
create mode 100644 rust/kernel/cred.rs
create mode 100644 rust/kernel/device.rs
create mode 100644 rust/kernel/driver.rs
create mode 100644 rust/kernel/error.rs
create mode 100644 rust/kernel/file.rs
create mode 100644 rust/kernel/gpio.rs
create mode 100644 rust/kernel/hwrng.rs
create mode 100644 rust/kernel/io_buffer.rs
create mode 100644 rust/kernel/io_mem.rs
create mode 100644 rust/kernel/iov_iter.rs
create mode 100644 rust/kernel/irq.rs
create mode 100644 rust/kernel/kasync.rs
create mode 100644 rust/kernel/kasync/net.rs
create mode 100644 rust/kernel/kunit.rs
create mode 100644 rust/kernel/lib.rs
create mode 100644 rust/kernel/linked_list.rs
create mode 100644 rust/kernel/miscdev.rs
create mode 100644 rust/kernel/mm.rs
create mode 100644 rust/kernel/module_param.rs
create mode 100644 rust/kernel/net.rs
create mode 100644 rust/kernel/net/filter.rs
create mode 100644 rust/kernel/of.rs
create mode 100644 rust/kernel/pages.rs
create mode 100644 rust/kernel/platform.rs
create mode 100644 rust/kernel/power.rs
create mode 100644 rust/kernel/prelude.rs
create mode 100644 rust/kernel/print.rs
create mode 100644 rust/kernel/random.rs
create mode 100644 rust/kernel/raw_list.rs
create mode 100644 rust/kernel/rbtree.rs
create mode 100644 rust/kernel/revocable.rs
create mode 100644 rust/kernel/security.rs
create mode 100644 rust/kernel/static_assert.rs
create mode 100644 rust/kernel/std_vendor.rs
create mode 100644 rust/kernel/str.rs
create mode 100644 rust/kernel/sync.rs
create mode 100644 rust/kernel/sync/arc.rs
create mode 100644 rust/kernel/sync/condvar.rs
create mode 100644 rust/kernel/sync/guard.rs
create mode 100644 rust/kernel/sync/locked_by.rs
create mode 100644 rust/kernel/sync/mutex.rs
create mode 100644 rust/kernel/sync/nowait.rs
create mode 100644 rust/kernel/sync/revocable.rs
create mode 100644 rust/kernel/sync/rwsem.rs
create mode 100644 rust/kernel/sync/seqlock.rs
create mode 100644 rust/kernel/sync/smutex.rs
create mode 100644 rust/kernel/sync/spinlock.rs
create mode 100644 rust/kernel/sysctl.rs
create mode 100644 rust/kernel/task.rs
create mode 100644 rust/kernel/types.rs
create mode 100644 rust/kernel/user_ptr.rs
create mode 100644 rust/macros/helpers.rs
create mode 100644 rust/macros/lib.rs
create mode 100644 rust/macros/module.rs
create mode 100644 samples/rust/Kconfig
create mode 100644 samples/rust/Makefile
create mode 100644 samples/rust/hostprogs/.gitignore
create mode 100644 samples/rust/hostprogs/Makefile
create mode 100644 samples/rust/hostprogs/a.rs
create mode 100644 samples/rust/hostprogs/b.rs
create mode 100644 samples/rust/hostprogs/single.rs
create mode 100644 samples/rust/rust_chrdev.rs
create mode 100644 samples/rust/rust_minimal.rs
create mode 100644 samples/rust/rust_miscdev.rs
create mode 100644 samples/rust/rust_module_parameters.rs
create mode 100644 samples/rust/rust_netfilter.rs
create mode 100644 samples/rust/rust_platform.rs
create mode 100644 samples/rust/rust_print.rs
create mode 100644 samples/rust/rust_random.rs
create mode 100644 samples/rust/rust_semaphore.rs
create mode 100644 samples/rust/rust_semaphore_c.c
create mode 100644 samples/rust/rust_stack_probing.rs
create mode 100644 samples/rust/rust_sync.rs
create mode 100755 scripts/cc-version.sh
create mode 100755 scripts/generate_rust_analyzer.py
create mode 100644 scripts/generate_rust_target.rs
create mode 100755 scripts/is_rust_module.sh
create mode 100755 scripts/min-tool-version.sh
create mode 100644 scripts/rust-is-available-bindgen-libclang.h
create mode 100755 scripts/rust-is-available.sh
create mode 100755 scripts/rustdoc_test_builder.py
create mode 100755 scripts/rustdoc_test_gen.py
--
2.20.1
1
24

27 Jul '22
From: Zheng Zengkai <zhengzengkai(a)huawei.com>
This patchset aims to start a discussion about potential applications of BPF to
the scheduler. It also aims to land some very basic BPF infrastructure necessary
to add new BPF hooks to the scheduler, a minimal set of useful helpers,
corresponding libbpf changes, etc.
[Testing]
kernel options:
CONFIG_BPF_SCHED=y
CONFIG_BPF_SYSCALL=y
CONFIG_BPF_EVENTS=y
Test passed with below step:
1.cd tools/testing/selftests/bpf & make
2.run cmd: ./test_progs -t test_sched
3.it will show like this:
# ./test_progs -t test_sched
#113/1 sched_tgidpid_mode:OK
#113/2 sched_cgid_mode:OK
#113 test_sched:OK
Summary: 1/2 PASSED, 0 SKIPPED, 0 FAILED
Chen Hui (1):
sched: Move some definitions to sched.h
Ren Zhijie (1):
bpf: sched: add selftests for BPF_PROG_TYPE_SCHED
Roman Gushchin (6):
bpf: sched: basic infrastructure for scheduler bpf
bpf: sched: add convenient helpers to identify sched entities
bpf: sched: introduce bpf_sched_enable()
sched: cfs: add bpf hooks to control wakeup and tick preemption
libbpf: add support for scheduler bpf programs
bpftool: recognize scheduler programs
include/linux/bpf_sched.h | 50 ++++++
include/linux/bpf_types.h | 4 +
include/linux/sched_hook_defs.h | 5 +
include/uapi/linux/bpf.h | 25 +++
init/Kconfig | 10 ++
kernel/bpf/btf.c | 1 +
kernel/bpf/syscall.c | 20 +++
kernel/bpf/trampoline.c | 1 +
kernel/bpf/verifier.c | 11 +-
kernel/sched/Makefile | 1 +
kernel/sched/bpf_sched.c | 138 +++++++++++++++
kernel/sched/fair.c | 79 ++++-----
kernel/sched/sched.h | 52 ++++++
scripts/bpf_helpers_doc.py | 2 +
tools/bpf/bpftool/common.c | 1 +
tools/bpf/bpftool/prog.c | 1 +
tools/include/uapi/linux/bpf.h | 25 +++
tools/lib/bpf/bpf.c | 3 +-
tools/lib/bpf/libbpf.c | 33 +++-
tools/lib/bpf/libbpf.h | 4 +
tools/lib/bpf/libbpf.map | 3 +
.../selftests/bpf/prog_tests/test_sched.c | 161 +++++++++++++++++
tools/testing/selftests/bpf/progs/sched.c | 165 ++++++++++++++++++
23 files changed, 743 insertions(+), 52 deletions(-)
create mode 100644 include/linux/bpf_sched.h
create mode 100644 include/linux/sched_hook_defs.h
create mode 100644 kernel/sched/bpf_sched.c
create mode 100644 tools/testing/selftests/bpf/prog_tests/test_sched.c
create mode 100644 tools/testing/selftests/bpf/progs/sched.c
--
2.20.1
1
8

[PATCH openEuler-5.10-LTS 01/10] bpf: Don't redirect packets with invalid pkt_len
by Zheng Zengkai 26 Jul '22
by Zheng Zengkai 26 Jul '22
26 Jul '22
From: Zhengchao Shao <shaozhengchao(a)huawei.com>
mainline inclusion
from mainline-v5.19-rc6
commit fd1894224407c484f652ad456e1ce423e89bb3eb
category: bugfix
bugzilla: https://gitee.com/openeuler/kernel/issues/I5HWKR
CVE: NA
Reference: https://git.kernel.org/pub/scm/linux/kernel/git/bpf/bpf-next.git/commit/?id…
--------------------------------
Syzbot found an issue [1]: fq_codel_drop() try to drop a flow whitout any
skbs, that is, the flow->head is null.
The root cause, as the [2] says, is because that bpf_prog_test_run_skb()
run a bpf prog which redirects empty skbs.
So we should determine whether the length of the packet modified by bpf
prog or others like bpf_prog_test is valid before forwarding it directly.
LINK: [1] https://syzkaller.appspot.com/bug?id=0b84da80c2917757915afa89f7738a9d16ec96…
LINK: [2] https://www.spinics.net/lists/netdev/msg777503.html
Reported-by: syzbot+7a12909485b94426aceb(a)syzkaller.appspotmail.com
Signed-off-by: Zhengchao Shao <shaozhengchao(a)huawei.com>
Reviewed-by: Stanislav Fomichev <sdf(a)google.com>
Link: https://lore.kernel.org/r/20220715115559.139691-1-shaozhengchao@huawei.com
Signed-off-by: Alexei Starovoitov <ast(a)kernel.org>
Reviewed-by: Wei Yongjun <weiyongjun1(a)huawei.com>
Reviewed-by: Yue Haibing <yuehaibing(a)huawei.com>
Signed-off-by: Zheng Zengkai <zhengzengkai(a)huawei.com>
---
include/linux/skbuff.h | 8 ++++++++
net/bpf/test_run.c | 3 +++
net/core/dev.c | 1 +
3 files changed, 12 insertions(+)
diff --git a/include/linux/skbuff.h b/include/linux/skbuff.h
index e5f61bdd42a8..6dae09f22c5a 100644
--- a/include/linux/skbuff.h
+++ b/include/linux/skbuff.h
@@ -2251,6 +2251,14 @@ static inline void skb_set_tail_pointer(struct sk_buff *skb, const int offset)
#endif /* NET_SKBUFF_DATA_USES_OFFSET */
+static inline void skb_assert_len(struct sk_buff *skb)
+{
+#ifdef CONFIG_DEBUG_NET
+ if (WARN_ONCE(!skb->len, "%s\n", __func__))
+ DO_ONCE_LITE(skb_dump, KERN_ERR, skb, false);
+#endif /* CONFIG_DEBUG_NET */
+}
+
/*
* Add data to an sk_buff
*/
diff --git a/net/bpf/test_run.c b/net/bpf/test_run.c
index 99712d35e535..f266a9453c8e 100644
--- a/net/bpf/test_run.c
+++ b/net/bpf/test_run.c
@@ -398,6 +398,9 @@ static int convert___skb_to_skb(struct sk_buff *skb, struct __sk_buff *__skb)
{
struct qdisc_skb_cb *cb = (struct qdisc_skb_cb *)skb->cb;
+ if (!skb->len)
+ return -EINVAL;
+
if (!__skb)
return 0;
diff --git a/net/core/dev.c b/net/core/dev.c
index 12089c484b30..8e4de36eede8 100644
--- a/net/core/dev.c
+++ b/net/core/dev.c
@@ -4094,6 +4094,7 @@ static int __dev_queue_xmit(struct sk_buff *skb, struct net_device *sb_dev)
bool again = false;
skb_reset_mac_header(skb);
+ skb_assert_len(skb);
if (unlikely(skb_shinfo(skb)->tx_flags & SKBTX_SCHED_TSTAMP))
__skb_tstamp_tx(skb, NULL, skb->sk, SCM_TSTAMP_SCHED);
--
2.20.1
1
9
Backport 5.10.113 LTS patches from upstream.
git cherry-pick v5.10.112..v5.10.113~1 -s
Complicts:
Already merged(-5):
43ce33a68e2b net/sched: cls_u32: fix netns refcount changes in u32_change()
d29c78d3f9c5 dm: fix mempool NULL pointer race when completing IO
a46b3d849864 ext4: fix symlink file size not match to file content
75ac724684b7 ext4: fix use-after-free in ext4_search_dir
572761645b88 jbd2: fix a potential race while discarding reserved buffers after
an abort
Context conflict(2):
49516e6ed914 ipv6: make ip6_rt_gc_expire an atomic_t
6b932920b96f mm, hugetlb: allow for "high" userspace addresses
Implement changed(1, cherry-picked from mainline):
ce33c845b030c tracing: Dump stacktrace trigger to the corresponding instance
Defered(-1, kabi changed):
ed5d4efb4df1 oom_kill.c: futex: delay the OOM reaper to allow time for proper
futex cleanup
kabi fixed(+1):
ipv6: fix kabi for ip6_rt_gc_expire in struct netns_ipv6
Total patches: 86 - 5 - 1 + 1 = 81
Adrian Hunter (1):
perf tools: Fix segfault accessing sample_id xyarray
Alexey Kardashevskiy (1):
KVM: PPC: Fix TCE handling for VFIO
Alistair Popple (1):
mm/mmu_notifier.c: fix race in mmu_interval_notifier_remove()
Allen-KH Cheng (1):
spi: spi-mtk-nor: initialize spi controller after resume
Anshuman Khandual (1):
arm64/mm: Remove [PUD|PMD]_TABLE_BIT from [pud|pmd]_bad()
Athira Rajeev (1):
powerpc/perf: Fix power9 event alternatives
Bob Peterson (1):
gfs2: assign rgrp glock before compute_bitstructs
Borislav Petkov (3):
ALSA: usb-audio: Fix undefined behavior due to shift overflowing the
constant
mt76: Fix undefined behavior due to shift overflowing the constant
brcmfmac: sdio: Fix undefined behavior due to shift overflowing the
constant
Christoph Hellwig (2):
nvme: add a quirk to disable namespace identifiers
nvme-pci: disable namespace identifiers for Qemu controllers
Christophe Leroy (1):
mm, hugetlb: allow for "high" userspace addresses
Daniel Bristot de Oliveira (1):
tracing: Dump stacktrace trigger to the corresponding instance
Darrick J. Wong (1):
ext4: fix fallocate to use file_modified to update permissions
consistently
Dave Jiang (2):
dmaengine: idxd: add RO check for wq max_batch_size write
dmaengine: idxd: add RO check for wq max_transfer_size write
Dave Stevenson (2):
drm/panel/raspberrypi-touchscreen: Avoid NULL deref if not initialised
drm/panel/raspberrypi-touchscreen: Initialise the bridge in prepare
David Ahern (1):
l3mdev: l3mdev_master_upper_ifindex_by_index_rcu should be using
netdev_master_upper_dev_get_rcu
David Howells (2):
rxrpc: Restore removed timer deletion
cifs: Check the IOCB_DIRECT flag, not O_DIRECT
Eric Dumazet (3):
net/sched: cls_u32: fix possible leak in u32_init_knode()
ipv6: make ip6_rt_gc_expire an atomic_t
netlink: reset network and mac headers in netlink_dump()
Guo Ren (1):
xtensa: patch_text: Fixup last cpu should be master
Hangbin Liu (1):
net/packet: fix packet_sock xmit return value checking
Hongbin Wang (1):
vxlan: fix error return code in vxlan_fdb_append
Ido Schimmel (1):
selftests: mlxsw: vxlan_flooding: Prevent flooding of unwanted packets
Jiapeng Chong (1):
platform/x86: samsung-laptop: Fix an unsigned comparison which can
never be negative
Kai-Heng Feng (1):
net: atlantic: Avoid out-of-bounds indexing
Kees Cook (2):
etherdevice: Adjust ether_addr* prototypes to silence
-Wstringop-overead
ARM: vexpress/spc: Avoid negative array index when !SMP
Kevin Hao (1):
net: stmmac: Use readl_poll_timeout_atomic() in atomic state
Khazhismel Kumykov (1):
block/compat_ioctl: fix range check in BLKGETSIZE
Lee Jones (1):
staging: ion: Prevent incorrect reference counting behavour
Leo Yan (1):
perf report: Set PERF_SAMPLE_DATA_SRC bit for Arm SPE event
Lv Ruyi (1):
dpaa_eth: Fix missing of_node_put in dpaa_get_ts_info()
Manuel Ullmann (1):
net: atlantic: invert deep par in pm functions, preventing null derefs
Marek Vasut (1):
Revert "net: micrel: fix KS8851_MLL Kconfig"
Mario Limonciello (1):
gpio: Request interrupts after IRQ is initialized
Mark Brown (1):
ASoC: atmel: Remove system clock tree configuration for at91sam9g20ek
Max Filippov (1):
xtensa: fix a7 clobbering in coprocessor context load/store
Miaoqian Lin (3):
ASoC: msm8916-wcd-digital: Check failure for
devm_snd_soc_register_component
dmaengine: imx-sdma: Fix error checking in sdma_event_remap
drm/vc4: Use pm_runtime_resume_and_get to fix pm_runtime_get_sync()
usage
Mike Christie (1):
scsi: qedi: Fix failed disconnect handling
Mikulas Patocka (1):
stat: fix inconsistency between struct stat and struct compat_stat
Muchun Song (1):
arm64: mm: fix p?d_leaf()
Oliver Hartkopp (1):
can: isotp: stop timeout monitoring when no first frame was sent
Paolo Valerio (1):
openvswitch: fix OOB access in reserve_sfa_size()
Peilin Ye (2):
ip6_gre: Avoid updating tunnel->tun_hlen in __gre6_xmit()
ip6_gre: Fix skb_under_panic in __gre6_xmit()
Rob Herring (2):
arm64: dts: imx: Fix imx8*-var-som touchscreen property sizes
arm_pmu: Validate single/group leader events
Sabrina Dubroca (1):
esp: limit skb_page_frag_refill use to a single page
Sameer Pujar (1):
reset: tegra-bpmp: Restore Handle errors in BPMP response
Sasha Neftin (3):
igc: Fix infinite loop in release_swfw_sync
igc: Fix BUG: scheduling while atomic
e1000e: Fix possible overflow in LTR decoding
Sergey Matyukevich (1):
ARC: entry: fix syscall_trace_exit argument
Shubhrajyoti Datta (1):
EDAC/synopsys: Read the error count from the correct register
Srinivas Kandagatla (1):
ASoC: codecs: wcd934x: do not switch off SIDO Buck when codec is in
use
Tadeusz Struk (1):
ext4: limit length to bitmap_maxbytes - blocksize in punch_hole
Takashi Iwai (1):
ALSA: usb-audio: Clear MIDI port active flag after draining
Theodore Ts'o (2):
ext4: fix overhead calculation to account for the reserved gdt blocks
ext4: force overhead calculation if the s_overhead_cluster makes no
sense
Tim Crawford (1):
ALSA: hda/realtek: Add quirk for Clevo NP70PNP
Tomas Melin (1):
net: macb: Restart tx only if queue pointer is lagging
Tony Lu (1):
net/smc: Fix sock leak when release after smc_shutdown()
Tudor Ambarus (1):
spi: atmel-quadspi: Fix the buswidth adjustment between spi-mem and
controller
Xiaoke Wang (1):
drm/msm/mdp5: check the return of kzalloc()
Xiaomeng Tong (2):
dma: at_xdmac: fix a missing check on list iterator
ASoC: soc-dapm: fix two incorrect uses of list iterator
Xiongwei Song (1):
mm: page_alloc: fix building error on -Werror=array-compare
Xu Jia (1):
ipv6: fix kabi for ip6_rt_gc_expire in struct netns_ipv6
Zheyu Ma (1):
ata: pata_marvell: Check the 'bmdma_addr' beforing reading
Zhipeng Xie (1):
perf/core: Fix perf_mmap fail when CONFIG_PERF_USE_VMALLOC enabled
kuyo chang (1):
sched/pelt: Fix attach_entity_load_avg() corner case
wangjianjian (C) (1):
ext4, doc: fix incorrect h_reserved size
zhangqilong (1):
dmaengine: mediatek:Fix PM usage reference leak of
mtk_uart_apdma_alloc_chan_resources
Documentation/filesystems/ext4/attributes.rst | 2 +-
arch/arc/kernel/entry.S | 1 +
arch/arm/mach-vexpress/spc.c | 2 +-
.../boot/dts/freescale/imx8mm-var-som.dtsi | 8 +--
.../boot/dts/freescale/imx8mn-var-som.dtsi | 8 +--
arch/arm64/include/asm/pgtable.h | 9 ++-
arch/powerpc/kvm/book3s_64_vio.c | 45 ++++++------
arch/powerpc/kvm/book3s_64_vio_hv.c | 44 ++++++------
arch/powerpc/perf/power9-pmu.c | 8 +--
arch/x86/include/asm/compat.h | 6 +-
arch/xtensa/kernel/coprocessor.S | 4 +-
arch/xtensa/kernel/jump_label.c | 2 +-
block/ioctl.c | 2 +-
drivers/ata/pata_marvell.c | 2 +
drivers/dma/at_xdmac.c | 12 ++--
drivers/dma/idxd/sysfs.c | 6 ++
drivers/dma/imx-sdma.c | 4 +-
drivers/dma/mediatek/mtk-uart-apdma.c | 9 ++-
drivers/edac/synopsys_edac.c | 16 +++--
drivers/gpio/gpiolib.c | 4 +-
drivers/gpu/drm/msm/disp/mdp5/mdp5_plane.c | 3 +
.../drm/panel/panel-raspberrypi-touchscreen.c | 13 +++-
drivers/gpu/drm/vc4/vc4_dsi.c | 2 +-
.../net/ethernet/aquantia/atlantic/aq_nic.c | 8 +--
.../ethernet/aquantia/atlantic/aq_pci_func.c | 8 +--
.../net/ethernet/aquantia/atlantic/aq_vec.c | 24 +++----
drivers/net/ethernet/cadence/macb_main.c | 8 +++
.../ethernet/freescale/dpaa/dpaa_ethtool.c | 8 ++-
drivers/net/ethernet/intel/e1000e/ich8lan.c | 4 +-
drivers/net/ethernet/intel/igc/igc_i225.c | 11 ++-
drivers/net/ethernet/intel/igc/igc_phy.c | 4 +-
drivers/net/ethernet/micrel/Kconfig | 1 -
.../ethernet/stmicro/stmmac/stmmac_hwtstamp.c | 4 +-
drivers/net/vxlan.c | 4 +-
.../broadcom/brcm80211/brcmfmac/sdio.c | 2 +-
.../net/wireless/mediatek/mt76/mt76x2/pci.c | 2 +-
drivers/nvme/host/core.c | 24 +++++--
drivers/nvme/host/nvme.h | 5 ++
drivers/nvme/host/pci.c | 5 +-
drivers/perf/arm_pmu.c | 10 ++-
drivers/platform/x86/samsung-laptop.c | 2 -
drivers/reset/tegra/reset-bpmp.c | 9 ++-
drivers/scsi/qedi/qedi_iscsi.c | 69 +++++++++----------
drivers/spi/atmel-quadspi.c | 3 +
drivers/spi/spi-mtk-nor.c | 12 +++-
drivers/staging/android/ion/ion.c | 3 +
fs/cifs/cifsfs.c | 2 +-
fs/ext4/ext4.h | 2 +-
fs/ext4/extents.c | 32 +++++++--
fs/ext4/inode.c | 18 ++++-
fs/ext4/super.c | 19 +++--
fs/gfs2/rgrp.c | 9 +--
fs/hugetlbfs/inode.c | 9 +--
fs/stat.c | 19 ++---
include/linux/etherdevice.h | 5 +-
include/linux/sched/mm.h | 8 +++
include/net/esp.h | 2 -
include/net/netns/ipv6.h | 4 +-
kernel/events/core.c | 2 +-
kernel/events/internal.h | 5 ++
kernel/events/ring_buffer.c | 5 --
kernel/sched/fair.c | 10 +--
kernel/trace/trace_events_trigger.c | 7 +-
mm/mmap.c | 8 ---
mm/mmu_notifier.c | 14 +++-
mm/page_alloc.c | 2 +-
net/can/isotp.c | 10 ++-
net/ipv4/esp4.c | 5 +-
net/ipv6/esp6.c | 5 +-
net/ipv6/ip6_gre.c | 14 ++--
net/ipv6/route.c | 11 +--
net/l3mdev/l3mdev.c | 2 +-
net/netlink/af_netlink.c | 7 ++
net/openvswitch/flow_netlink.c | 2 +-
net/packet/af_packet.c | 13 ++--
net/rxrpc/net_ns.c | 2 +
net/sched/cls_u32.c | 8 +--
net/smc/af_smc.c | 4 +-
sound/pci/hda/patch_realtek.c | 1 +
sound/soc/atmel/sam9g20_wm8731.c | 61 ----------------
sound/soc/codecs/msm8916-wcd-digital.c | 9 ++-
sound/soc/codecs/wcd934x.c | 26 +------
sound/soc/soc-dapm.c | 6 +-
sound/usb/midi.c | 1 +
sound/usb/usbaudio.h | 2 +-
tools/lib/perf/evlist.c | 3 +-
tools/perf/builtin-report.c | 14 ++++
.../drivers/net/mlxsw/vxlan_flooding.sh | 17 +++++
88 files changed, 485 insertions(+), 362 deletions(-)
--
2.20.1
1
81