Kernel
Threads by month
- ----- 2025 -----
- 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
July 2022
- 10 participants
- 66 discussions

[PATCH openEuler-1.0-LTS 1/2] block: prevent lockdep false positive warning about 'bd_mutex'
by Yongqiang Liu 30 Jul '22
by Yongqiang Liu 30 Jul '22
30 Jul '22
From: Yu Kuai <yukuai3(a)huawei.com>
hulk inclusion
category: bugfix
bugzilla: 187246, https://gitee.com/openeuler/kernel/issues/I5JQL4
CVE: NA
--------------------------------
Commit faf2662e328c ("block: fix that part scan is disabled in
device_add_disk()") confuse lockdep to produce following warning:
=====================================================
WARNING: possible circular locking dependency detected
4.18.0+ #2 Tainted: G ---------r- -
------------------------------------------------------
syz-executor.0/4652 is trying to acquire lock:
00000000ad5f5a19 (&mddev->open_mutex){+.+.}, at: md_open+0x13a/0x260 home/install/linux-rh-3-10/drivers/md/md.c:7626
but task is already holding lock:
000000005c3a3fea (&bdev->bd_mutex){+.+.}, at: __blkdev_get+0x156/0x1490 home/install/linux-rh-3-10/fs/block_dev.c:1583
which lock already depends on the new lock.
the existing dependency chain (in reverse order) is:
-> #2 (&bdev->bd_mutex){+.+.}:
__mutex_lock_common home/install/linux-rh-3-10/kernel/locking/mutex.c:925 [inline]
__mutex_lock+0x105/0x1270 home/install/linux-rh-3-10/kernel/locking/mutex.c:1072
__blkdev_get+0x156/0x1490 home/install/linux-rh-3-10/fs/block_dev.c:1583
blkdev_get+0x33c/0xac0 home/install/linux-rh-3-10/fs/block_dev.c:1735
disk_init_partition home/install/linux-rh-3-10/block/blk-sysfs.c:972 [inline]
blk_register_queue+0x5ed/0x6c0 home/install/linux-rh-3-10/block/blk-sysfs.c:1055
__device_add_disk+0xab5/0xd70 home/install/linux-rh-3-10/block/genhd.c:729
sd_probe_async+0x447/0x852 home/install/linux-rh-3-10/drivers/scsi/sd.c:3249
async_run_entry_fn+0xe1/0x700 home/install/linux-rh-3-10/kernel/async.c:127
process_one_work+0x9cf/0x1940 home/install/linux-rh-3-10/kernel/workqueue.c:2175
worker_thread+0x91/0xc50 home/install/linux-rh-3-10/kernel/workqueue.c:2321
kthread+0x33a/0x400 home/install/linux-rh-3-10/kernel/kthread.c:257
ret_from_fork+0x3a/0x50 home/install/linux-rh-3-10/arch/x86/entry/entry_64.S:355
-> #1 (&q->sysfs_dir_lock){+.+.}:
__mutex_lock_common home/install/linux-rh-3-10/kernel/locking/mutex.c:925 [inline]
__mutex_lock+0x105/0x1270 home/install/linux-rh-3-10/kernel/locking/mutex.c:1072
blk_register_queue+0x143/0x6c0 home/install/linux-rh-3-10/block/blk-sysfs.c:1010
__device_add_disk+0xab5/0xd70 home/install/linux-rh-3-10/block/genhd.c:729
add_disk home/install/linux-rh-3-10/./include/linux/genhd.h:447 [inline]
md_alloc+0xb06/0x10d0 home/install/linux-rh-3-10/drivers/md/md.c:5525
md_probe+0x32/0x60 home/install/linux-rh-3-10/drivers/md/md.c:5554
kobj_lookup+0x2d2/0x450 home/install/linux-rh-3-10/drivers/base/map.c:152
get_gendisk+0x3b/0x360 home/install/linux-rh-3-10/block/genhd.c:860
bdev_get_gendisk home/install/linux-rh-3-10/fs/block_dev.c:1181 [inline]
__blkdev_get+0x3b6/0x1490 home/install/linux-rh-3-10/fs/block_dev.c:1578
blkdev_get+0x33c/0xac0 home/install/linux-rh-3-10/fs/block_dev.c:1735
blkdev_open+0x1c2/0x250 home/install/linux-rh-3-10/fs/block_dev.c:1923
do_dentry_open+0x686/0xf50 home/install/linux-rh-3-10/fs/open.c:777
do_last home/install/linux-rh-3-10/fs/namei.c:3449 [inline]
path_openat+0x92f/0x28c0 home/install/linux-rh-3-10/fs/namei.c:3578
do_filp_open+0x1aa/0x2b0 home/install/linux-rh-3-10/fs/namei.c:3613
do_sys_open+0x307/0x490 home/install/linux-rh-3-10/fs/open.c:1075
do_syscall_64+0xca/0x5c0 home/install/linux-rh-3-10/arch/x86/entry/common.c:298
entry_SYSCALL_64_after_hwframe+0x6a/0xdf
-> #0 (&mddev->open_mutex){+.+.}:
lock_acquire+0x10b/0x3a0 home/install/linux-rh-3-10/kernel/locking/lockdep.c:3868
__mutex_lock_common home/install/linux-rh-3-10/kernel/locking/mutex.c:925 [inline]
__mutex_lock+0x105/0x1270 home/install/linux-rh-3-10/kernel/locking/mutex.c:1072
md_open+0x13a/0x260 home/install/linux-rh-3-10/drivers/md/md.c:7626
__blkdev_get+0x2dc/0x1490 home/install/linux-rh-3-10/fs/block_dev.c:1599
blkdev_get+0x33c/0xac0 home/install/linux-rh-3-10/fs/block_dev.c:1735
blkdev_open+0x1c2/0x250 home/install/linux-rh-3-10/fs/block_dev.c:1923
do_dentry_open+0x686/0xf50 home/install/linux-rh-3-10/fs/open.c:777
do_last home/install/linux-rh-3-10/fs/namei.c:3449 [inline]
path_openat+0x92f/0x28c0 home/install/linux-rh-3-10/fs/namei.c:3578
do_filp_open+0x1aa/0x2b0 home/install/linux-rh-3-10/fs/namei.c:3613
do_sys_open+0x307/0x490 home/install/linux-rh-3-10/fs/open.c:1075
do_syscall_64+0xca/0x5c0 home/install/linux-rh-3-10/arch/x86/entry/common.c:298
entry_SYSCALL_64_after_hwframe+0x6a/0xdf
other info that might help us debug this:
Chain exists of:
&mddev->open_mutex --> &q->sysfs_dir_lock --> &bdev->bd_mutex
Possible unsafe locking scenario:
CPU0 CPU1
---- ----
lock(&bdev->bd_mutex);
lock(&q->sysfs_dir_lock);
lock(&bdev->bd_mutex);
lock(&mddev->open_mutex);
*** DEADLOCK ***
Since 'bd_mutex' and 'sysfs_dir_lock' is different is for each device,
deadlock between md_open() and sd_probe_async() is impossible. However,
lockdep is treating 'bd_mutex' and 'sysfs_dir_lock' from different devices
the same, and commit faf2662e328c ("block: fix that part scan is disabled
in device_add_disk()") is holding 'bd_mutex' inside 'sysfs_dir_lock',
which causes the false positive warning.
Fix the false positive warning by don't grab 'bd_mutex' inside
'sysfs_dir_lock'.
Signed-off-by: Yu Kuai <yukuai3(a)huawei.com>
Reviewed-by: Jason Yan <yanaijie(a)huawei.com>
Signed-off-by: Yongqiang Liu <liuyongqiang13(a)huawei.com>
---
block/blk-sysfs.c | 8 +++++++-
1 file changed, 7 insertions(+), 1 deletion(-)
diff --git a/block/blk-sysfs.c b/block/blk-sysfs.c
index ee963759ae10..530f1bf36c87 100644
--- a/block/blk-sysfs.c
+++ b/block/blk-sysfs.c
@@ -977,10 +977,16 @@ int blk_register_queue(struct gendisk *disk)
* before it's registration is done.
*/
disk->flags |= GENHD_FL_UP;
- disk_init_partition(disk);
ret = 0;
unlock:
mutex_unlock(&q->sysfs_lock);
+ /*
+ * Init partitions after releasing 'sysfs_lock', otherwise lockdep
+ * will be confused because it will treat 'bd_mutex' from different
+ * devices as the same lock.
+ */
+ if (!ret)
+ disk_init_partition(disk);
/*
* SCSI probing may synchronously create and destroy a lot of
--
2.25.1
1
1

[PATCH openEuler-1.0-LTS 1/3] dm verity: add root hash pkcs#7 signature verification
by Yongqiang Liu 30 Jul '22
by Yongqiang Liu 30 Jul '22
30 Jul '22
From: Jaskaran Khurana <jaskarankhurana(a)linux.microsoft.com>
mainline inclusion
from mainline-v5.4-rc1
commit 88cd3e6cfac915f50f7aa7b699bdf053afec866e
category: bugfix
bugzilla: https://gitee.com/openeuler/kernel/issues/I5CES3
CVE: NA
--------------------------------
The verification is to support cases where the root hash is not secured
by Trusted Boot, UEFI Secureboot or similar technologies.
One of the use cases for this is for dm-verity volumes mounted after
boot, the root hash provided during the creation of the dm-verity volume
has to be secure and thus in-kernel validation implemented here will be
used before we trust the root hash and allow the block device to be
created.
The signature being provided for verification must verify the root hash
and must be trusted by the builtin keyring for verification to succeed.
The hash is added as a key of type "user" and the description is passed
to the kernel so it can look it up and use it for verification.
Adds CONFIG_DM_VERITY_VERIFY_ROOTHASH_SIG which can be turned on if root
hash verification is needed.
Kernel commandline dm_verity module parameter 'require_signatures' will
indicate whether to force root hash signature verification (for all dm
verity volumes).
Signed-off-by: Jaskaran Khurana <jaskarankhurana(a)linux.microsoft.com>
Tested-and-Reviewed-by: Milan Broz <gmazyland(a)gmail.com>
Signed-off-by: Mike Snitzer <snitzer(a)redhat.com>
Conflicts:
Documentation/admin-guide/device-mapper/verity.rst
drivers/md/dm-verity-target.c
Signed-off-by: Luo Meng <luomeng12(a)huawei.com>
Reviewed-by: Jason Yan <yanaijie(a)huawei.com>
Signed-off-by: Yongqiang Liu <liuyongqiang13(a)huawei.com>
---
drivers/md/Kconfig | 12 +++
drivers/md/Makefile | 4 +
drivers/md/dm-verity-target.c | 43 ++++++++--
drivers/md/dm-verity-verify-sig.c | 133 ++++++++++++++++++++++++++++++
drivers/md/dm-verity-verify-sig.h | 60 ++++++++++++++
drivers/md/dm-verity.h | 2 +
6 files changed, 249 insertions(+), 5 deletions(-)
create mode 100644 drivers/md/dm-verity-verify-sig.c
create mode 100644 drivers/md/dm-verity-verify-sig.h
diff --git a/drivers/md/Kconfig b/drivers/md/Kconfig
index 8b8c123cae66..6d052c11d66d 100644
--- a/drivers/md/Kconfig
+++ b/drivers/md/Kconfig
@@ -479,6 +479,18 @@ config DM_VERITY
If unsure, say N.
+config DM_VERITY_VERIFY_ROOTHASH_SIG
+ def_bool n
+ bool "Verity data device root hash signature verification support"
+ depends on DM_VERITY
+ select SYSTEM_DATA_VERIFICATION
+ help
+ Add ability for dm-verity device to be validated if the
+ pre-generated tree of cryptographic checksums passed has a pkcs#7
+ signature file that can validate the roothash of the tree.
+
+ If unsure, say N.
+
config DM_VERITY_FEC
bool "Verity forward error correction support"
depends on DM_VERITY
diff --git a/drivers/md/Makefile b/drivers/md/Makefile
index 822f4e8753bc..32d6d6e4a756 100644
--- a/drivers/md/Makefile
+++ b/drivers/md/Makefile
@@ -76,3 +76,7 @@ endif
ifeq ($(CONFIG_DM_VERITY_FEC),y)
dm-verity-objs += dm-verity-fec.o
endif
+
+ifeq ($(CONFIG_DM_VERITY_VERIFY_ROOTHASH_SIG),y)
+dm-verity-objs += dm-verity-verify-sig.o
+endif
diff --git a/drivers/md/dm-verity-target.c b/drivers/md/dm-verity-target.c
index ca6acc1b20ae..246593cd8fd2 100644
--- a/drivers/md/dm-verity-target.c
+++ b/drivers/md/dm-verity-target.c
@@ -16,7 +16,7 @@
#include "dm-verity.h"
#include "dm-verity-fec.h"
-
+#include "dm-verity-verify-sig.h"
#include <linux/module.h>
#include <linux/reboot.h>
@@ -34,7 +34,8 @@
#define DM_VERITY_OPT_IGN_ZEROES "ignore_zero_blocks"
#define DM_VERITY_OPT_AT_MOST_ONCE "check_at_most_once"
-#define DM_VERITY_OPTS_MAX (3 + DM_VERITY_OPTS_FEC)
+#define DM_VERITY_OPTS_MAX (3 + DM_VERITY_OPTS_FEC + \
+ DM_VERITY_ROOT_HASH_VERIFICATION_OPTS)
static unsigned dm_verity_prefetch_cluster = DM_VERITY_DEFAULT_PREFETCH_SIZE;
@@ -738,6 +739,8 @@ static void verity_status(struct dm_target *ti, status_type_t type,
args++;
if (v->validated_blocks)
args++;
+ if (v->signature_key_desc)
+ args += DM_VERITY_ROOT_HASH_VERIFICATION_OPTS;
if (!args)
return;
DMEMIT(" %u", args);
@@ -759,6 +762,9 @@ static void verity_status(struct dm_target *ti, status_type_t type,
if (v->validated_blocks)
DMEMIT(" " DM_VERITY_OPT_AT_MOST_ONCE);
sz = verity_fec_status_table(v, sz, result, maxlen);
+ if (v->signature_key_desc)
+ DMEMIT(" " DM_VERITY_ROOT_HASH_VERIFICATION_OPT_SIG_KEY
+ " %s", v->signature_key_desc);
break;
}
}
@@ -824,6 +830,8 @@ static void verity_dtr(struct dm_target *ti)
verity_fec_dtr(v);
+ kfree(v->signature_key_desc);
+
kfree(v);
}
@@ -879,7 +887,8 @@ static int verity_alloc_zero_digest(struct dm_verity *v)
return r;
}
-static int verity_parse_opt_args(struct dm_arg_set *as, struct dm_verity *v)
+static int verity_parse_opt_args(struct dm_arg_set *as, struct dm_verity *v,
+ struct dm_verity_sig_opts *verify_args)
{
int r;
unsigned argc;
@@ -928,6 +937,14 @@ static int verity_parse_opt_args(struct dm_arg_set *as, struct dm_verity *v)
if (r)
return r;
continue;
+ } else if (verity_verify_is_sig_opt_arg(arg_name)) {
+ r = verity_verify_sig_parse_opt_args(as, v,
+ verify_args,
+ &argc, arg_name);
+ if (r)
+ return r;
+ continue;
+
}
ti->error = "Unrecognized verity feature request";
@@ -954,6 +971,7 @@ static int verity_parse_opt_args(struct dm_arg_set *as, struct dm_verity *v)
static int verity_ctr(struct dm_target *ti, unsigned argc, char **argv)
{
struct dm_verity *v;
+ struct dm_verity_sig_opts verify_args = {0};
struct dm_arg_set as;
unsigned int num;
unsigned long long num_ll;
@@ -961,6 +979,7 @@ static int verity_ctr(struct dm_target *ti, unsigned argc, char **argv)
int i;
sector_t hash_position;
char dummy;
+ char *root_hash_digest_to_validate;
v = kzalloc(sizeof(struct dm_verity), GFP_KERNEL);
if (!v) {
@@ -1085,6 +1104,7 @@ static int verity_ctr(struct dm_target *ti, unsigned argc, char **argv)
r = -EINVAL;
goto bad;
}
+ root_hash_digest_to_validate = argv[8];
if (strcmp(argv[9], "-")) {
v->salt_size = strlen(argv[9]) / 2;
@@ -1110,11 +1130,20 @@ static int verity_ctr(struct dm_target *ti, unsigned argc, char **argv)
as.argc = argc;
as.argv = argv;
- r = verity_parse_opt_args(&as, v);
+ r = verity_parse_opt_args(&as, v, &verify_args);
if (r < 0)
goto bad;
}
+ /* Root hash signature is a optional parameter*/
+ r = verity_verify_root_hash(root_hash_digest_to_validate,
+ strlen(root_hash_digest_to_validate),
+ verify_args.sig,
+ verify_args.sig_size);
+ if (r < 0) {
+ ti->error = "Root hash verification failed";
+ goto bad;
+ }
v->hash_per_block_bits =
__fls((1 << v->hash_dev_block_bits) / v->digest_size);
@@ -1180,9 +1209,13 @@ static int verity_ctr(struct dm_target *ti, unsigned argc, char **argv)
ti->per_io_data_size = roundup(ti->per_io_data_size,
__alignof__(struct dm_verity_io));
+ verity_verify_sig_opts_cleanup(&verify_args);
+
return 0;
bad:
+
+ verity_verify_sig_opts_cleanup(&verify_args);
verity_dtr(ti);
return r;
@@ -1190,7 +1223,7 @@ static int verity_ctr(struct dm_target *ti, unsigned argc, char **argv)
static struct target_type verity_target = {
.name = "verity",
- .version = {1, 4, 0},
+ .version = {1, 5, 0},
.module = THIS_MODULE,
.ctr = verity_ctr,
.dtr = verity_dtr,
diff --git a/drivers/md/dm-verity-verify-sig.c b/drivers/md/dm-verity-verify-sig.c
new file mode 100644
index 000000000000..614e43db93aa
--- /dev/null
+++ b/drivers/md/dm-verity-verify-sig.c
@@ -0,0 +1,133 @@
+// SPDX-License-Identifier: GPL-2.0
+/*
+ * Copyright (C) 2019 Microsoft Corporation.
+ *
+ * Author: Jaskaran Singh Khurana <jaskarankhurana(a)linux.microsoft.com>
+ *
+ */
+#include <linux/device-mapper.h>
+#include <linux/verification.h>
+#include <keys/user-type.h>
+#include <linux/module.h>
+#include "dm-verity.h"
+#include "dm-verity-verify-sig.h"
+
+#define DM_VERITY_VERIFY_ERR(s) DM_VERITY_ROOT_HASH_VERIFICATION " " s
+
+static bool require_signatures;
+module_param(require_signatures, bool, false);
+MODULE_PARM_DESC(require_signatures,
+ "Verify the roothash of dm-verity hash tree");
+
+#define DM_VERITY_IS_SIG_FORCE_ENABLED() \
+ (require_signatures != false)
+
+bool verity_verify_is_sig_opt_arg(const char *arg_name)
+{
+ return (!strcasecmp(arg_name,
+ DM_VERITY_ROOT_HASH_VERIFICATION_OPT_SIG_KEY));
+}
+
+static int verity_verify_get_sig_from_key(const char *key_desc,
+ struct dm_verity_sig_opts *sig_opts)
+{
+ struct key *key;
+ const struct user_key_payload *ukp;
+ int ret = 0;
+
+ key = request_key(&key_type_user,
+ key_desc, NULL);
+ if (IS_ERR(key))
+ return PTR_ERR(key);
+
+ down_read(&key->sem);
+
+ ukp = user_key_payload_locked(key);
+ if (!ukp) {
+ ret = -EKEYREVOKED;
+ goto end;
+ }
+
+ sig_opts->sig = kmalloc(ukp->datalen, GFP_KERNEL);
+ if (!sig_opts->sig) {
+ ret = -ENOMEM;
+ goto end;
+ }
+ sig_opts->sig_size = ukp->datalen;
+
+ memcpy(sig_opts->sig, ukp->data, sig_opts->sig_size);
+
+end:
+ up_read(&key->sem);
+ key_put(key);
+
+ return ret;
+}
+
+int verity_verify_sig_parse_opt_args(struct dm_arg_set *as,
+ struct dm_verity *v,
+ struct dm_verity_sig_opts *sig_opts,
+ unsigned int *argc,
+ const char *arg_name)
+{
+ struct dm_target *ti = v->ti;
+ int ret = 0;
+ const char *sig_key = NULL;
+
+ if (!*argc) {
+ ti->error = DM_VERITY_VERIFY_ERR("Signature key not specified");
+ return -EINVAL;
+ }
+
+ sig_key = dm_shift_arg(as);
+ (*argc)--;
+
+ ret = verity_verify_get_sig_from_key(sig_key, sig_opts);
+ if (ret < 0)
+ ti->error = DM_VERITY_VERIFY_ERR("Invalid key specified");
+
+ v->signature_key_desc = kstrdup(sig_key, GFP_KERNEL);
+ if (!v->signature_key_desc)
+ return -ENOMEM;
+
+ return ret;
+}
+
+/*
+ * verify_verify_roothash - Verify the root hash of the verity hash device
+ * using builtin trusted keys.
+ *
+ * @root_hash: For verity, the roothash/data to be verified.
+ * @root_hash_len: Size of the roothash/data to be verified.
+ * @sig_data: The trusted signature that verifies the roothash/data.
+ * @sig_len: Size of the signature.
+ *
+ */
+int verity_verify_root_hash(const void *root_hash, size_t root_hash_len,
+ const void *sig_data, size_t sig_len)
+{
+ int ret;
+
+ if (!root_hash || root_hash_len == 0)
+ return -EINVAL;
+
+ if (!sig_data || sig_len == 0) {
+ if (DM_VERITY_IS_SIG_FORCE_ENABLED())
+ return -ENOKEY;
+ else
+ return 0;
+ }
+
+ ret = verify_pkcs7_signature(root_hash, root_hash_len, sig_data,
+ sig_len, NULL, VERIFYING_UNSPECIFIED_SIGNATURE,
+ NULL, NULL);
+
+ return ret;
+}
+
+void verity_verify_sig_opts_cleanup(struct dm_verity_sig_opts *sig_opts)
+{
+ kfree(sig_opts->sig);
+ sig_opts->sig = NULL;
+ sig_opts->sig_size = 0;
+}
diff --git a/drivers/md/dm-verity-verify-sig.h b/drivers/md/dm-verity-verify-sig.h
new file mode 100644
index 000000000000..19b1547aa741
--- /dev/null
+++ b/drivers/md/dm-verity-verify-sig.h
@@ -0,0 +1,60 @@
+// SPDX-License-Identifier: GPL-2.0
+/*
+ * Copyright (C) 2019 Microsoft Corporation.
+ *
+ * Author: Jaskaran Singh Khurana <jaskarankhurana(a)linux.microsoft.com>
+ *
+ */
+#ifndef DM_VERITY_SIG_VERIFICATION_H
+#define DM_VERITY_SIG_VERIFICATION_H
+
+#define DM_VERITY_ROOT_HASH_VERIFICATION "DM Verity Sig Verification"
+#define DM_VERITY_ROOT_HASH_VERIFICATION_OPT_SIG_KEY "root_hash_sig_key_desc"
+
+struct dm_verity_sig_opts {
+ unsigned int sig_size;
+ u8 *sig;
+};
+
+#ifdef CONFIG_DM_VERITY_VERIFY_ROOTHASH_SIG
+
+#define DM_VERITY_ROOT_HASH_VERIFICATION_OPTS 2
+
+int verity_verify_root_hash(const void *data, size_t data_len,
+ const void *sig_data, size_t sig_len);
+bool verity_verify_is_sig_opt_arg(const char *arg_name);
+
+int verity_verify_sig_parse_opt_args(struct dm_arg_set *as, struct dm_verity *v,
+ struct dm_verity_sig_opts *sig_opts,
+ unsigned int *argc, const char *arg_name);
+
+void verity_verify_sig_opts_cleanup(struct dm_verity_sig_opts *sig_opts);
+
+#else
+
+#define DM_VERITY_ROOT_HASH_VERIFICATION_OPTS 0
+
+int verity_verify_root_hash(const void *data, size_t data_len,
+ const void *sig_data, size_t sig_len)
+{
+ return 0;
+}
+
+bool verity_verify_is_sig_opt_arg(const char *arg_name)
+{
+ return false;
+}
+
+int verity_verify_sig_parse_opt_args(struct dm_arg_set *as, struct dm_verity *v,
+ struct dm_verity_sig_opts *sig_opts,
+ unsigned int *argc, const char *arg_name)
+{
+ return -EINVAL;
+}
+
+void verity_verify_sig_opts_cleanup(struct dm_verity_sig_opts *sig_opts)
+{
+}
+
+#endif /* CONFIG_DM_VERITY_VERIFY_ROOTHASH_SIG */
+#endif /* DM_VERITY_SIG_VERIFICATION_H */
diff --git a/drivers/md/dm-verity.h b/drivers/md/dm-verity.h
index 3441c10b840c..42183a3903ae 100644
--- a/drivers/md/dm-verity.h
+++ b/drivers/md/dm-verity.h
@@ -64,6 +64,8 @@ struct dm_verity {
struct dm_verity_fec *fec; /* forward error correction */
unsigned long *validated_blocks; /* bitset blocks validated */
+
+ char *signature_key_desc; /* signature keyring reference */
};
struct dm_verity_io {
--
2.25.1
1
2
v2:
1. full test in this branch.
2. correct implict declare function in
arch/arm64/kvm/hyp/include/hyp/switch.h.
v1:
backport from mainline
Alexandru Elisei (1):
arm64: Do not trap PMSNEVFR_EL1
Marc Zyngier (10):
KVM: arm64: Let vcpu_sve_pffr() handle HYP VAs
KVM: arm64: Provide KVM's own save/restore SVE primitives
KVM: arm64: Use {read,write}_sysreg_el1 to access ZCR_EL1
KVM: arm64: Introduce vcpu_sve_vq() helper
arm64: sve: Provide a conditional update accessor for ZCR_ELx
KVM: arm64: Map SVE context at EL2 when available
KVM: arm64: Rework SVE host-save/guest-restore
KVM: arm64: Save guest's ZCR_EL1 before saving the FPSIMD state
KVM: arm64: Save/restore SVE state for nVHE
KVM: arm64: Always start with clearing SME flag on load
Mark Brown (54):
arm64/sve: Remove redundant system_supports_sve() tests
arm64/sve: Add compile time checks for SVE hooks in generic functions
arm64/sve: Rework SVE access trap to convert state in registers
arm64/sve: Split _sve_flush macro into separate Z and predicate
flushes
arm64/sve: Skip flushing Z registers with 128 bit vectors
arm64/sve: Use the sve_flush macros in sve_load_from_fpsimd_state()
arm64/sve: Remove sve_load_from_fpsimd_state()
arm64/sve: Better handle failure to allocate SVE register storage
arm64/fp: Reindent fpsimd_save()
arm64/sve: Make access to FFR optional
arm64/sve: Rename find_supported_vector_length()
arm64/sve: Use accessor functions for vector lengths in thread_struct
arm64/sve: Put system wide vector length information into structs
arm64/sve: Explicitly load vector length when restoring SVE state
arm64/sve: Track vector lengths for tasks in an array
arm64/sve: Make sysctl interface for SVE reusable by SME
arm64/sve: Generalise vector length configuration prctl() for SME
arm64/sve: Minor clarification of ABI documentation
arm64: cpufeature: Always specify and use a field width for
capabilities
arm64/sme: Provide ABI documentation for SME
arm64/sme: System register and exception syndrome definitions
arm64/sme: Manually encode SME instructions
arm64: Disable fine grained traps on boot
arm64/sme: Early CPU setup for SME
arm64/sme: Basic enumeration support
arm64/sme: Identify supported SME vector lengths at boot
arm64/sme: Implement sysctl to set the default vector length
arm64/sme: Implement vector length configuration prctl()s
arm64/sme: Implement support for TPIDR2
arm64/sme: Implement SVCR context switching
arm64/sme: Implement streaming SVE context switching
arm64/sme: Implement ZA context switching
arm64/sme: Implement traps and syscall handling for SME
arm64/sme: Disable ZA and streaming mode when handling signals
arm64/sme: Implement streaming SVE signal handling
arm64/sme: Implement ZA signal handling
arm64/sme: Implement ptrace support for streaming mode SVE registers
arm64/sme: Add ptrace support for ZA
arm64/sme: Disable streaming mode and ZA when flushing CPU state
arm64/sme: Save and restore streaming mode over EFI runtime calls
arm64/sme: Provide Kconfig for SME
arm64/sme: Add ID_AA64SMFR0_EL1 to __read_sysreg_by_encoding()
arm64/sme: More sensibly define the size for the ZA register set
KVM: arm64: Hide SME system registers from guests
KVM: arm64: Trap SME usage in guest
KVM: arm64: Handle SME host state when running guests
arm64/fp: Make SVE and SME length register definition match
architecture
arm64/fp: Rename SVE and SME LEN field name to _WIDTH
arm64/sme: Drop SYS_ from SMIDR_EL1 defines
arm64/sme: Standardise bitfield names for SVCR
arm64/sme: Remove _EL0 from name of SVCR - FIXME sysreg.h
arm64/sme: Fix tests for 0b1111 value ID registers
arm64/sme: Fix SVE/SME typo in ABI documentation
arm64/sme: Fix EFI save/restore
Wan Jiabing (1):
arm64/sme: Fix NULL check after kzalloc
Xiaofei Tan (1):
arm64: sve: Provide sve_cond_update_zcr_vq fallback when !ARM64_SVE
Documentation/arm64/elf_hwcaps.rst | 34 +
Documentation/arm64/index.rst | 1 +
Documentation/arm64/sme.rst | 428 ++++++++++
Documentation/arm64/sve.rst | 72 +-
arch/arm64/Kconfig | 11 +
arch/arm64/include/asm/cpu.h | 4 +
arch/arm64/include/asm/cpucaps.h | 2 +
arch/arm64/include/asm/cpufeature.h | 25 +
arch/arm64/include/asm/esr.h | 13 +-
arch/arm64/include/asm/exception.h | 1 +
arch/arm64/include/asm/fpsimd.h | 262 ++++++-
arch/arm64/include/asm/fpsimdmacros.h | 108 ++-
arch/arm64/include/asm/hwcap.h | 8 +
arch/arm64/include/asm/kvm_arm.h | 1 +
arch/arm64/include/asm/kvm_host.h | 12 +-
arch/arm64/include/asm/kvm_hyp.h | 2 +
arch/arm64/include/asm/processor.h | 78 +-
arch/arm64/include/asm/signal_common.h | 19 +-
arch/arm64/include/asm/sysreg.h | 78 +-
arch/arm64/include/asm/thread_info.h | 4 +-
arch/arm64/include/uapi/asm/hwcap.h | 8 +
arch/arm64/include/uapi/asm/ptrace.h | 69 +-
arch/arm64/include/uapi/asm/sigcontext.h | 55 +-
arch/arm64/kernel/cpufeature.c | 280 +++++--
arch/arm64/kernel/cpuinfo.c | 13 +
arch/arm64/kernel/entry-common.c | 11 +
arch/arm64/kernel/entry-fpsimd.S | 72 +-
arch/arm64/kernel/fpsimd.c | 944 ++++++++++++++++++-----
arch/arm64/kernel/head.S | 87 +++
arch/arm64/kernel/process.c | 45 +-
arch/arm64/kernel/ptrace.c | 373 +++++++--
arch/arm64/kernel/signal.c | 175 ++++-
arch/arm64/kernel/syscall.c | 29 +-
arch/arm64/kernel/traps.c | 1 +
arch/arm64/kvm/fpsimd.c | 70 +-
arch/arm64/kvm/guest.c | 6 +-
arch/arm64/kvm/hyp/fpsimd.S | 12 +
arch/arm64/kvm/hyp/include/hyp/switch.h | 75 +-
arch/arm64/kvm/hyp/nvhe/switch.c | 38 +-
arch/arm64/kvm/hyp/vhe/switch.c | 10 +-
arch/arm64/kvm/reset.c | 14 +-
arch/arm64/kvm/sys_regs.c | 8 +-
include/uapi/linux/elf.h | 2 +
include/uapi/linux/prctl.h | 9 +
kernel/sys.c | 12 +
45 files changed, 3123 insertions(+), 458 deletions(-)
create mode 100644 Documentation/arm64/sme.rst
--
2.20.1
1
67

[PATCH openEuler-1.0-LTS] jbd2: Fix assertion 'jh->b_frozen_data == NULL' failure when journal aborted
by Yongqiang Liu 28 Jul '22
by Yongqiang Liu 28 Jul '22
28 Jul '22
From: Zhihao Cheng <chengzhihao1(a)huawei.com>
hulk inclusion
category: bugfix
bugzilla: 187185, https://gitee.com/openeuler/kernel/issues/I5JAOC
CVE: NA
--------------------------------
Following process will fail assertion 'jh->b_frozen_data == NULL' in
jbd2_journal_dirty_metadata():
jbd2_journal_commit_transaction
unlink(dir/a)
jh->b_transaction = trans1
jh->b_jlist = BJ_Metadata
journal->j_running_transaction = NULL
trans1->t_state = T_COMMIT
unlink(dir/b)
handle->h_trans = trans2
do_get_write_access
jh->b_modified = 0
jh->b_frozen_data = frozen_buffer
jh->b_next_transaction = trans2
jbd2_journal_dirty_metadata
is_handle_aborted
is_journal_aborted // return false
--> jbd2 abort <--
while (commit_transaction->t_buffers)
if (is_journal_aborted)
jbd2_journal_refile_buffer
__jbd2_journal_refile_buffer
WRITE_ONCE(jh->b_transaction,
jh->b_next_transaction)
WRITE_ONCE(jh->b_next_transaction, NULL)
__jbd2_journal_file_buffer(jh, BJ_Reserved)
J_ASSERT_JH(jh, jh->b_frozen_data == NULL) // assertion failure !
The reproducer (See detail in [Link]) reports:
------------[ cut here ]------------
kernel BUG at fs/jbd2/transaction.c:1629!
invalid opcode: 0000 [#1] PREEMPT SMP
CPU: 2 PID: 584 Comm: unlink Tainted: G W
5.19.0-rc6-00115-g4a57a8400075-dirty #697
RIP: 0010:jbd2_journal_dirty_metadata+0x3c5/0x470
RSP: 0018:ffffc90000be7ce0 EFLAGS: 00010202
Call Trace:
<TASK>
__ext4_handle_dirty_metadata+0xa0/0x290
ext4_handle_dirty_dirblock+0x10c/0x1d0
ext4_delete_entry+0x104/0x200
__ext4_unlink+0x22b/0x360
ext4_unlink+0x275/0x390
vfs_unlink+0x20b/0x4c0
do_unlinkat+0x42f/0x4c0
__x64_sys_unlink+0x37/0x50
do_syscall_64+0x35/0x80
After journal aborting, __jbd2_journal_refile_buffer() is executed with
holding @jh->b_state_lock, we can fix it by moving 'is_handle_aborted()'
into the area protected by @jh->b_state_lock.
Link: https://bugzilla.kernel.org/show_bug.cgi?id=216251
Fixes: 470decc613ab20 ("[PATCH] jbd2: initial copy of files from jbd")
Conflicts:
fs/jbd2/transaction.c
[ 464170647b56("jbd2: Make state lock a spinlock") is not
applied. ]
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/jbd2/transaction.c | 14 ++++++++++++--
1 file changed, 12 insertions(+), 2 deletions(-)
diff --git a/fs/jbd2/transaction.c b/fs/jbd2/transaction.c
index f56be34564e7..3b31bd1f7b77 100644
--- a/fs/jbd2/transaction.c
+++ b/fs/jbd2/transaction.c
@@ -1410,8 +1410,6 @@ int jbd2_journal_dirty_metadata(handle_t *handle, struct buffer_head *bh)
struct journal_head *jh;
int ret = 0;
- if (is_handle_aborted(handle))
- return -EROFS;
if (!buffer_jbd(bh))
return -EUCLEAN;
@@ -1458,6 +1456,18 @@ int jbd2_journal_dirty_metadata(handle_t *handle, struct buffer_head *bh)
journal = transaction->t_journal;
jbd_lock_bh_state(bh);
+ if (is_handle_aborted(handle)) {
+ /*
+ * Check journal aborting with @jh->b_state_lock locked,
+ * since 'jh->b_transaction' could be replaced with
+ * 'jh->b_next_transaction' during old transaction
+ * committing if journal aborted, which may fail
+ * assertion on 'jh->b_frozen_data == NULL'.
+ */
+ ret = -EROFS;
+ goto out_unlock_bh;
+ }
+
if (jh->b_modified == 0) {
/*
* This buffer's got modified and becoming part
--
2.25.1
1
0

[PATCH openEuler-5.10 01/32] bpf: Don't redirect packets with invalid pkt_len
by Zheng Zengkai 28 Jul '22
by Zheng Zengkai 28 Jul '22
28 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 68efccc15a87..72cfb047fd2c 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
31

[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