platform/kernel/linux-rpi.git
19 months agodrm/v3d: Add gpu_gem_info node via debugfs 77/281477/3 accepted/tizen_7.0_unified_hotfix old/tizen_20221209 tizen_7.0_hotfix accepted/tizen/7.0/unified/20221110.055811 accepted/tizen/7.0/unified/hotfix/20221116.110504 accepted/tizen/unified/20220920.160556 tizen_7.0_m2_release
Seung-Woo Kim [Mon, 19 Sep 2022 10:35:14 +0000 (19:35 +0900)]
drm/v3d: Add gpu_gem_info node via debugfs

Add gpu_gem_info node via debugfs of dri debug sysfs for each
process with pid/tgid and its gem objects. Same gem object can be
opened from multiple processes, so from the gpu_gem_info node,
it can print same gem in multiple lines.

Ported from the commit dea4ace78ec7 ("drm/vc4: Add gem_info node
via debugfs") to v3d.

NOTE: From Raspberry Pi 4 board, v3d gpu is card0 and also render node
in dri card128, so accessing can be from both nodes. For render fixed
node, it is /sys/kernel/debug/dri/128/gpu_gem_info.
Also, Raspberry Pi 4 board gives entire gem count and total size with
/sys/kernel/debug/dri/128/bo_stats.

Change-Id: Ica09a3b92010e15dddc0a7ca117d4544106757f7
Signed-off-by: Seung-Woo Kim <sw0312.kim@samsung.com>
19 months agoMerge "ARM: Support KFENCE for ARM" into tizen
Seung-Woo Kim [Tue, 20 Sep 2022 04:20:09 +0000 (04:20 +0000)]
Merge "ARM: Support KFENCE for ARM" into tizen

19 months agoMerge "ARM: mm: Provide set_memory_valid()" into tizen
Seung-Woo Kim [Tue, 20 Sep 2022 04:20:09 +0000 (04:20 +0000)]
Merge "ARM: mm: Provide set_memory_valid()" into tizen

19 months agoMerge "ARM: mm: Provide is_write_fault()" into tizen
Seung-Woo Kim [Tue, 20 Sep 2022 04:20:09 +0000 (04:20 +0000)]
Merge "ARM: mm: Provide is_write_fault()" into tizen

19 months agoMerge "ARM: 9130/1: mm: Provide die_kernel_fault() helper" into tizen
Seung-Woo Kim [Tue, 20 Sep 2022 04:20:09 +0000 (04:20 +0000)]
Merge "ARM: 9130/1: mm: Provide die_kernel_fault() helper" into tizen

19 months agoMerge "ARM: 9127/1: mm: Cleanup access_error()" into tizen
Seung-Woo Kim [Tue, 20 Sep 2022 04:20:09 +0000 (04:20 +0000)]
Merge "ARM: 9127/1: mm: Cleanup access_error()" into tizen

19 months agoMerge "ARM: 9129/1: mm: Kill task_struct argument for __do_page_fault()" into tizen
Seung-Woo Kim [Tue, 20 Sep 2022 04:20:09 +0000 (04:20 +0000)]
Merge "ARM: 9129/1: mm: Kill task_struct argument for __do_page_fault()" into tizen

19 months agoMerge "ARM: 9128/1: mm: Refactor the __do_page_fault()" into tizen
Seung-Woo Kim [Tue, 20 Sep 2022 04:20:09 +0000 (04:20 +0000)]
Merge "ARM: 9128/1: mm: Refactor the __do_page_fault()" into tizen

19 months agoMerge "kfence: make compatible with kmemleak" into tizen
Seung-Woo Kim [Tue, 20 Sep 2022 04:20:09 +0000 (04:20 +0000)]
Merge "kfence: make compatible with kmemleak" into tizen

19 months agoMerge "kfence, slab: fix cache_alloc_debugcheck_after() for bulk allocations" into...
Seung-Woo Kim [Tue, 20 Sep 2022 04:20:09 +0000 (04:20 +0000)]
Merge "kfence, slab: fix cache_alloc_debugcheck_after() for bulk allocations" into tizen

19 months agoMerge "kfence: fix reports if constant function prefixes exist" into tizen
Seung-Woo Kim [Tue, 20 Sep 2022 04:20:09 +0000 (04:20 +0000)]
Merge "kfence: fix reports if constant function prefixes exist" into tizen

19 months agoMerge "kfence: fix printk format for ptrdiff_t" into tizen
Seung-Woo Kim [Tue, 20 Sep 2022 04:20:09 +0000 (04:20 +0000)]
Merge "kfence: fix printk format for ptrdiff_t" into tizen

19 months agoMerge "kfence: report sensitive information based on no_hash_pointers" into tizen
Seung-Woo Kim [Tue, 20 Sep 2022 04:20:09 +0000 (04:20 +0000)]
Merge "kfence: report sensitive information based on no_hash_pointers" into tizen

19 months agoMerge "Merge tag 'printk-for-5.12' of git://git.kernel.org/pub/scm/linux/kernel/git...
Seung-Woo Kim [Tue, 20 Sep 2022 04:20:09 +0000 (04:20 +0000)]
Merge "Merge tag 'printk-for-5.12' of git://git./linux/kernel/git/printk/linux" into tizen

19 months agoMerge "kfence: show access type in report" into tizen
Seung-Woo Kim [Tue, 20 Sep 2022 04:20:09 +0000 (04:20 +0000)]
Merge "kfence: show access type in report" into tizen

19 months agoMerge "kfence: fix typo in test" into tizen
Seung-Woo Kim [Tue, 20 Sep 2022 04:20:09 +0000 (04:20 +0000)]
Merge "kfence: fix typo in test" into tizen

19 months agoMerge "kfence: Avoid stalling work queue task without allocations" into tizen
Seung-Woo Kim [Tue, 20 Sep 2022 04:20:09 +0000 (04:20 +0000)]
Merge "kfence: Avoid stalling work queue task without allocations" into tizen

19 months agoMerge "kfence: Fix parameter description for kfence_object_start()" into tizen
Seung-Woo Kim [Tue, 20 Sep 2022 04:20:09 +0000 (04:20 +0000)]
Merge "kfence: Fix parameter description for kfence_object_start()" into tizen

19 months agoMerge "kfence: Use pt_regs to generate stack trace on faults" into tizen
Seung-Woo Kim [Tue, 20 Sep 2022 04:20:09 +0000 (04:20 +0000)]
Merge "kfence: Use pt_regs to generate stack trace on faults" into tizen

19 months agoMerge "MAINTAINERS: add entry for KFENCE" into tizen
Seung-Woo Kim [Tue, 20 Sep 2022 04:20:09 +0000 (04:20 +0000)]
Merge "MAINTAINERS: add entry for KFENCE" into tizen

19 months agoMerge "kfence: add test suite" into tizen
Seung-Woo Kim [Tue, 20 Sep 2022 04:20:09 +0000 (04:20 +0000)]
Merge "kfence: add test suite" into tizen

19 months agoMerge "kfence, Documentation: add KFENCE documentation" into tizen
Seung-Woo Kim [Tue, 20 Sep 2022 04:20:09 +0000 (04:20 +0000)]
Merge "kfence, Documentation: add KFENCE documentation" into tizen

19 months agoMerge "kfence, kasan: make KFENCE compatible with KASAN" into tizen
Seung-Woo Kim [Tue, 20 Sep 2022 04:20:09 +0000 (04:20 +0000)]
Merge "kfence, kasan: make KFENCE compatible with KASAN" into tizen

19 months agoMerge "mm, kfence: insert KFENCE hooks for SLUB" into tizen
Seung-Woo Kim [Tue, 20 Sep 2022 04:20:09 +0000 (04:20 +0000)]
Merge "mm, kfence: insert KFENCE hooks for SLUB" into tizen

19 months agoMerge "mm, kfence: insert KFENCE hooks for SLAB" into tizen
Seung-Woo Kim [Tue, 20 Sep 2022 04:20:09 +0000 (04:20 +0000)]
Merge "mm, kfence: insert KFENCE hooks for SLAB" into tizen

19 months agoMerge "arm64, kfence: enable KFENCE for ARM64" into tizen
Seung-Woo Kim [Tue, 20 Sep 2022 04:20:09 +0000 (04:20 +0000)]
Merge "arm64, kfence: enable KFENCE for ARM64" into tizen

19 months agoMerge "x86, kfence: enable KFENCE for x86" into tizen
Seung-Woo Kim [Tue, 20 Sep 2022 04:20:09 +0000 (04:20 +0000)]
Merge "x86, kfence: enable KFENCE for x86" into tizen

19 months agoMerge "mm: add Kernel Electric-Fence infrastructure" into tizen
Seung-Woo Kim [Tue, 20 Sep 2022 04:20:09 +0000 (04:20 +0000)]
Merge "mm: add Kernel Electric-Fence infrastructure" into tizen

19 months agoARM: Support KFENCE for ARM 63/281563/1
Kefeng Wang [Mon, 15 Nov 2021 13:48:48 +0000 (21:48 +0800)]
ARM: Support KFENCE for ARM

Add architecture specific implementation details for KFENCE and enable
KFENCE on ARM. In particular, this implements the required interface in
 <asm/kfence.h>.

KFENCE requires that attributes for pages from its memory pool can
individually be set. Therefore, force the kfence pool to be mapped
at page granularity.

Testing this patch using the testcases in kfence_test.c and all passed
with or without ARM_LPAE.

Acked-by: Marco Elver <elver@google.com>
Signed-off-by: Kefeng Wang <wangkefeng.wang@huawei.com>
Link: https://lore.kernel.org/linux-arm-kernel/20211115134848.171098-4-wangkefeng.wang@huawei.com/
[port for kfence feature to rpi-5.10.95]
Signed-off-by: Marek Szyprowski <m.szyprowski@samsung.com>
Signed-off-by: Seung-Woo Kim <sw0312.kim@samsung.com>
Change-Id: Ib2afb1c98fb5bf437f68766fe391ac9bc118f6ad

19 months agoARM: mm: Provide set_memory_valid() 62/281562/1
Kefeng Wang [Mon, 15 Nov 2021 13:48:46 +0000 (21:48 +0800)]
ARM: mm: Provide set_memory_valid()

This function validates and invalidates PTE entries, it will be used
in the later patch.

Acked-by: Marco Elver <elver@google.com>
Signed-off-by: Kefeng Wang <wangkefeng.wang@huawei.com>
Link: https://lore.kernel.org/linux-arm-kernel/20211115134848.171098-2-wangkefeng.wang@huawei.com/
[port for kfence feature to rpi-5.10.95]
Signed-off-by: Marek Szyprowski <m.szyprowski@samsung.com>
Signed-off-by: Seung-Woo Kim <sw0312.kim@samsung.com>
Change-Id: I2da9a932f8d0961d72afb49f23f574784ffa2b36

19 months agoARM: mm: Provide is_write_fault() 61/281561/1
Kefeng Wang [Mon, 15 Nov 2021 13:48:47 +0000 (21:48 +0800)]
ARM: mm: Provide is_write_fault()

The function will check whether the fault is caused by a write access,
it will be called in die_kernel_fault() too in next patch, so put it
before the function of die_kernel_fault().

Acked-by: Marco Elver <elver@google.com>
Signed-off-by: Kefeng Wang <wangkefeng.wang@huawei.com>
Link: https://lore.kernel.org/linux-arm-kernel/20211115134848.171098-3-wangkefeng.wang@huawei.com/
[port for kfence feature to rpi-5.10.95]
Signed-off-by: Marek Szyprowski <m.szyprowski@samsung.com>
Signed-off-by: Seung-Woo Kim <sw0312.kim@samsung.com>
Change-Id: I489b056ed9cbd8c4dbab142f3f9e26dbd727189f

19 months agoARM: 9130/1: mm: Provide die_kernel_fault() helper 60/281560/1
Wang Kefeng [Wed, 22 Sep 2021 13:56:31 +0000 (14:56 +0100)]
ARM: 9130/1: mm: Provide die_kernel_fault() helper

Provide die_kernel_fault() helper to do the kernel fault reporting,
which with msg argument, it could report different message in different
scenes, and the later patch "ARM: mm: Fix PXN process with LPAE feature"
will use it.

Signed-off-by: Kefeng Wang <wangkefeng.wang@huawei.com>
Signed-off-by: Russell King (Oracle) <rmk+kernel@armlinux.org.uk>
[backport of mainline commit 2e707106fac7f81f780d7c76770a726c46757a84]
Signed-off-by: Marek Szyprowski <m.szyprowski@samsung.com>
Signed-off-by: Seung-Woo Kim <sw0312.kim@samsung.com>
Change-Id: I4143a6323aef64f05752616f27361a2f92f33e8e

19 months agoARM: 9127/1: mm: Cleanup access_error() 59/281559/1
Wang Kefeng [Wed, 22 Sep 2021 13:56:29 +0000 (14:56 +0100)]
ARM: 9127/1: mm: Cleanup access_error()

Now the write fault check in do_page_fault() and access_error() twice,
we can cleanup access_error(), and make the fault check and vma flags set
into do_page_fault() directly, then pass the vma flags to __do_page_fault.

No functional change.

Signed-off-by: Kefeng Wang <wangkefeng.wang@huawei.com>
Signed-off-by: Russell King (Oracle) <rmk+kernel@armlinux.org.uk>
[backport of mainline commit f177b06ed7d56c1d8256769d1a6e1feec90153dc]
Signed-off-by: Marek Szyprowski <m.szyprowski@samsung.com>
Signed-off-by: Seung-Woo Kim <sw0312.kim@samsung.com>
Change-Id: I87a54628bad2b5ed14cc2fbaaa5b8f547d90294f

19 months agoARM: 9129/1: mm: Kill task_struct argument for __do_page_fault() 58/281558/1
Wang Kefeng [Wed, 22 Sep 2021 13:56:28 +0000 (14:56 +0100)]
ARM: 9129/1: mm: Kill task_struct argument for __do_page_fault()

The __do_page_fault() won't use task_struct argument, kill it
and also use current->mm directly in do_page_fault().

No functional change.

Signed-off-by: Kefeng Wang <wangkefeng.wang@huawei.com>
Signed-off-by: Russell King (Oracle) <rmk+kernel@armlinux.org.uk>
[backport of mainline commit 488cab12c37169687015fbdfa8be7b0da42f3146]
Signed-off-by: Marek Szyprowski <m.szyprowski@samsung.com>
Signed-off-by: Seung-Woo Kim <sw0312.kim@samsung.com>
Change-Id: I754182937867caad76e7fd5179eb35f697082cec

19 months agoARM: 9128/1: mm: Refactor the __do_page_fault() 57/281557/1
Wang Kefeng [Wed, 22 Sep 2021 13:56:27 +0000 (14:56 +0100)]
ARM: 9128/1: mm: Refactor the __do_page_fault()

Clean up the multiple goto statements and drops local variable
vm_fault_t fault, which will make the __do_page_fault() much more
readability.

No functional change.

Signed-off-by: Kefeng Wang <wangkefeng.wang@huawei.com>
Signed-off-by: Russell King (Oracle) <rmk+kernel@armlinux.org.uk>
[backport of mainline commit caed89dab0ca0e73d7e016c04e1f5957650f4ec3]
Signed-off-by: Marek Szyprowski <m.szyprowski@samsung.com>
Signed-off-by: Seung-Woo Kim <sw0312.kim@samsung.com>
Change-Id: Ice8f005ae5aa4cc54a983a377d89657511bfa632

19 months agokfence: make compatible with kmemleak 56/281556/1
Marco Elver [Wed, 17 Mar 2021 08:47:40 +0000 (09:47 +0100)]
kfence: make compatible with kmemleak

Because memblock allocations are registered with kmemleak, the KFENCE
pool was seen by kmemleak as one large object. Later allocations through
kfence_alloc() that were registered with kmemleak via
slab_post_alloc_hook() would then overlap and trigger a warning.
Therefore, once the pool is initialized, we can remove (free) it from
kmemleak again, since it should be treated as allocator-internal and be
seen as "free memory".

The second problem is that kmemleak is passed the rounded size, and not
the originally requested size, which is also the size of KFENCE objects.
To avoid kmemleak scanning past the end of an object and trigger a
KFENCE out-of-bounds error, fix the size if it is a KFENCE object.

For simplicity, to avoid a call to kfence_ksize() in
slab_post_alloc_hook() (and avoid new IS_ENABLED(CONFIG_DEBUG_KMEMLEAK)
guard), just call kfence_ksize() in mm/kmemleak.c:create_object().

Reported-by: Luis Henriques <lhenriques@suse.de>
Cc: Catalin Marinas <catalin.marinas@arm.com>
Signed-off-by: Marco Elver <elver@google.com>
Reviewed-by: Catalin Marinas <catalin.marinas@arm.com>
Tested-by: Luis Henriques <lhenriques@suse.de>
[port kfence feature to rpi-5.10.95]
Signed-off-by: Sung-hun Kim <sfoon.kim@samsung.com>
Signed-off-by: Marek Szyprowski <m.szyprowski@samsung.com>
Signed-off-by: Seung-Woo Kim <sw0312.kim@samsung.com>
Change-Id: Id820bc92f5fa8ca766b63c64101bdc7f13f96a46

19 months agokfence, slab: fix cache_alloc_debugcheck_after() for bulk allocations 55/281555/1
Marco Elver [Thu, 4 Mar 2021 20:52:56 +0000 (21:52 +0100)]
kfence, slab: fix cache_alloc_debugcheck_after() for bulk allocations

cache_alloc_debugcheck_after() performs checks on an object, including
adjusting the returned pointer. None of this should apply to KFENCE
objects. While for non-bulk allocations, the checks are skipped when we
allocate via KFENCE, for bulk allocations cache_alloc_debugcheck_after()
is called via cache_alloc_debugcheck_after_bulk().

Fix it by skipping cache_alloc_debugcheck_after() for KFENCE objects.

Signed-off-by: Marco Elver <elver@google.com>
[port kfence feature to rpi-5.10.95]
Signed-off-by: Sung-hun Kim <sfoon.kim@samsung.com>
Signed-off-by: Marek Szyprowski <m.szyprowski@samsung.com>
Signed-off-by: Seung-Woo Kim <sw0312.kim@samsung.com>
Change-Id: I07e1131fb1659455be3ac7e65147e627de63520a

19 months agokfence: fix reports if constant function prefixes exist 54/281554/1
Marco Elver [Thu, 4 Mar 2021 14:40:00 +0000 (15:40 +0100)]
kfence: fix reports if constant function prefixes exist

Some architectures prefix all functions with a constant string ('.' on
ppc64). Add ARCH_FUNC_PREFIX, which may optionally be defined in
<asm/kfence.h>, so that get_stack_skipnr() can work properly.

Link: https://lkml.kernel.org/r/f036c53d-7e81-763c-47f4-6024c6c5f058@csgroup.eu
Reported-by: Christophe Leroy <christophe.leroy@csgroup.eu>
Tested-by: Christophe Leroy <christophe.leroy@csgroup.eu>
Signed-off-by: Marco Elver <elver@google.com>
[port kfence feature to rpi-5.10.95]
Signed-off-by: Sung-hun Kim <sfoon.kim@samsung.com>
Signed-off-by: Marek Szyprowski <m.szyprowski@samsung.com>
Signed-off-by: Seung-Woo Kim <sw0312.kim@samsung.com>
Change-Id: If0898f06ef741cc25dc0eaed3c4e2095ffe420f5

19 months agokfence: fix printk format for ptrdiff_t 53/281553/1
Marco Elver [Wed, 3 Mar 2021 12:11:57 +0000 (13:11 +0100)]
kfence: fix printk format for ptrdiff_t

Use %td for ptrdiff_t.

Link: https://lkml.kernel.org/r/3abbe4c9-16ad-c168-a90f-087978ccd8f7@csgroup.eu
Reported-by: Christophe Leroy <christophe.leroy@csgroup.eu>
Signed-off-by: Marco Elver <elver@google.com>
Reviewed-by: Alexander Potapenko <glider@google.com>
[port kfence feature to rpi-5.10.95]
Signed-off-by: Sung-hun Kim <sfoon.kim@samsung.com>
Signed-off-by: Marek Szyprowski <m.szyprowski@samsung.com>
Signed-off-by: Seung-Woo Kim <sw0312.kim@samsung.com>
Change-Id: I1311862fe3bba39d7837c271a95e3513c8ef2c66

19 months agokfence: report sensitive information based on no_hash_pointers 52/281552/1
Marco Elver [Tue, 23 Feb 2021 08:20:43 +0000 (09:20 +0100)]
kfence: report sensitive information based on no_hash_pointers

We cannot rely on CONFIG_DEBUG_KERNEL to decide if we're running a
"debug kernel" where we can safely show potentially sensitive
information in the kernel log.

Instead, simply rely on the newly introduced "no_hash_pointers" to print
unhashed kernel pointers, as well as decide if our reports can include
other potentially sensitive information such as registers and corrupted
bytes.

Cc: Timur Tabi <timur@kernel.org>
Signed-off-by: Marco Elver <elver@google.com>
[port kfence feature to rpi-5.10.95]
Signed-off-by: Sung-hun Kim <sfoon.kim@samsung.com>
Signed-off-by: Marek Szyprowski <m.szyprowski@samsung.com>
Signed-off-by: Seung-Woo Kim <sw0312.kim@samsung.com>
Change-Id: Ie87a49f890db5a49503afe50e63d908247eb31a3

19 months agoMerge tag 'printk-for-5.12' of git://git.kernel.org/pub/scm/linux/kernel/git/printk... 51/281551/1
Linus Torvalds [Mon, 22 Feb 2021 19:04:36 +0000 (11:04 -0800)]
Merge tag 'printk-for-5.12' of git://git./linux/kernel/git/printk/linux

Pull printk updates from Petr Mladek:

 - New "no_hash_pointers" kernel parameter causes that %p shows raw
   pointer values instead of hashed ones. It is intended only for
   debugging purposes. Misuse is prevented by a fat warning message that
   is inspired by trace_printk().

 - Prevent a possible deadlock when flushing printk_safe buffers during
   panic().

 - Fix performance regression caused by the lockless printk ringbuffer.
   It was visible with huge log buffer and long messages.

 - Documentation fix-up.

* tag 'printk-for-5.12' of git://git.kernel.org/pub/scm/linux/kernel/git/printk/linux:
  lib/vsprintf: no_hash_pointers prints all addresses as unhashed
  kselftest: add support for skipped tests
  lib: use KSTM_MODULE_GLOBALS macro in kselftest drivers
  printk: avoid prb_first_valid_seq() where possible
  printk: fix deadlock when kernel panic
  printk: rectify kernel-doc for prb_rec_init_wr()

[port kfence feature to rpi-5.10.95]
Signed-off-by: Sung-hun Kim <sfoon.kim@samsung.com>
Signed-off-by: Marek Szyprowski <m.szyprowski@samsung.com>
Signed-off-by: Seung-Woo Kim <sw0312.kim@samsung.com>
Change-Id: I13558832bbd4970d2b35f39db052df735a6ced4f

19 months agokfence: show access type in report 50/281550/1
Marco Elver [Mon, 11 Jan 2021 09:15:44 +0000 (10:15 +0100)]
kfence: show access type in report

Show the access type in KFENCE reports by plumbing through read/write
information from the page fault handler. Update the documentation and
test accordingly.

Suggested-by: Jörn Engel <joern@purestorage.com>
Signed-off-by: Marco Elver <elver@google.com>
Reviewed-by: Jörn Engel <joern@purestorage.com>
[port kfence feature to rpi-5.10.95]
Signed-off-by: Sung-hun Kim <sfoon.kim@samsung.com>
Signed-off-by: Marek Szyprowski <m.szyprowski@samsung.com>
Signed-off-by: Seung-Woo Kim <sw0312.kim@samsung.com>
Change-Id: I9bae89e3fb99fe4c87ad17ab76c731ba91c6f830

19 months agokfence: fix typo in test 49/281549/1
Marco Elver [Tue, 15 Dec 2020 23:31:12 +0000 (00:31 +0100)]
kfence: fix typo in test

Fix a typo/accidental copy-paste that resulted in the obviously
incorrect 'GFP_KERNEL * 2' expression.

Reported-by: kernel test robot <lkp@intel.com>
Signed-off-by: Marco Elver <elver@google.com>
Acked-by: Alexander Potapenko <glider@google.com>
[port kfence feature to rpi-5.10.95]
Signed-off-by: Sung-hun Kim <sfoon.kim@samsung.com>
Signed-off-by: Marek Szyprowski <m.szyprowski@samsung.com>
Signed-off-by: Seung-Woo Kim <sw0312.kim@samsung.com>
Change-Id: I157e9378f99fe2b1db005ee402dc0cdb6fe54164

19 months agokfence: Avoid stalling work queue task without allocations 48/281548/1
Marco Elver [Tue, 10 Nov 2020 13:53:20 +0000 (14:53 +0100)]
kfence: Avoid stalling work queue task without allocations

To toggle the allocation gates, we set up a delayed work that calls
toggle_allocation_gate(). Here we use wait_event() to await an
allocation and subsequently disable the static branch again. However, if
the kernel has stopped doing allocations entirely, we'd wait
indefinitely, and stall the worker task. This may also result in the
appropriate warnings if CONFIG_DETECT_HUNG_TASK=y.

Therefore, introduce a 1 second timeout and use wait_event_timeout(). If
the timeout is reached, the static branch is disabled and a new delayed
work is scheduled to try setting up an allocation at a later time.

Note that, this scenario is very unlikely during normal workloads once
the kernel has booted and user space tasks are running. It can, however,
happen during early boot after KFENCE has been enabled, when e.g.
running tests that do not result in any allocations.

Link: https://lkml.kernel.org/r/CADYN=9J0DQhizAGB0-jz4HOBBh+05kMBXb4c0cXMS7Qi5NAJiw@mail.gmail.com
Reported-by: Anders Roxell <anders.roxell@linaro.org>
Signed-off-by: Marco Elver <elver@google.com>
[port kfence feature to rpi-5.10.95]
Signed-off-by: Sung-hun Kim <sfoon.kim@samsung.com>
Signed-off-by: Marek Szyprowski <m.szyprowski@samsung.com>
Signed-off-by: Seung-Woo Kim <sw0312.kim@samsung.com>
Change-Id: Ia4e37404fce3497d6c9d32cae23ffa5d106055da

19 months agokfence: Fix parameter description for kfence_object_start() 47/281547/1
Marco Elver [Fri, 6 Nov 2020 09:21:49 +0000 (10:21 +0100)]
kfence: Fix parameter description for kfence_object_start()

Describe parameter @addr correctly by delimiting with ':'.

Reported-by: Stephen Rothwell <sfr@canb.auug.org.au>
Signed-off-by: Marco Elver <elver@google.com>
Reviewed-by: Alexander Potapenko <glider@google.com>
[port kfence feature to rpi-5.10.95]
Signed-off-by: Sung-hun Kim <sfoon.kim@samsung.com>
Signed-off-by: Marek Szyprowski <m.szyprowski@samsung.com>
Signed-off-by: Seung-Woo Kim <sw0312.kim@samsung.com>
Change-Id: I8b0d1b892c343d42683899054adeb911a0676449

19 months agokfence: Use pt_regs to generate stack trace on faults 46/281546/1
Marco Elver [Thu, 5 Nov 2020 09:21:33 +0000 (10:21 +0100)]
kfence: Use pt_regs to generate stack trace on faults

Instead of removing the fault handling portion of the stack trace based
on the fault handler's name, just use struct pt_regs directly.

Change kfence_handle_page_fault() to take a struct pt_regs, and plumb it
through to kfence_report_error() for out-of-bounds, use-after-free, or
invalid access errors, where pt_regs is used to generate the stack
trace.

If the kernel is a DEBUG_KERNEL, also show registers for more
information.

Suggested-by: Mark Rutland <mark.rutland@arm.com>
Signed-off-by: Marco Elver <elver@google.com>
Acked-by: Mark Rutland <mark.rutland@arm.com>
[port kfence feature to rpi-5.10.95]
Signed-off-by: Sung-hun Kim <sfoon.kim@samsung.com>
Signed-off-by: Marek Szyprowski <m.szyprowski@samsung.com>
Signed-off-by: Seung-Woo Kim <sw0312.kim@samsung.com>
Change-Id: I58550db6cbed87fd6315df821b2c249f8ab3a330

19 months agoMAINTAINERS: add entry for KFENCE 45/281545/1
Marco Elver [Tue, 3 Nov 2020 17:58:41 +0000 (18:58 +0100)]
MAINTAINERS: add entry for KFENCE

Add entry for KFENCE maintainers.

Reviewed-by: Dmitry Vyukov <dvyukov@google.com>
Reviewed-by: SeongJae Park <sjpark@amazon.de>
Co-developed-by: Alexander Potapenko <glider@google.com>
Signed-off-by: Alexander Potapenko <glider@google.com>
Signed-off-by: Marco Elver <elver@google.com>
[port kfence feature to rpi-5.10.95]
Signed-off-by: Sung-hun Kim <sfoon.kim@samsung.com>
Signed-off-by: Marek Szyprowski <m.szyprowski@samsung.com>
Signed-off-by: Seung-Woo Kim <sw0312.kim@samsung.com>
Change-Id: I4b60248d9eb9b3d5194f4e26379cdd62bd2ab0e2

19 months agokfence: add test suite 44/281544/1
Marco Elver [Tue, 3 Nov 2020 17:58:40 +0000 (18:58 +0100)]
kfence: add test suite

Add KFENCE test suite, testing various error detection scenarios. Makes
use of KUnit for test organization. Since KFENCE's interface to obtain
error reports is via the console, the test verifies that KFENCE outputs
expected reports to the console.

Reviewed-by: Dmitry Vyukov <dvyukov@google.com>
Co-developed-by: Alexander Potapenko <glider@google.com>
Signed-off-by: Alexander Potapenko <glider@google.com>
Signed-off-by: Marco Elver <elver@google.com>
Reviewed-by: Jann Horn <jannh@google.com>
[port kfence feature to rpi-5.10.95]
Signed-off-by: Sung-hun Kim <sfoon.kim@samsung.com>
Signed-off-by: Marek Szyprowski <m.szyprowski@samsung.com>
Signed-off-by: Seung-Woo Kim <sw0312.kim@samsung.com>
Change-Id: I53be34fd941da7928e02f7d3fd18536e62a0bc3e

19 months agokfence, Documentation: add KFENCE documentation 43/281543/1
Marco Elver [Tue, 3 Nov 2020 17:58:39 +0000 (18:58 +0100)]
kfence, Documentation: add KFENCE documentation

Add KFENCE documentation in dev-tools/kfence.rst, and add to index.

Reviewed-by: Dmitry Vyukov <dvyukov@google.com>
Co-developed-by: Alexander Potapenko <glider@google.com>
Signed-off-by: Alexander Potapenko <glider@google.com>
Signed-off-by: Marco Elver <elver@google.com>
Reviewed-by: Jann Horn <jannh@google.com>
[port kfence feature to rpi-5.10.95]
Signed-off-by: Sung-hun Kim <sfoon.kim@samsung.com>
Signed-off-by: Marek Szyprowski <m.szyprowski@samsung.com>
Signed-off-by: Seung-Woo Kim <sw0312.kim@samsung.com>
Change-Id: I8747dbbd292a396b812f4255985faa95c11d74e7

19 months agokfence, kasan: make KFENCE compatible with KASAN 42/281542/1
Alexander Potapenko [Tue, 3 Nov 2020 17:58:38 +0000 (18:58 +0100)]
kfence, kasan: make KFENCE compatible with KASAN

Make KFENCE compatible with KASAN. Currently this helps test KFENCE
itself, where KASAN can catch potential corruptions to KFENCE state, or
other corruptions that may be a result of freepointer corruptions in the
main allocators.

Reviewed-by: Dmitry Vyukov <dvyukov@google.com>
Reviewed-by: Jann Horn <jannh@google.com>
Co-developed-by: Marco Elver <elver@google.com>
Signed-off-by: Marco Elver <elver@google.com>
Signed-off-by: Alexander Potapenko <glider@google.com>
[port kfence feature to rpi-5.10.95]
Signed-off-by: Sung-hun Kim <sfoon.kim@samsung.com>
Signed-off-by: Marek Szyprowski <m.szyprowski@samsung.com>
Signed-off-by: Seung-Woo Kim <sw0312.kim@samsung.com>
Change-Id: Ia2ef98d6a2c24d599b0646ca37a0312a201497b9

19 months agomm, kfence: insert KFENCE hooks for SLUB 41/281541/1
Alexander Potapenko [Tue, 3 Nov 2020 17:58:37 +0000 (18:58 +0100)]
mm, kfence: insert KFENCE hooks for SLUB

Inserts KFENCE hooks into the SLUB allocator.

To pass the originally requested size to KFENCE, add an argument
'orig_size' to slab_alloc*(). The additional argument is required to
preserve the requested original size for kmalloc() allocations, which
uses size classes (e.g. an allocation of 272 bytes will return an object
of size 512). Therefore, kmem_cache::size does not represent the
kmalloc-caller's requested size, and we must introduce the argument
'orig_size' to propagate the originally requested size to KFENCE.

Without the originally requested size, we would not be able to detect
out-of-bounds accesses for objects placed at the end of a KFENCE object
page if that object is not equal to the kmalloc-size class it was
bucketed into.

When KFENCE is disabled, there is no additional overhead, since
slab_alloc*() functions are __always_inline.

Reviewed-by: Dmitry Vyukov <dvyukov@google.com>
Reviewed-by: Jann Horn <jannh@google.com>
Co-developed-by: Marco Elver <elver@google.com>
Signed-off-by: Marco Elver <elver@google.com>
Signed-off-by: Alexander Potapenko <glider@google.com>
[port kfence feature to rpi-5.10.95]
Signed-off-by: Sung-hun Kim <sfoon.kim@samsung.com>
Signed-off-by: Marek Szyprowski <m.szyprowski@samsung.com>
Signed-off-by: Seung-Woo Kim <sw0312.kim@samsung.com>
Change-Id: Id2b0d64b10cc68d176c935dea3b7135bf2190d1f

19 months agomm, kfence: insert KFENCE hooks for SLAB 40/281540/1
Alexander Potapenko [Tue, 3 Nov 2020 17:58:36 +0000 (18:58 +0100)]
mm, kfence: insert KFENCE hooks for SLAB

Inserts KFENCE hooks into the SLAB allocator.

To pass the originally requested size to KFENCE, add an argument
'orig_size' to slab_alloc*(). The additional argument is required to
preserve the requested original size for kmalloc() allocations, which
uses size classes (e.g. an allocation of 272 bytes will return an object
of size 512). Therefore, kmem_cache::size does not represent the
kmalloc-caller's requested size, and we must introduce the argument
'orig_size' to propagate the originally requested size to KFENCE.

Without the originally requested size, we would not be able to detect
out-of-bounds accesses for objects placed at the end of a KFENCE object
page if that object is not equal to the kmalloc-size class it was
bucketed into.

When KFENCE is disabled, there is no additional overhead, since
slab_alloc*() functions are __always_inline.

Reviewed-by: Dmitry Vyukov <dvyukov@google.com>
Co-developed-by: Marco Elver <elver@google.com>
Signed-off-by: Marco Elver <elver@google.com>
Signed-off-by: Alexander Potapenko <glider@google.com>
[port kfence feature to rpi-5.10.95]
Signed-off-by: Sung-hun Kim <sfoon.kim@samsung.com>
Signed-off-by: Marek Szyprowski <m.szyprowski@samsung.com>
Signed-off-by: Seung-Woo Kim <sw0312.kim@samsung.com>
Change-Id: I3a5660422a01623a21468f3ff62d506725fa11ed

19 months agoarm64, kfence: enable KFENCE for ARM64 39/281539/1
Marco Elver [Tue, 3 Nov 2020 17:58:35 +0000 (18:58 +0100)]
arm64, kfence: enable KFENCE for ARM64

Add architecture specific implementation details for KFENCE and enable
KFENCE for the arm64 architecture. In particular, this implements the
required interface in <asm/kfence.h>.

KFENCE requires that attributes for pages from its memory pool can
individually be set. Therefore, force the entire linear map to be mapped
at page granularity. Doing so may result in extra memory allocated for
page tables in case rodata=full is not set; however, currently
CONFIG_RODATA_FULL_DEFAULT_ENABLED=y is the default, and the common case
is therefore not affected by this change.

Reviewed-by: Dmitry Vyukov <dvyukov@google.com>
Co-developed-by: Alexander Potapenko <glider@google.com>
Signed-off-by: Alexander Potapenko <glider@google.com>
Signed-off-by: Marco Elver <elver@google.com>
Reviewed-by: Jann Horn <jannh@google.com>
Reviewed-by: Mark Rutland <mark.rutland@arm.com>
[port kfence feature to rpi-5.10.95]
Signed-off-by: Sung-hun Kim <sfoon.kim@samsung.com>
Signed-off-by: Marek Szyprowski <m.szyprowski@samsung.com>
Signed-off-by: Seung-Woo Kim <sw0312.kim@samsung.com>
Change-Id: I1cb00f8faea0324b850f4c5879a51b1721bc155f

19 months agox86, kfence: enable KFENCE for x86 38/281538/1
Alexander Potapenko [Tue, 3 Nov 2020 17:58:34 +0000 (18:58 +0100)]
x86, kfence: enable KFENCE for x86

Add architecture specific implementation details for KFENCE and enable
KFENCE for the x86 architecture. In particular, this implements the
required interface in <asm/kfence.h> for setting up the pool and
providing helper functions for protecting and unprotecting pages.

For x86, we need to ensure that the pool uses 4K pages, which is done
using the set_memory_4k() helper function.

Reviewed-by: Dmitry Vyukov <dvyukov@google.com>
Co-developed-by: Marco Elver <elver@google.com>
Signed-off-by: Marco Elver <elver@google.com>
Signed-off-by: Alexander Potapenko <glider@google.com>
Reviewed-by: Jann Horn <jannh@google.com>
[port kfence feature to rpi-5.10.95]
Signed-off-by: Sung-hun Kim <sfoon.kim@samsung.com>
Signed-off-by: Marek Szyprowski <m.szyprowski@samsung.com>
Signed-off-by: Seung-Woo Kim <sw0312.kim@samsung.com>
Change-Id: Idfebe6e03d9bda5de4bd6d0084f65bd0feda8d8a

19 months agomm: add Kernel Electric-Fence infrastructure 37/281537/1
Alexander Potapenko [Tue, 3 Nov 2020 17:58:33 +0000 (18:58 +0100)]
mm: add Kernel Electric-Fence infrastructure

This adds the Kernel Electric-Fence (KFENCE) infrastructure. KFENCE is a
low-overhead sampling-based memory safety error detector of heap
use-after-free, invalid-free, and out-of-bounds access errors.

KFENCE is designed to be enabled in production kernels, and has near
zero performance overhead. Compared to KASAN, KFENCE trades performance
for precision. The main motivation behind KFENCE's design, is that with
enough total uptime KFENCE will detect bugs in code paths not typically
exercised by non-production test workloads. One way to quickly achieve a
large enough total uptime is when the tool is deployed across a large
fleet of machines.

KFENCE objects each reside on a dedicated page, at either the left or
right page boundaries. The pages to the left and right of the object
page are "guard pages", whose attributes are changed to a protected
state, and cause page faults on any attempted access to them. Such page
faults are then intercepted by KFENCE, which handles the fault
gracefully by reporting a memory access error. To detect out-of-bounds
writes to memory within the object's page itself, KFENCE also uses
pattern-based redzones. The following figure illustrates the page
layout:

  ---+-----------+-----------+-----------+-----------+-----------+---
     | xxxxxxxxx | O :       | xxxxxxxxx |       : O | xxxxxxxxx |
     | xxxxxxxxx | B :       | xxxxxxxxx |       : B | xxxxxxxxx |
     | x GUARD x | J : RED-  | x GUARD x | RED-  : J | x GUARD x |
     | xxxxxxxxx | E :  ZONE | xxxxxxxxx |  ZONE : E | xxxxxxxxx |
     | xxxxxxxxx | C :       | xxxxxxxxx |       : C | xxxxxxxxx |
     | xxxxxxxxx | T :       | xxxxxxxxx |       : T | xxxxxxxxx |
  ---+-----------+-----------+-----------+-----------+-----------+---

Guarded allocations are set up based on a sample interval (can be set
via kfence.sample_interval). After expiration of the sample interval, a
guarded allocation from the KFENCE object pool is returned to the main
allocator (SLAB or SLUB). At this point, the timer is reset, and the
next allocation is set up after the expiration of the interval.

To enable/disable a KFENCE allocation through the main allocator's
fast-path without overhead, KFENCE relies on static branches via the
static keys infrastructure. The static branch is toggled to redirect the
allocation to KFENCE. To date, we have verified by running synthetic
benchmarks (sysbench I/O, hackbench) that a kernel compiled with KFENCE
is performance-neutral compared to the non-KFENCE baseline.

For more details, see Documentation/dev-tools/kfence.rst (added later in
the series).

Reviewed-by: Dmitry Vyukov <dvyukov@google.com>
Reviewed-by: SeongJae Park <sjpark@amazon.de>
Co-developed-by: Marco Elver <elver@google.com>
Signed-off-by: Marco Elver <elver@google.com>
Signed-off-by: Alexander Potapenko <glider@google.com>
Reviewed-by: Jann Horn <jannh@google.com>
[port kfence feature to rpi-5.10.95]
Signed-off-by: Sung-hun Kim <sfoon.kim@samsung.com>
Signed-off-by: Marek Szyprowski <m.szyprowski@samsung.com>
Signed-off-by: Seung-Woo Kim <sw0312.kim@samsung.com>
Change-Id: I03cc6246dd8436b86e0681a1b3015bf0d142db67

19 months agoarm64/mm: define arch_get_mappable_range() 36/281536/1
Anshuman Khandual [Fri, 26 Feb 2021 01:17:37 +0000 (17:17 -0800)]
arm64/mm: define arch_get_mappable_range()

This overrides arch_get_mappable_range() on arm64 platform which will be
used with recently added generic framework.  It drops
inside_linear_region() and subsequent check in arch_add_memory() which are
no longer required.  It also adds a VM_BUG_ON() check that would ensure
that mhp_range_allowed() has already been called.

Link: https://lkml.kernel.org/r/1612149902-7867-3-git-send-email-anshuman.khandual@arm.com
Signed-off-by: Anshuman Khandual <anshuman.khandual@arm.com>
Reviewed-by: David Hildenbrand <david@redhat.com>
Reviewed-by: Catalin Marinas <catalin.marinas@arm.com>
Cc: Will Deacon <will@kernel.org>
Cc: Ard Biesheuvel <ardb@kernel.org>
Cc: Mark Rutland <mark.rutland@arm.com>
Cc: Heiko Carstens <hca@linux.ibm.com>
Cc: Jason Wang <jasowang@redhat.com>
Cc: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Cc: "Michael S. Tsirkin" <mst@redhat.com>
Cc: Michal Hocko <mhocko@kernel.org>
Cc: Oscar Salvador <osalvador@suse.de>
Cc: Pankaj Gupta <pankaj.gupta@cloud.ionos.com>
Cc: Pankaj Gupta <pankaj.gupta.linux@gmail.com>
Cc: teawater <teawaterz@linux.alibaba.com>
Cc: Vasily Gorbik <gor@linux.ibm.com>
Cc: Wei Yang <richard.weiyang@linux.alibaba.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
[port kfence feature to rpi-5.10.95]
Signed-off-by: Sung-hun Kim <sfoon.kim@samsung.com>
Signed-off-by: Marek Szyprowski <m.szyprowski@samsung.com>
Signed-off-by: Seung-Woo Kim <sw0312.kim@samsung.com>
Change-Id: I6c68c5b0382419a98a3ae03045790e0078e47898

23 months agoARM64: tizen_bcm2711: disable configurations for fTHP 25/275825/1 accepted/tizen/unified/20220607.135045 submit/tizen/20220603.011425
Sung-hun Kim [Thu, 2 Jun 2022 08:32:47 +0000 (17:32 +0900)]
ARM64: tizen_bcm2711: disable configurations for fTHP

Disable configurations for fTHP (CONFIG_TRANSPARENT_HUGEPAGE,
CONFIG_READ_ONLY_THP_FOR_FS, CONFIG_FINEGRAINED_THP) on
Tizen-7.0.

Change-Id: If17a7a582a019ad7b45b982102282aa12d4bd23f
Signed-off-by: Sung-hun Kim <sfoon.kim@samsung.com>
23 months agomm: LKSM: fix a bug in the filter length calculation 86/275286/3 accepted/tizen/unified/20220525.010040 submit/tizen/20220520.083127
Sung-hun Kim [Thu, 19 May 2022 11:53:02 +0000 (20:53 +0900)]
mm: LKSM: fix a bug in the filter length calculation

Since type of a size variable in the calculation of the
filter length is signed integer, it can make a buggy
situation when the size of a vma is bigger than a range
of a signed integer variable. In this case, the size is
treated as a negative number. As a result, it incurs a
kernel bug at BUG_ON(size < 0).

This patch changes types of variables and members in
lksm_region data structure from signed integer to unsigned
long. Additionally, remove an assertion BUG_ON(size < 0)
because the size never be a negative number.

Change-Id: I822a2ba5d372596ee55dcbec90a019fdf1dc2416
Signed-off-by: Sung-hun Kim <sfoon.kim@samsung.com>
2 years agoARM/ARM64: tizen_bcm2711: enable CONFIG_RTL8192CU_VENDOR 07/274307/1 accepted/tizen/unified/20220426.132008 submit/tizen/20220426.064823
Jaehoon Chung [Tue, 26 Apr 2022 05:33:01 +0000 (14:33 +0900)]
ARM/ARM64: tizen_bcm2711: enable CONFIG_RTL8192CU_VENDOR

Enable CONFIG_RTL8192CU_VENDOR as module.

Change-Id: Ic3e8954b432bafda47b50dbc1f30c922035435b1
Signed-off-by: Jaehoon Chung <jh80.chung@samsung.com>
2 years agonet: rtl8192cu: fix wrong configuration in Makefile 06/274306/1
Jaehoon Chung [Tue, 26 Apr 2022 04:36:16 +0000 (13:36 +0900)]
net: rtl8192cu: fix wrong configuration in Makefile

RTL8192CU_VENDOR is to distinguish with mainline and non-mainlne.
RTL8192CU_VENDOR is for non-mainline. So it needs to use
CONFIG_RTL8192CU_VENDOR instead of CONFIG_RTL8182CU.

It's why rtl8192cu dongle doesn't work in RPI4 target.

Change-Id: I93a50f5db3a965fdb4d8ee1e5a70d3956d5f6679
Signed-off-by: Jaehoon Chung <jh80.chung@samsung.com>
2 years agoARM64: tizen_bcm2711_defconfig: enable configs reelvant to RT2800USB 86/273986/1 accepted/tizen/unified/20220421.065408 submit/tizen/20220420.021401
Jaehoon Chung [Tue, 19 Apr 2022 11:11:40 +0000 (20:11 +0900)]
ARM64: tizen_bcm2711_defconfig: enable configs reelvant to RT2800USB

To use USB Wifi, enable configs relevant to RT2800USB.

Change-Id: Ib0b0f6f65d0e2a6420e2fd220a29fcccbce68c94
Signed-off-by: Jaehoon Chung <jh80.chung@samsung.com>
2 years agoARM/ARM64: tizen_bcm2711_defconfig: Enable RT_GROUP_SCHED config 26/273626/1 accepted/tizen/unified/20220412.100326 submit/tizen/20220412.011006
Jaehoon Chung [Mon, 11 Apr 2022 00:48:04 +0000 (09:48 +0900)]
ARM/ARM64: tizen_bcm2711_defconfig: Enable RT_GROUP_SCHED config

Enable RT_GROUP_SCHED configuration to use the cgroup scheduling.

Change-Id: Iab166b7ab312a780b77316118194af1999abc4fb
Signed-off-by: Jaehoon Chung <jh80.chung@samsung.com>
2 years agoUSB: serial: cp210x: add cp210x-stlink driver 24/273524/1 submit/tizen/20220408.063105
Seung-Woo Kim [Wed, 6 Apr 2022 10:55:03 +0000 (19:55 +0900)]
USB: serial: cp210x: add cp210x-stlink driver

Support usb st-link device and its application, add fixed
version of cp210x driver.

Change-Id: Ic1d1a54723697cabf55545d708e2e92f8caddee2
Signed-off-by: Seung-Woo Kim <sw0312.kim@samsung.com>
2 years agoRevert "USB: serial: cp210x: add support smartthings link devices" 23/273523/1
Seung-Woo Kim [Wed, 6 Apr 2022 10:52:06 +0000 (19:52 +0900)]
Revert "USB: serial: cp210x: add support smartthings link devices"

This reverts commit e28a9455eb7dc4b50a718b278678d3a1671f2f5c.

The app for st link uses gpio ioctls not in normal cp210x
driver and it will be supported with new driver instead of
changing existing cp210x.

Change-Id: I76d126ae88ddf2f0cfc7b6fffcca930741be2388
Signed-off-by: Seung-Woo Kim <sw0312.kim@samsung.com>
2 years agoARM/ARM64: tizen_bcm2711_defconfig: Enable BT_HCIBTUSB config 29/273329/2 accepted/tizen/unified/20220406.211810 submit/tizen/20220405.050852
Jaehoon Chung [Mon, 4 Apr 2022 10:48:10 +0000 (19:48 +0900)]
ARM/ARM64: tizen_bcm2711_defconfig: Enable BT_HCIBTUSB config

Enable CONFIG_BT_HCIBTUSB config.
Tizen GHI image is using the USB BT device. To test BT, it needs to enable.

Change-Id: Ic1a233dd10978ee6cd7b9535c4cf240352605bd6
Signed-off-by: Jaehoon Chung <jh80.chung@samsung.com>
2 years agoUSB: serial: cp210x: add support smartthings link devices 60/273060/1 accepted/tizen/unified/20220331.010042 submit/tizen/20220330.085114
Seung-Woo Kim [Wed, 30 Mar 2022 06:33:57 +0000 (15:33 +0900)]
USB: serial: cp210x: add support smartthings link devices

Add support smartthings link devices.

Change-Id: I54293b816779754f987d876272b1c1a145d9baf2
Signed-off-by: Seung-Woo Kim <sw0312.kim@samsung.com>
2 years agoarm64: tizen_bcm2711_defconfig: disaple framebuffer console 98/272798/3
Marek Szyprowski [Thu, 24 Mar 2022 11:44:01 +0000 (12:44 +0100)]
arm64: tizen_bcm2711_defconfig: disaple framebuffer console

Framebuffer (both simplefb and drm-based) are not really needed for Tizen,
so disable them. This is a workaround for the RPi4 firmware bug, which
block HDMI0 vblank handling on full-HD displays.

Signed-off-by: Marek Szyprowski <m.szyprowski@samsung.com>
Change-Id: I6ce8446fe257c27ce6f009dbd16e21b0851da41f

2 years agoarm: tizen_bcm2711_defconfig: disaple framebuffer console 99/272799/3
Marek Szyprowski [Thu, 24 Mar 2022 12:27:41 +0000 (13:27 +0100)]
arm: tizen_bcm2711_defconfig: disaple framebuffer console

Framebuffer (both simplefb and drm-based) are not really needed for Tizen,
so disable them. This is a workaround for the RPi4 firmware bug, which
block HDMI0 vblank handling on full-HD displays.

Signed-off-by: Marek Szyprowski <m.szyprowski@samsung.com>
Change-Id: Ic576a8d25b049d366363a5d1eb7aff0a6c6b126b

2 years agoRevert "kdbus: Add magic value" 77/272277/3 accepted/tizen/unified/20220321.141048 submit/tizen/20220321.065423
Seung-Woo Kim [Mon, 14 Mar 2022 04:23:06 +0000 (13:23 +0900)]
Revert "kdbus: Add magic value"

This reverts commit 5d79c163177419f0be2b0c9d6c644df39038f4c0.

The kdbus magic value is moved to linux-tizen-modules-source tree,
so commit in kernel tree is not anymore required.

Change-Id: I2a98f750b525a659fd341f59f584f0955c5dcc82
Ref: https://git.tizen.org/cgit/platform/kernel/linux-tizen-modules-source/commit/?h=tizen&id=adf25c245d67f341520c77fda3adccd1c76a2bff
Signed-off-by: Seung-Woo Kim <sw0312.kim@samsung.com>
2 years agoscript: update build-rpi4 script to support RT kernel build 52/272352/1
Seung-Woo Kim [Tue, 15 Mar 2022 06:53:59 +0000 (15:53 +0900)]
script: update build-rpi4 script to support RT kernel build

Update build-rpi4 script to support RT kernel build.

Change-Id: I6f6e8e7579b4ae10defc4110949135f0459871ed
Signed-off-by: Seung-Woo Kim <sw0312.kim@samsung.com>
2 years agopackaging: change a file name to _localversion-rt 45/272345/1
Jaehoon Chung [Tue, 15 Mar 2022 05:11:01 +0000 (14:11 +0900)]
packaging: change a file name to _localversion-rt

Change a file name from localversion-rt to _localversion-rt.

Change-Id: I3a8663aa8f3baab6006c554aafaa13b090b72471
Signed-off-by: Jaehoon Chung <jh80.chung@samsung.com>
2 years agolib/iov_iter: initialize "flags" in new pipe_buffer 78/272278/2 accepted/tizen/unified/20220315.132332 submit/tizen/20220314.051607
Max Kellermann [Mon, 21 Feb 2022 10:03:13 +0000 (11:03 +0100)]
lib/iov_iter: initialize "flags" in new pipe_buffer

commit 9d2231c5d74e13b2a0546fee6737ee4446017903 upstream.

The functions copy_page_to_iter_pipe() and push_pipe() can both
allocate a new pipe_buffer, but the "flags" member initializer is
missing.

Fixes: 241699cd72a8 ("new iov_iter flavour: pipe-backed")
To: Alexander Viro <viro@zeniv.linux.org.uk>
To: linux-fsdevel@vger.kernel.org
To: linux-kernel@vger.kernel.org
Cc: stable@vger.kernel.org
Signed-off-by: Max Kellermann <max.kellermann@ionos.com>
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
[sw0312.kim: chery-pick linux-5.10.y stable commit b19ec7afa929 to resolve CVE-2022-0847]
Signed-off-by: Seung-Woo Kim <sw0312.kim@samsung.com>
Change-Id: Ie8e16157cca8dc16f9b1f222889aa8ed15c281b9

2 years agospec: Build rt packages 56/271956/3 accepted/tizen/unified/20220313.220453 submit/tizen/20220311.061629
Łukasz Stelmach [Thu, 3 Mar 2022 12:51:19 +0000 (13:51 +0100)]
spec: Build rt packages

Build a second set of packages with PREEMPT_RT enabled

Change-Id: I1c0ec964f68eda41d6c628b0476a5246045171ad
Signed-off-by: Łukasz Stelmach <l.stelmach@samsung.com>
2 years agoAdd tizen_bcm2711_rt_defconfig for arm and arm64 60/271960/2
Łukasz Stelmach [Wed, 2 Feb 2022 20:34:57 +0000 (21:34 +0100)]
Add tizen_bcm2711_rt_defconfig for arm and arm64

Add defconfigfiles with PREEMPT_RT enabled

Change-Id: I58b17d42cfa35ba9bd24c8109cd71f33fe3cd7be
Signed-off-by: Łukasz Stelmach <l.stelmach@samsung.com>
2 years agoprintk: suppress printing less important messages to console 67/272067/2
Łukasz Stelmach [Mon, 7 Mar 2022 23:22:54 +0000 (00:22 +0100)]
printk: suppress printing less important messages to console

Suppress printing to console messages with loglevel above the
console_loglevel via print_sync().

Change-Id: Ia8d53fd2fadb74e323d776f053c91f7832402021
Fixes: 5d6a5a2378db ("patch-5.10.100-rt62.patch")
Signed-off-by: Łukasz Stelmach <l.stelmach@samsung.com>
2 years agopatch-5.10.100-rt62.patch 59/271959/1
Luis Claudio R. Goncalves [Fri, 18 Feb 2022 13:33:21 +0000 (14:33 +0100)]
patch-5.10.100-rt62.patch

Apply PREEMPT_RT patch 5.10.100-rt62.

Change-Id: Ifc945830d28bb3ac251e611043cc625e656eceda
Signed-off-by: Łukasz Stelmach <l.stelmach@samsung.com>
2 years agokernel: delete repeated words in comments 58/271958/1
Randy Dunlap [Fri, 26 Feb 2021 01:21:10 +0000 (17:21 -0800)]
kernel: delete repeated words in comments

[ Upstream commit c034f48e99907d5be147ac8f0f3e630a9307c2be ]

Drop repeated words in kernel/events/.
{if, the, that, with, time}

Drop repeated words in kernel/locking/.
{it, no, the}

Drop repeated words in kernel/sched/.
{in, not}

Change-Id: I15382584b650bb8fe5732946fa27a51b4e8a9d96
Link: https://lkml.kernel.org/r/20210127023412.26292-1-rdunlap@infradead.org
Signed-off-by: Randy Dunlap <rdunlap@infradead.org>
Acked-by: Will Deacon <will@kernel.org> [kernel/locking/]
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Ingo Molnar <mingo@redhat.com>
Cc: Arnaldo Carvalho de Melo <acme@kernel.org>
Cc: Will Deacon <will@kernel.org>
Cc: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Cc: "Paul E. McKenney" <paulmck@kernel.org>
Cc: Juri Lelli <juri.lelli@redhat.com>
Cc: Vincent Guittot <vincent.guittot@linaro.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
2 years agocpuset: Fix the bug that subpart_cpus updated wrongly in update_cpumask() 57/271957/1
Tianchen Ding [Tue, 18 Jan 2022 10:05:18 +0000 (18:05 +0800)]
cpuset: Fix the bug that subpart_cpus updated wrongly in update_cpumask()

commit c80d401c52a2d1baf2a5afeb06f0ffe678e56d23 upstream.

subparts_cpus should be limited as a subset of cpus_allowed, but it is
updated wrongly by using cpumask_andnot(). Use cpumask_and() instead to
fix it.

Change-Id: Ic7a654e9f101a27115a767535e5534a9f4ab4010
Fixes: ee8dde0cd2ce ("cpuset: Add new v2 cpuset.sched.partition flag")
Signed-off-by: Tianchen Ding <dtcccc@linux.alibaba.com>
Reviewed-by: Waiman Long <longman@redhat.com>
Signed-off-by: Tejun Heo <tj@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2 years agoARM: dts: bcm2711-rpi-4-b: Set dwc2 mode as peripheral 47/271847/1 accepted/tizen/unified/20220303.131747 submit/tizen/20220302.105130
Dongwoo Lee [Wed, 2 Mar 2022 09:13:13 +0000 (18:13 +0900)]
ARM: dts: bcm2711-rpi-4-b: Set dwc2 mode as peripheral

If dwc2 mode is set to otg, forcing dwc2 mode as peripheral is
proceeded in the early boot time, but since tizen configures the
gadget with configfs after system is prepared. It causes enumeration
problem. To prevent it, default mode will be fixed as peripheral.
Actully, since type-c usb port is only used as power-source and
peripheral port, it is more precise setting though.

Change-Id: I78bc6c683c4d095283219b1ab3066fbe7d0c6e53
Signed-off-by: Dongwoo Lee <dwoo08.lee@samsung.com>
2 years agoWORKAROUND: Revert "staging: bcm2835-codec: Format changed should trigger drain" 63/271163/1 accepted/tizen/unified/20220217.153341 submit/tizen/20220216.082647
Seung-Woo Kim [Wed, 16 Feb 2022 07:57:00 +0000 (16:57 +0900)]
WORKAROUND: Revert "staging: bcm2835-codec: Format changed should trigger drain"

This reverts commit b7e6b495eff31298ba4665f71b2414cc9a8f99c2.

When setting last buffer done on format changed event, bcm2835-codec does not
work for decoding because it recognizes there is no queued buffer even it is
not well fit for v4l2 codec spec. Maybe it is because v4l2 codec gst plugin
v4l2 usage is not up to date in tizen. Until properly fixing it, revert it
to support video h/w decoding on rpi4 in tizen.

Change-Id: Id7d77ee57e58d42eab5a080d63eb8eb1518e6f7a
Signed-off-by: Seung-Woo Kim <sw0312.kim@samsung.com>
2 years agoRevert "cgroup: Disable cgroup "memory" by default" 79/270879/1 accepted/tizen/unified/20220214.130941 submit/tizen/20220210.111655 submit/tizen/20220211.080709 submit/tizen/20220214.011104 submit/tizen/20220214.055223
Dongwoo Lee [Thu, 10 Feb 2022 10:33:23 +0000 (19:33 +0900)]
Revert "cgroup: Disable cgroup "memory" by default"

This reverts commit 2b13c54592135b6fab269517ed687fa9f80bf8e5.

The feature is used for saving memory which is consumed by memcg-related
structure (32bytes per 4K page), but now it is no longer merged on the
latest raspberry pi kernel. So instead of enabling memory cgroup by
adding command to cmdline.txt while preserving this feature, in order to
enable memory cgroup by default, this reverts commit '2b13c5459213
("cgroup: Disable cgroup "memory" by default")'

Change-Id: I1830129125fb44b36bfe64f97fddf329ea795c3c
Signed-off-by: Dongwoo Lee <dwoo08.lee@samsung.com>
Signed-off-by: Seung-Woo Kim <sw0312.kim@samsung.com>
2 years agokdbus: Add magic value submit/tizen/20220208.095838 submit/tizen/20220210.062658
Adrian Szyndela [Fri, 9 Sep 2016 11:35:49 +0000 (13:35 +0200)]
kdbus: Add magic value

[partially picked from commit 216823ac83c0ab89348e2ed6f66179f53626586e]

except of all the kdbus driver, add magic value of it only.

Original authors of the files are those from commit 216823ac83c0ab8934.

Cherry-picked from 4.14 commit 970070c4f68f113284f86cf7b6fbd23d6b35b511.

Change-Id: Id60af5faf794fc4ae7122976621076f1021f6c38
Signed-off-by: Adrian Szyndela <adrian.s@samsung.com>
Signed-off-by: Hyotaek Shim <hyotaek.shim@samsung.com>
Signed-off-by: Łukasz Stelmach <l.stelmach@samsung.com>
Signed-off-by: Seung-Woo Kim <sw0312.kim@samsung.com>
2 years agokdbus: export needed symbols for out-of-tree support submit/tizen/20220208.090027
Mateusz Majewski [Thu, 25 Nov 2021 13:32:07 +0000 (14:32 +0100)]
kdbus: export needed symbols for out-of-tree support

We have been asked to move kdbus out-of-tree. It uses a couple
unexported symbols, so we need to (grudgingly) export them.

Change-Id: Ide04c46bbc71f8fffbdefca68959e1048af1c905
Signed-off-by: Mateusz Majewski <m.majewski2@samsung.com>
2 years agokdbus: Revert "fs: unexport poll_schedule_timeout" submit/tizen/20220208.084703
Łukasz Stelmach [Mon, 21 Dec 2020 11:40:27 +0000 (12:40 +0100)]
kdbus: Revert "fs: unexport poll_schedule_timeout"

This reverts commit 8f546ae1fc5ce8396827d4868c7eee1f1cc6947a.

Change-Id: I5429471eeb092c55a50e37c0b642d50d69daebc7
Signed-off-by: Łukasz Stelmach <l.stelmach@samsung.com>
2 years agopackaging: Added '.gbs.conf' for partial build submit/tizen/20220208.075603
Jaechul Lee [Mon, 30 Jan 2017 23:58:22 +0000 (08:58 +0900)]
packaging: Added '.gbs.conf' for partial build

Added gbs configuration file for enhanced building.
it makes gbs build faster than before.

https://source.tizen.org/documentation/reference/git-build-system/maintenance-models-supported-gbs

Change-Id: I79d57aa5eb49d0fbfa9a3744ec2acb032a274e5e
Signed-off-by: Jaechul Lee <jcsing.lee@samsung.com>
Signed-off-by: Joonyoung Shim <jy0922.shim@samsung.com>
2 years agomm: thp: Revert "mm, thp: preventing hugepage creation for read-write file pages" 73/270673/3 submit/tizen/20220208.074352
Marek Szyprowski [Tue, 8 Feb 2022 07:16:00 +0000 (08:16 +0100)]
mm: thp: Revert "mm, thp: preventing hugepage creation for read-write file pages"

Once the issue with modified read-only files has been fixed by the commit
"mm: thp: avoid mapping a 64kB THP when anonymous COW-ed pages exist",
this workaround is no longer needed.

This reverts commit bca41ebfc598858807071491cdb85f61773d8a77.

Signed-off-by: Marek Szyprowski <m.szyprowski@samsung.com>
Change-Id: I3df73b53fffe6dc49bbc844852aff68e4157582b

2 years agomm: thp: Avoid mapping a 64kB THP when anonymous COW-ed pages exist 72/270672/3
Marek Szyprowski [Tue, 30 Nov 2021 12:41:31 +0000 (13:41 +0100)]
mm: thp: Avoid mapping a 64kB THP when anonymous COW-ed pages exist

For the given read-only file there might exist copy-on-write anonymous
pages (e.g. when application has modified something in its .data
section).

Presence of such pages causes that the retract_page_tables() function in
mm/khugepaged.c skips retracting their PTE entries, even if the original
(unmodified) file pages have been replaced by the khugepaged with 64kB
THP. Those COW-ed pages remain mapped with 4kB entries.

When read-fault happens on the adjacent page, kernel checks if it can be
mapped with 64kB entry. Without a check for non-NULL vma->anon_vma the
4kB entries for the COW-ed pages will be replaced by the 64kB entries for
the unmodiffied pages of the original file.

This issue has not been observed for 2MB THPs, because PMD-fault (related
to 2MB THP size) doesn't happen if there are any pages still mapped with
4kB TLB entries.

This fixes the random crashes when CONFIG_THP_CONSERVATIVE mode is
enabled.

Signed-off-by: Marek Szyprowski <m.szyprowski@samsung.com>
Change-Id: Ic1d87b887f589894732e1c1066123aa88f4f582d

2 years agomm: thp: Fix condition check for THP creation 71/270671/3
Marek Szyprowski [Mon, 7 Feb 2022 07:32:16 +0000 (08:32 +0100)]
mm: thp: Fix condition check for THP creation

The 'hend' is already THP-aligned, so the proper check should be
exclusive. This fixes forcing 64kB THP pages for the last 2MB of each
process memory area.

Signed-off-by: Marek Szyprowski <m.szyprowski@samsung.com>
Change-Id: I0b2187f1e045bc61207122f0162fdb145214ddad

2 years agoARM: tizen_bcm2711_defconfig: Enable defconfig for touchscreen 28/270728/2
Hoegeun Kwon [Tue, 8 Feb 2022 05:52:25 +0000 (14:52 +0900)]
ARM: tizen_bcm2711_defconfig: Enable defconfig for touchscreen

Required defconfig for 7inch touchscreen operation.

Change-Id: I428d3569ec09e20a8cc44df2b41c00446710059a
Signed-off-by: Hoegeun Kwon <hoegeun.kwon@samsung.com>
2 years agoarm64: tizen_bcm2711_defconfig: Enable defconfig for touchscreen 38/270738/1
Hoegeun Kwon [Tue, 8 Feb 2022 05:52:19 +0000 (14:52 +0900)]
arm64: tizen_bcm2711_defconfig: Enable defconfig for touchscreen

Required defconfig for 7inch touchscreen operation.

Change-Id: I19a35976e0e7782a79275f56c14ebdba82099ec3
Signed-off-by: Hoegeun Kwon <hoegeun.kwon@samsung.com>
2 years agorpi4: boot: config: Add ignore_lcd flag for 7inch touchscreen 37/270737/1
Hoegeun Kwon [Tue, 8 Feb 2022 05:52:16 +0000 (14:52 +0900)]
rpi4: boot: config: Add ignore_lcd flag for 7inch touchscreen

Add flag for 7inch touchscreen operation.

Change-Id: Ie750ae0e00daf8448515ba0c4c4596168114882a
Signed-off-by: Hoegeun Kwon <hoegeun.kwon@samsung.com>
2 years agodrm/vc4: Fix to wait for attach call and return as bind success 36/270736/1
Hoegeun Kwon [Tue, 8 Feb 2022 05:52:13 +0000 (14:52 +0900)]
drm/vc4: Fix to wait for attach call and return as bind success

If the panel is not connected, the attach function is not called and a
bridge node is not created. In Tizen, dsi_bind operates as drm vc4
when dsi_bind is normally terminated. After waiting 5 attach calls,
dsi_bind returns to success.

Change-Id: I89b29752d63f5152415df3327cb47790d1b03979
Signed-off-by: Hoegeun Kwon <hoegeun.kwon@samsung.com>
2 years agoARM: dts: bcm2711-rpi-4-b: Add vc4-kms-dsi-7inch overlay 35/270735/1
Hoegeun Kwon [Tue, 8 Feb 2022 05:52:09 +0000 (14:52 +0900)]
ARM: dts: bcm2711-rpi-4-b: Add vc4-kms-dsi-7inch overlay

Add vc4-kms-dsi-7inch overlay as built-in DT.

Change-Id: I15ec96afbababd31185c287ecdf6ab52463dcec6
Signed-off-by: Hoegeun Kwon <hoegeun.kwon@samsung.com>
2 years agoWORKAROUND: drm/vc4: hdmi: Remove warn for pm_runtime_status 34/270734/1
Hoegeun Kwon [Tue, 8 Feb 2022 05:52:06 +0000 (14:52 +0900)]
WORKAROUND: drm/vc4: hdmi: Remove warn for pm_runtime_status

Remove check warn for pm_runtime_status_suspended. Actually resume
state, but confirmed as suspend state. Resolved from firmwares
v5.10.47.

Change-Id: I1f1505588440cccc18acdd285a356bdf8da48f96
Signed-off-by: Hoegeun Kwon <hoegeun.kwon@samsung.com>
2 years agorpi4: boot: Update the firmwares for kernel v5.10.46 33/270733/1
Hoegeun Kwon [Tue, 8 Feb 2022 05:52:03 +0000 (14:52 +0900)]
rpi4: boot: Update the firmwares for kernel v5.10.46

Update the firmwares with the latest version from the vendor git repo.

The commit base is "d06e0ef85c22 kernel: Bump to 5.10.46"

Since firmwares v5.10.47, there is an issue where HDMI-0 UHD does not
work. So we apply firmwaresv5.10.46.

Change-Id: Iffd23e0e866284ea68a42136ce735f5412e59f25
Signed-off-by: Hoegeun Kwon <hoegeun.kwon@samsung.com>
2 years agopackaging: Change the kernel version of the spec file 32/270732/1
Hoegeun Kwon [Tue, 8 Feb 2022 05:51:59 +0000 (14:51 +0900)]
packaging: Change the kernel version of the spec file

Change the kernel version to 5.10.95

Change-Id: Ia92dc3b1750e4cc693608bdc06f8bb32efcc8722
Signed-off-by: Hoegeun Kwon <hoegeun.kwon@samsung.com>
2 years agoARM: tizen_bcm2711_defconfig: Enable vc4_hdmi_cec 31/270731/1
Hoegeun Kwon [Tue, 8 Feb 2022 05:51:56 +0000 (14:51 +0900)]
ARM: tizen_bcm2711_defconfig: Enable vc4_hdmi_cec

CEC driver is required for hdmi operation.

Change-Id: I4f6333945affe0230c78d38e456f5daee91883f2
Signed-off-by: Hoegeun Kwon <hoegeun.kwon@samsung.com>
2 years agoarm64: tizen_bcm2711_defconfig: Enable vc4_hdmi_cec 30/270730/1
Hoegeun Kwon [Tue, 8 Feb 2022 05:51:53 +0000 (14:51 +0900)]
arm64: tizen_bcm2711_defconfig: Enable vc4_hdmi_cec

CEC driver is required for hdmi operation.

Change-Id: I2b63797641163a4da088b492c05c3d957fbaa208
Signed-off-by: Hoegeun Kwon <hoegeun.kwon@samsung.com>
2 years agoARM: dts: bcm2711-rpi-4-b: Enable aon_intr driver 29/270729/1
Hoegeun Kwon [Tue, 8 Feb 2022 05:51:46 +0000 (14:51 +0900)]
ARM: dts: bcm2711-rpi-4-b: Enable aon_intr driver

The  Set Top Box Level 2 Interrupt controller required to use drm.

Change-Id: Ibe417dbb6f1e6372ef73c70dd812d543bf7a9d83
Signed-off-by: Hoegeun Kwon <hoegeun.kwon@samsung.com>
2 years agomisc/trinity: Fix invalid spdx identifiers for uapi haeder
Seung-Woo Kim [Wed, 5 Jan 2022 07:10:38 +0000 (16:10 +0900)]
misc/trinity: Fix invalid spdx identifiers for uapi haeder

The user api header requires "WITH Linux-syscall-note" for
SPDX-License-Identifier when installing. Without it, the command
"make headers_install" fails. To fix it, add proper spdx license
identifier for uapi header.

Change-Id: I95272a29b6808d32eea0e5e95c399a43705f1c96
Fixes: commit 12fc392663db ("misc/trinity: Add trinity npu driver")
Signed-off-by: Seung-Woo Kim <sw0312.kim@samsung.com>