From bb3b5ab942590b5fe033bedb62bfbe1d42aa2204 Mon Sep 17 00:00:00 2001 From: Dongwoo Lee Date: Wed, 14 Apr 2021 11:52:25 +0900 Subject: [PATCH 01/16] f2fs: Change default mount options As adjusting mount options for increasing performance and reducing data move due to bggc, this changes default mount options about fsync mode and bggc algorithm as below: fsync_mode: from 'posix' to 'nobarrier' bggc_algorithm: from 'default' to 'atgc' Change-Id: I124ced2ef824832df280de74120612dc72167b36 Signed-off-by: Dongwoo Lee --- fs/f2fs/super.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/fs/f2fs/super.c b/fs/f2fs/super.c index 4fffbef..2c500f8 100644 --- a/fs/f2fs/super.c +++ b/fs/f2fs/super.c @@ -1666,7 +1666,7 @@ static void default_options(struct f2fs_sb_info *sbi) F2FS_OPTION(sbi).inline_xattr_size = DEFAULT_INLINE_XATTR_ADDRS; F2FS_OPTION(sbi).whint_mode = WHINT_MODE_OFF; F2FS_OPTION(sbi).alloc_mode = ALLOC_MODE_DEFAULT; - F2FS_OPTION(sbi).fsync_mode = FSYNC_MODE_POSIX; + F2FS_OPTION(sbi).fsync_mode = FSYNC_MODE_NOBARRIER; F2FS_OPTION(sbi).s_resuid = make_kuid(&init_user_ns, F2FS_DEF_RESUID); F2FS_OPTION(sbi).s_resgid = make_kgid(&init_user_ns, F2FS_DEF_RESGID); F2FS_OPTION(sbi).compress_algorithm = COMPRESS_LZ4; @@ -1681,6 +1681,7 @@ static void default_options(struct f2fs_sb_info *sbi) set_opt(sbi, INLINE_DENTRY); set_opt(sbi, EXTENT_CACHE); set_opt(sbi, NOHEAP); + set_opt(sbi, ATGC); clear_opt(sbi, DISABLE_CHECKPOINT); F2FS_OPTION(sbi).unusable_cap = 0; sbi->sb->s_flags |= SB_LAZYTIME; -- 2.7.4 From e3567a038caad88c3475371e5a60b95ac2988dff Mon Sep 17 00:00:00 2001 From: Jaehoon Chung Date: Fri, 16 Apr 2021 11:18:41 +0900 Subject: [PATCH 02/16] misc: tizen-inform-reboot: fix a potential NULL pointer dereference Fix a potential NULL pointer dereference. If there is no file or directory, it has to check whether it's error or not. Change-Id: Ia6e7280c1901ae772a5f890c312b7a741fbac0a1 Signed-off-by: Jaehoon Chung --- drivers/misc/tizen-inform-reboot.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/misc/tizen-inform-reboot.c b/drivers/misc/tizen-inform-reboot.c index 386c1f6..02f82bb 100644 --- a/drivers/misc/tizen-inform-reboot.c +++ b/drivers/misc/tizen-inform-reboot.c @@ -29,7 +29,7 @@ static int inform_reboot_notifier(struct notifier_block *nb, set_fs(KERNEL_DS); file = filp_open(filename, O_CREAT | O_WRONLY | O_TRUNC, 0644); - if (file) { + if (!IS_ERR(file)) { struct super_block *sb = file->f_path.dentry->d_sb; if (cmd) { -- 2.7.4 From 0739877a5d0a9c7052ba8f132defd4ef7cc6eb8a Mon Sep 17 00:00:00 2001 From: =?utf8?q?=C5=81ukasz=20Stelmach?= Date: Fri, 9 Apr 2021 16:59:56 +0200 Subject: [PATCH 03/16] logger: adapt access mode checks MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Allow setting the tag and the priority only for files opened O_WRONLY. Change-Id: Icc9d7a8eb96f8f1b1aa00717aae1f32f7a2e52e4 Signed-off-by: Łukasz Stelmach --- drivers/staging/android/logger.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/drivers/staging/android/logger.c b/drivers/staging/android/logger.c index df9f246..e547e41 100644 --- a/drivers/staging/android/logger.c +++ b/drivers/staging/android/logger.c @@ -957,7 +957,8 @@ static long logger_ioctl(struct file *file, unsigned int cmd, unsigned long arg) ret = logger_set_version(reader, argp); break; case LOGGER_SET_PRIO: /* 44552 */ - if (file->f_mode & FMODE_READ) { + if ((file->f_mode & FMODE_READ) || + !(file->f_mode & FMODE_WRITE)) { ret = -EBADF; break; } @@ -965,7 +966,8 @@ static long logger_ioctl(struct file *file, unsigned int cmd, unsigned long arg) ret = logger_set_prio(writer, argp); break; case LOGGER_SET_TAG: /* 44551 */ - if (file->f_mode & FMODE_READ) { + if ((file->f_mode & FMODE_READ) || + !(file->f_mode & FMODE_WRITE)) { ret = -EBADF; break; } -- 2.7.4 From bc082072da8ddab83345c7fe85596fe0b1197cff Mon Sep 17 00:00:00 2001 From: =?utf8?q?=C5=81ukasz=20Stelmach?= Date: Fri, 9 Apr 2021 17:20:07 +0200 Subject: [PATCH 04/16] logger: fix temporary buffer handling MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Prevent writing beyond temporary buffer and improve accumulation of data before receiving a newline character or filling the buffer. Change-Id: I8e0591c90914dbd4c2addde4247157831fa4843a Signed-off-by: Łukasz Stelmach --- drivers/staging/android/logger.c | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) diff --git a/drivers/staging/android/logger.c b/drivers/staging/android/logger.c index e547e41..197b9c5 100644 --- a/drivers/staging/android/logger.c +++ b/drivers/staging/android/logger.c @@ -593,6 +593,7 @@ static ssize_t logger_write_iter(struct kiocb *iocb, struct iov_iter *from) if (from_stdio) { char *p; size_t chunk_len = 0; + /* -2 : priority byte and tag terminating '\0' */ size_t max_payload = LOGGER_ENTRY_MAX_PAYLOAD - writer->tag_len - 2; if (writer->owner != current->group_leader) { @@ -623,7 +624,9 @@ static ssize_t logger_write_iter(struct kiocb *iocb, struct iov_iter *from) if (writer->b_owner != current && writer->b_off) flush_thread_data(file); - count = min_t(size_t, iov_iter_count(from), max_payload - 1); + /* -1 : leave space for message terminating '\0' */ + count = min_t(size_t, iov_iter_count(from), + max_payload - writer->b_off - 1); do { @@ -638,8 +641,16 @@ static ssize_t logger_write_iter(struct kiocb *iocb, struct iov_iter *from) *p++ = '\0'; chunk_len = p - writer->buffer; } else { - writer->buffer[count++] = '\0'; - chunk_len = count; + writer->buffer[writer->b_off + count++] = '\0'; + p = &writer->buffer[writer->b_off + count]; + chunk_len = p - writer->buffer; + + BUG_ON(chunk_len > max_payload); + if (chunk_len < max_payload ) { + writer->b_off = writer->b_off + count - 1; + continue; + } + } header.len = chunk_len + writer->tag_len + 2; -- 2.7.4 From 0bd63d18aa6237a40912ce2cdda7a358ebf87520 Mon Sep 17 00:00:00 2001 From: =?utf8?q?=C5=81ukasz=20Stelmach?= Date: Tue, 13 Apr 2021 12:24:38 +0200 Subject: [PATCH 05/16] logger: return amount of data written to stdio MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Return amount of data written by a process to a logger via STDIO interface. Change-Id: I9c77a312d09f3d796a7ec64d5909af193bcc8bc2 Signed-off-by: Łukasz Stelmach --- drivers/staging/android/logger.c | 25 +++++++++++++------------ 1 file changed, 13 insertions(+), 12 deletions(-) diff --git a/drivers/staging/android/logger.c b/drivers/staging/android/logger.c index 197b9c5..7983e57 100644 --- a/drivers/staging/android/logger.c +++ b/drivers/staging/android/logger.c @@ -592,7 +592,7 @@ static ssize_t logger_write_iter(struct kiocb *iocb, struct iov_iter *from) /* Prepend messages from STDOUT and STDERR with a tag and prio */ if (from_stdio) { char *p; - size_t chunk_len = 0; + size_t chunk_len = 0, c = 0; /* -2 : priority byte and tag terminating '\0' */ size_t max_payload = LOGGER_ENTRY_MAX_PAYLOAD - writer->tag_len - 2; @@ -624,30 +624,31 @@ static ssize_t logger_write_iter(struct kiocb *iocb, struct iov_iter *from) if (writer->b_owner != current && writer->b_off) flush_thread_data(file); + count = 0; /* -1 : leave space for message terminating '\0' */ - count = min_t(size_t, iov_iter_count(from), - max_payload - writer->b_off - 1); + c = min_t(size_t, iov_iter_count(from), + max_payload - writer->b_off - 1); do { - if (copy_from_iter(writer->buffer + writer->b_off, count, from) != count) { + if (copy_from_iter(writer->buffer + writer->b_off, c, from) != c) { mutex_unlock(&log->mutex); return -EFAULT; } - + count += c; /* TODO: replace NULL characters with new lines */ - p = strnrchr(writer->buffer + writer->b_off, count, '\n'); + p = strnrchr(writer->buffer + writer->b_off, c, '\n'); if (p) { *p++ = '\0'; chunk_len = p - writer->buffer; } else { - writer->buffer[writer->b_off + count++] = '\0'; - p = &writer->buffer[writer->b_off + count]; + writer->buffer[writer->b_off + c++] = '\0'; + p = &writer->buffer[writer->b_off + c]; chunk_len = p - writer->buffer; BUG_ON(chunk_len > max_payload); if (chunk_len < max_payload ) { - writer->b_off = writer->b_off + count - 1; + writer->b_off = writer->b_off + c - 1; continue; } @@ -659,13 +660,13 @@ static ssize_t logger_write_iter(struct kiocb *iocb, struct iov_iter *from) write_log_data(log, &header, writer, chunk_len); /* move the remaining part of the message */ - memmove(writer->buffer, p, writer->b_off + count - chunk_len); + memmove(writer->buffer, p, writer->b_off + c - chunk_len); /* new b_off points where the rimainder of the string ends */ - writer->b_off = writer->b_off + count - chunk_len; + writer->b_off = writer->b_off + c - chunk_len; writer->buffer[writer->b_off] = '\0'; - } while ((count = min_t(size_t, iov_iter_count(from), max_payload - 1))); + } while ((c = min_t(size_t, iov_iter_count(from), max_payload - 1))); /* save for remaining unfinished line */ writer->b_header = header; -- 2.7.4 From d1b9548884b766252263c82fbcb8b2579a9a21f9 Mon Sep 17 00:00:00 2001 From: =?utf8?q?=C5=81ukasz=20Stelmach?= Date: Fri, 19 Mar 2021 15:20:06 +0100 Subject: [PATCH 06/16] logger: move logger.h to uapi MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Move logger.h to uapi so it can be exported for userland software to use. Change-Id: I64dca69f3442edc246562485b0b29b43615ae881 Signed-off-by: Łukasz Stelmach --- drivers/staging/android/logger.c | 2 +- {drivers/staging/android => include/uapi/linux}/logger.h | 4 ++++ tools/testing/selftests/logger/logger.c | 5 +---- 3 files changed, 6 insertions(+), 5 deletions(-) rename {drivers/staging/android => include/uapi/linux}/logger.h (98%) diff --git a/drivers/staging/android/logger.c b/drivers/staging/android/logger.c index 7983e57..d7707b6 100644 --- a/drivers/staging/android/logger.c +++ b/drivers/staging/android/logger.c @@ -32,7 +32,7 @@ #include #include -#include "logger.h" +#include /** * struct logger_log - represents a specific log, such as 'main' or 'radio' diff --git a/drivers/staging/android/logger.h b/include/uapi/linux/logger.h similarity index 98% rename from drivers/staging/android/logger.h rename to include/uapi/linux/logger.h index b11e48c..a02ac117e 100644 --- a/drivers/staging/android/logger.h +++ b/include/uapi/linux/logger.h @@ -66,7 +66,11 @@ struct logger_entry { __s32 tid; __s32 sec; __s32 nsec; +#ifndef __KERNEL__ + __s32 euid; +#else kuid_t euid; +#endif char msg[0]; }; diff --git a/tools/testing/selftests/logger/logger.c b/tools/testing/selftests/logger/logger.c index 0446e79..5f0bd3b 100644 --- a/tools/testing/selftests/logger/logger.c +++ b/tools/testing/selftests/logger/logger.c @@ -2,6 +2,7 @@ #include #include #include +#include #include #include #include @@ -12,10 +13,6 @@ #include #include -#define LOGGER_SET_VERSION 44550 -#define LOGGER_SET_TAG 44551 -#define LOGGER_SET_PRIO 44552 - #define handle_error_en(en, msg) \ do { errno = en; perror(msg); exit(EXIT_FAILURE); } while (0) -- 2.7.4 From d1aac5b4085582618a2550d620f5d9ddb9f9591a Mon Sep 17 00:00:00 2001 From: =?utf8?q?=C5=81ukasz=20Stelmach?= Date: Wed, 14 Apr 2021 17:50:51 +0200 Subject: [PATCH 07/16] logger: introduce struct logger_set_tag MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Introduce dedicated structure for LOGGER_SET_TAG ioctl, instead of packing and unpacking arguments by hand. Change-Id: Ic3399ab37f55ba2b8a9a976f8c9495fc487fe7f3 Signed-off-by: Łukasz Stelmach --- drivers/staging/android/logger.c | 16 +++++++++------- include/uapi/linux/logger.h | 10 ++++++++++ tools/testing/selftests/logger/logger.c | 6 +++++- 3 files changed, 24 insertions(+), 8 deletions(-) diff --git a/drivers/staging/android/logger.c b/drivers/staging/android/logger.c index d7707b6..a51294a 100644 --- a/drivers/staging/android/logger.c +++ b/drivers/staging/android/logger.c @@ -872,28 +872,30 @@ static long logger_set_prio(struct logger_writer *writer, void __user *arg) static long logger_set_tag(struct logger_writer *writer, void __user *arg) { + struct logger_set_tag tag; int len; char *p, *q; - if (copy_from_user(&len, arg, sizeof(int))) + if (copy_from_user(&tag, arg, sizeof(struct logger_set_tag))) return -EFAULT; - arg += sizeof(int); - + if (tag.len > LOGGER_ENTRY_MAX_PAYLOAD) + return -EINVAL; - p = kzalloc(len, GFP_KERNEL); + p = kzalloc(tag.len, GFP_KERNEL); if (!p) return -ENOMEM; - if (copy_from_user(p, arg, len)) { + if (copy_from_user(p, (void*)(uintptr_t)tag.ptr, tag.len)) { kfree(p); return -EFAULT; } - p[len-1] = '\0'; + p[tag.len - 1] = '\0'; + len = strlen(p); q = writer->tag; writer->tag = p; - writer->tag_len = len - 1; /* without NULL */ + writer->tag_len = len; kfree(q); return 0; diff --git a/include/uapi/linux/logger.h b/include/uapi/linux/logger.h index a02ac117e..8054a3e 100644 --- a/include/uapi/linux/logger.h +++ b/include/uapi/linux/logger.h @@ -74,6 +74,16 @@ struct logger_entry { char msg[0]; }; +/** + * struct logger_set_tag + * @len: Length of a NULL-terminated tag including '\0' + * @ptr: Pointer to a user buffer containing the tag + */ +struct logger_set_tag { + __u64 len; + __u64 ptr; +}; + #define LOGGER_LOG_RADIO "log_radio" /* radio-related messages */ #define LOGGER_LOG_EVENTS "log_events" /* system/hardware events */ #define LOGGER_LOG_SYSTEM "log_system" /* system/framework messages */ diff --git a/tools/testing/selftests/logger/logger.c b/tools/testing/selftests/logger/logger.c index 5f0bd3b..18a3ea7 100644 --- a/tools/testing/selftests/logger/logger.c +++ b/tools/testing/selftests/logger/logger.c @@ -30,6 +30,10 @@ int main(int ac, char *av[]) { char *device = "/dev/log_main"; char *msg = "The Foo"; char *tag = "stdio"; + struct logger_set_tag struct_tag = { + .len = 6, + .ptr = (uintptr_t)tag, + }; int c, fd, s; pid_t child; pthread_t tid; @@ -96,7 +100,7 @@ int main(int ac, char *av[]) { } ioctl(fd, LOGGER_SET_PRIO, prio); - ioctl(fd, LOGGER_SET_TAG, "\006\000\000\000stdio"); + ioctl(fd, LOGGER_SET_TAG, &struct_tag); if (test_mask & BIT(2)) { -- 2.7.4 From ab1589b310fa83e64063f5615a635bad0f66b17c Mon Sep 17 00:00:00 2001 From: =?utf8?q?=C5=81ukasz=20Stelmach?= Date: Thu, 8 Apr 2021 15:36:04 +0200 Subject: [PATCH 08/16] logger-test: more intensive tests MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Send enough data to logger to fill the whole ring buffer. Test assembly of large messages without newline characters. Check return value from write(2). Remove some dead code. Change-Id: I165458f5c7831bd925164aa087f28fd319c9872f Signed-off-by: Łukasz Stelmach --- tools/testing/selftests/logger/logger.c | 29 +++++++++++++++++------------ 1 file changed, 17 insertions(+), 12 deletions(-) diff --git a/tools/testing/selftests/logger/logger.c b/tools/testing/selftests/logger/logger.c index 18a3ea7..c3e4281 100644 --- a/tools/testing/selftests/logger/logger.c +++ b/tools/testing/selftests/logger/logger.c @@ -1,9 +1,9 @@ #include #include #include -#include #include #include +#include #include #include #include @@ -75,12 +75,6 @@ int main(int ac, char *av[]) { setlinebuf(stdout); fd = open(device, O_WRONLY); - if (ac >= 2) { - } - - if (ac == 3) { - } - if (test_mask & BIT(0)) { vec[0].iov_base = &prio; vec[0].iov_len = 1; @@ -103,8 +97,10 @@ int main(int ac, char *av[]) { ioctl(fd, LOGGER_SET_TAG, &struct_tag); if (test_mask & BIT(2)) { - - write(fd, "The Foo From STDIO\n", 19); + int count; + count = write(fd, "The Foo From STDIO\n", 19); + if (count != 19) + printf("count != 19\n"); write(fd, "LINE #1\nLINE #2", 15); write(fd, " CONTINUED\nONCE", 15); @@ -117,12 +113,21 @@ int main(int ac, char *av[]) { return 1; for (int i = 0; i < 8000; i++) - msg[i] = ' ' + (i % 96); + msg[i] = '!' + (i % 95); msg[7999] = '\n'; write(fd, msg, 8000); + + for (int i = 0; (test_mask & BIT(4)) && i < 40; i++) + write(fd, msg, 8000); + + for (int i = 0; (test_mask & BIT(5)) && i < 8000; i++) + write(fd, &msg[i], 1); + + free(msg); + msg = NULL; } - if (test_mask & BIT(4)) { + if (test_mask & BIT(6)) { child = fork(); if (child < 0) { return -1; @@ -140,7 +145,7 @@ int main(int ac, char *av[]) { wait(&s); } - if (test_mask & BIT(5)) { + if (test_mask & BIT(7)) { s = pthread_create(&tid, NULL, &tstart, &fd); if (s != 0) handle_error_en(s, "pthread_create"); -- 2.7.4 From cd6e215e28a9d7bbc2d13993cd662dd0c6c2bf02 Mon Sep 17 00:00:00 2001 From: Seung-Woo Kim Date: Fri, 14 May 2021 10:56:44 +0900 Subject: [PATCH 09/16] Revert "sched: Remove sched_setscheduler*() EXPORTs" This reverts commit 616d91b68cd56bcb1954b6a5af7d542401fde772. Some out-of-tree module still uses sched_setscheduler(), so for build, revert removing export symbol for it. Change-Id: Ic2dbfc04e03e91c5d8daf52039f06149ae0d5fb1 Signed-off-by: Seung-Woo Kim --- kernel/sched/core.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/kernel/sched/core.c b/kernel/sched/core.c index 3a15044..43ee3b9 100644 --- a/kernel/sched/core.c +++ b/kernel/sched/core.c @@ -5509,11 +5509,13 @@ int sched_setscheduler(struct task_struct *p, int policy, { return _sched_setscheduler(p, policy, param, true); } +EXPORT_SYMBOL_GPL(sched_setscheduler); int sched_setattr(struct task_struct *p, const struct sched_attr *attr) { return __sched_setscheduler(p, attr, true, true); } +EXPORT_SYMBOL_GPL(sched_setattr); int sched_setattr_nocheck(struct task_struct *p, const struct sched_attr *attr) { @@ -5538,6 +5540,7 @@ int sched_setscheduler_nocheck(struct task_struct *p, int policy, { return _sched_setscheduler(p, policy, param, false); } +EXPORT_SYMBOL_GPL(sched_setscheduler_nocheck); /* * SCHED_FIFO is a broken scheduler model; that is, it is fundamentally -- 2.7.4 From 45bec50b0fca601338e2e2673f5264f4cc7dc5b0 Mon Sep 17 00:00:00 2001 From: Sylwester Nawrocki Date: Tue, 18 May 2021 14:26:51 +0200 Subject: [PATCH 10/16] logger: Suppress SVACE sign extension warnings This patch suppresses SVACE warnings shown below and makes the code more robust. The actual sign extension issue cannot happen in current code as value of the len variable in function logger_set_tag() is limited to LOGGER_ENTRY_MAX_PAYLOAD and create_log() is being called only with fixed size argument values. * SIGNED_TO_BIGGER_UNSIGNED: Assignment of a signed value which has type 'int' to a variable of a bigger integer type 'size_t' Sign extension at linux-rpi3/drivers/staging/android/logger.c:898 * SIGNED_TO_BIGGER_UNSIGNED: Assignment of a signed value which has type 'int' to a variable of a bigger integer type 'size_t' Sign extension at linux-rpi3/drivers/staging/android/logger.c:1045 Change-Id: I8286e1a7fdd4cc051efc8136970a560cc8cde794 Signed-off-by: Sylwester Nawrocki --- drivers/staging/android/logger.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/staging/android/logger.c b/drivers/staging/android/logger.c index a51294a..2e19856 100644 --- a/drivers/staging/android/logger.c +++ b/drivers/staging/android/logger.c @@ -873,7 +873,7 @@ static long logger_set_prio(struct logger_writer *writer, void __user *arg) static long logger_set_tag(struct logger_writer *writer, void __user *arg) { struct logger_set_tag tag; - int len; + size_t len; char *p, *q; if (copy_from_user(&tag, arg, sizeof(struct logger_set_tag))) @@ -1010,7 +1010,7 @@ static const struct file_operations logger_fops = { * Log size must must be a power of two, and greater than * (LOGGER_ENTRY_MAX_PAYLOAD + sizeof(struct logger_entry)). */ -static int __init create_log(char *log_name, int size) +static int __init create_log(char *log_name, size_t size) { int ret = 0; struct logger_log *log; -- 2.7.4 From f6ec41e94cf25277dd66086f70e54cba0db9026a Mon Sep 17 00:00:00 2001 From: Sylwester Nawrocki Date: Tue, 18 May 2021 14:56:13 +0200 Subject: [PATCH 11/16] kdbus: Remove unreachable code from kdbus_msg_examine This fixes an issue pointed out with SVACE warning: * UNREACHABLE_CODE: This statement in the source code might be unreachable during program execution. [unreachable] unreachable at linux-rpi3/ipc/kdbus/message.c:346 [vec_size > vec_size + size (0 > ANY) is always false] vec_size > vec_size + size (0 > ANY) is always false at linux-rpi3/ipc/kdbus/message.c:345 Change-Id: Ia5204bbaad863f88c470e198a081fe58ffb4f208 Signed-off-by: Sylwester Nawrocki --- ipc/kdbus/message.c | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/ipc/kdbus/message.c b/ipc/kdbus/message.c index 63626c8..d069c52 100644 --- a/ipc/kdbus/message.c +++ b/ipc/kdbus/message.c @@ -284,7 +284,7 @@ static int kdbus_msg_examine(struct kdbus_msg *msg, struct kdbus_bus *bus, size_t *out_n_fds, size_t *out_n_parts) { struct kdbus_item *item, *fds = NULL, *bloom = NULL, *dstname = NULL; - u64 n_parts, n_memfds, n_fds, vec_size; + u64 n_parts, n_memfds, n_fds; /* * Step 1: @@ -334,7 +334,6 @@ static int kdbus_msg_examine(struct kdbus_msg *msg, struct kdbus_bus *bus, n_parts = 0; n_memfds = 0; n_fds = 0; - vec_size = 0; KDBUS_ITEMS_FOREACH(item, msg->items, KDBUS_ITEMS_SIZE(msg, items)) { switch (item->type) { @@ -342,9 +341,7 @@ static int kdbus_msg_examine(struct kdbus_msg *msg, struct kdbus_bus *bus, void __force __user *ptr = KDBUS_PTR(item->vec.address); u64 size = item->vec.size; - if (vec_size + size < vec_size) - return -EMSGSIZE; - if (vec_size + size > KDBUS_MSG_MAX_PAYLOAD_VEC_SIZE) + if (size > KDBUS_MSG_MAX_PAYLOAD_VEC_SIZE) return -EMSGSIZE; if (ptr && unlikely(!access_ok(ptr, size))) return -EFAULT; -- 2.7.4 From 11e330a300a78a30ece7ce4b7be01b366cb5c461 Mon Sep 17 00:00:00 2001 From: Dongwoo Lee Date: Wed, 2 Jun 2021 11:36:45 +0900 Subject: [PATCH 12/16] ARM: tizen_bcm2711_defconfig: Enable WireGuard This enables WireGuard VPN feature. Change-Id: Ia88f99d110c65120f1e55a1bca2e59b9fe35324f Signed-off-by: Dongwoo Lee --- arch/arm/configs/tizen_bcm2711_defconfig | 1 + 1 file changed, 1 insertion(+) diff --git a/arch/arm/configs/tizen_bcm2711_defconfig b/arch/arm/configs/tizen_bcm2711_defconfig index 6dbadac..2681228 100644 --- a/arch/arm/configs/tizen_bcm2711_defconfig +++ b/arch/arm/configs/tizen_bcm2711_defconfig @@ -222,6 +222,7 @@ CONFIG_DM_CRYPT=y CONFIG_DM_UEVENT=y CONFIG_DM_VERITY=y CONFIG_NETDEVICES=y +CONFIG_WIREGUARD=y CONFIG_TUN=y # CONFIG_NET_VENDOR_AURORA is not set CONFIG_BCMGENET=y -- 2.7.4 From 481281b1448cc2c4fb140809e27b6f055209af00 Mon Sep 17 00:00:00 2001 From: Dongwoo Lee Date: Wed, 2 Jun 2021 11:48:28 +0900 Subject: [PATCH 13/16] ARM64: tizen_bcm2711_defconfig: Enable WireGuard This enables WireGuard VPN feature. Change-Id: I2e63427ed5f667858bd3abddb73e5018dc16ac7e Signed-off-by: Dongwoo Lee --- arch/arm64/configs/tizen_bcm2711_defconfig | 1 + 1 file changed, 1 insertion(+) diff --git a/arch/arm64/configs/tizen_bcm2711_defconfig b/arch/arm64/configs/tizen_bcm2711_defconfig index 07faa8a..d27e80e 100644 --- a/arch/arm64/configs/tizen_bcm2711_defconfig +++ b/arch/arm64/configs/tizen_bcm2711_defconfig @@ -220,6 +220,7 @@ CONFIG_DM_CRYPT=y CONFIG_DM_UEVENT=y CONFIG_DM_VERITY=y CONFIG_NETDEVICES=y +CONFIG_WIREGUARD=y CONFIG_TUN=y # CONFIG_NET_VENDOR_AURORA is not set CONFIG_BCMGENET=y -- 2.7.4 From c7544c84fcdec91b8f4d6a8583d77583c6866fa5 Mon Sep 17 00:00:00 2001 From: Sung-hun Kim Date: Tue, 27 Oct 2020 20:48:36 +0900 Subject: [PATCH 14/16] mm: LKSM: bug fix for kernel memory leak For efficiency, LKSM cleans exited processes in a batched manner when it finishes a scanning iteration. When it finds exited process while it is in the scanning iteration, it just pends the mm_slot of the exited process to the internal list. On the other hend, when KSM daemon cleans mm_slots of exited processes, it should care regions of exited processes to remove unreferenced lksm_region objects. Previously, most regions are maintained properly but only regions in "head" of the exited process list does not be cleaned due to the buggy implementation. At last, uncleaned objects are remained as unreferenced garbages. Follow message is detected by kmemleak (reported by sw0312.kim@samsung.com): ========================================================================= unreferenced object 0xffffff80c7083600 (size 128): comm "ksm_crawld", pid 41, jiffies 4294918362 (age 95.632s) hex dump (first 32 bytes): 00 37 08 c7 80 ff ff ff 60 82 19 bd 80 ff ff ff .7......`....... 00 35 08 c7 80 ff ff ff 00 00 00 00 00 00 00 00 .5.............. backtrace: [<0000000048313958>] kmem_cache_alloc_trace+0x1e0/0x348 [<00000000fd246822>] lksm_region_ref_append+0x48/0xf8 [<00000000c5a818a0>] ksm_join+0x3a0/0x498 [<00000000b2c3f36a>] lksm_prepare_full_scan+0xe8/0x390 [<00000000013943b5>] lksm_crawl_thread+0x214/0xbf8 [<00000000b4ce0593>] kthread+0x1b0/0x1b8 [<000000002a3f7216>] ret_from_fork+0x10/0x18 unreferenced object 0xffffff80c7083700 (size 128): comm "ksm_crawld", pid 41, jiffies 4294918362 (age 95.632s) hex dump (first 32 bytes): 00 39 08 c7 80 ff ff ff 00 36 08 c7 80 ff ff ff .9.......6...... 00 35 08 c7 80 ff ff ff 00 00 00 00 00 00 00 00 .5.............. backtrace: [<0000000048313958>] kmem_cache_alloc_trace+0x1e0/0x348 [<00000000fd246822>] lksm_region_ref_append+0x48/0xf8 [<00000000c5a818a0>] ksm_join+0x3a0/0x498 [<00000000b2c3f36a>] lksm_prepare_full_scan+0xe8/0x390 [<00000000013943b5>] lksm_crawl_thread+0x214/0xbf8 [<00000000b4ce0593>] kthread+0x1b0/0x1b8 [<000000002a3f7216>] ret_from_fork+0x10/0x18 ... ========================================================================= This patch takes care of such possible kernel memory leak problem. Change-Id: I3e4b299e02018ece1c19ba53e4f10a68520a807b Signed-off-by: Sung-hun Kim --- mm/lksm.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/mm/lksm.c b/mm/lksm.c index b763e63..31d8601 100644 --- a/mm/lksm.c +++ b/mm/lksm.c @@ -2836,6 +2836,9 @@ static void lksm_flush_removed_mm_list(void) cond_resched(); remove_trailing_rmap_items(head, &head->rmap_list); +#ifdef CONFIG_LKSM_FILTER + lksm_region_ref_list_release(head); +#endif clear_bit(MMF_VM_MERGEABLE, &head->mm->flags); mmdrop(head->mm); free_mm_slot(head); -- 2.7.4 From 1de2268e3ed287adce2f1360a13cec11da7499fc Mon Sep 17 00:00:00 2001 From: INSUN PYO Date: Wed, 30 Jun 2021 11:35:05 +0900 Subject: [PATCH 15/16] ARM/ARM64: tizen_bcm2711_defconfig: disable ANDROID_LOGGER config Disable android logger. The android logger has been moved to the kernel module of the linux-tizen-modules package. Change-Id: I64c5207ce00a818795e307b79d4bf540a88fe120 Signed-off-by: INSUN PYO --- arch/arm/configs/tizen_bcm2711_defconfig | 2 +- arch/arm64/configs/tizen_bcm2711_defconfig | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/arch/arm/configs/tizen_bcm2711_defconfig b/arch/arm/configs/tizen_bcm2711_defconfig index 2681228..90ed4c4 100644 --- a/arch/arm/configs/tizen_bcm2711_defconfig +++ b/arch/arm/configs/tizen_bcm2711_defconfig @@ -402,7 +402,7 @@ CONFIG_DMA_BCM2708=y CONFIG_SW_SYNC=y CONFIG_STAGING=y CONFIG_STAGING_MEDIA=y -CONFIG_ANDROID_LOGGER=y +# CONFIG_ANDROID_LOGGER is not set CONFIG_SND_BCM2835=y CONFIG_VIDEO_BCM2835=y CONFIG_VIDEO_CODEC_BCM2835=y diff --git a/arch/arm64/configs/tizen_bcm2711_defconfig b/arch/arm64/configs/tizen_bcm2711_defconfig index d27e80e..eb9f9d7 100644 --- a/arch/arm64/configs/tizen_bcm2711_defconfig +++ b/arch/arm64/configs/tizen_bcm2711_defconfig @@ -393,7 +393,7 @@ CONFIG_DMA_BCM2708=y CONFIG_SW_SYNC=y CONFIG_STAGING=y CONFIG_STAGING_MEDIA=y -CONFIG_ANDROID_LOGGER=y +# CONFIG_ANDROID_LOGGER is not set CONFIG_SND_BCM2835=y CONFIG_VIDEO_BCM2835=y CONFIG_VIDEO_CODEC_BCM2835=y -- 2.7.4 From 8be9b6c1a19716e7d7d3caf8ce0f63161cad573c Mon Sep 17 00:00:00 2001 From: Dongwoo Lee Date: Wed, 7 Jul 2021 12:31:01 +0900 Subject: [PATCH 16/16] ARM: tizen_bcm2711_defconfig: Sync with savedefconfig This fixes to synchronize current defconfig with savedefconfig Change-Id: Ia99f98f2d675ae424e796ddbbd087175d9ad3cae Signed-off-by: Dongwoo Lee --- arch/arm/configs/tizen_bcm2711_defconfig | 2 -- 1 file changed, 2 deletions(-) diff --git a/arch/arm/configs/tizen_bcm2711_defconfig b/arch/arm/configs/tizen_bcm2711_defconfig index 90ed4c4..fac41b7 100644 --- a/arch/arm/configs/tizen_bcm2711_defconfig +++ b/arch/arm/configs/tizen_bcm2711_defconfig @@ -51,7 +51,6 @@ CONFIG_KERNEL_MODE_NEON=y # CONFIG_SUSPEND is not set CONFIG_PM=y CONFIG_RASPBERRYPI_FIRMWARE=y -CONFIG_ARM_CRYPTO=y CONFIG_CRYPTO_SHA1_ARM_NEON=y CONFIG_CRYPTO_SHA2_ARM_CE=y CONFIG_CRYPTO_AES_ARM_BS=y @@ -402,7 +401,6 @@ CONFIG_DMA_BCM2708=y CONFIG_SW_SYNC=y CONFIG_STAGING=y CONFIG_STAGING_MEDIA=y -# CONFIG_ANDROID_LOGGER is not set CONFIG_SND_BCM2835=y CONFIG_VIDEO_BCM2835=y CONFIG_VIDEO_CODEC_BCM2835=y -- 2.7.4