GitHub/exynos8895/android_kernel_samsung_universal8895.git
2 years agoBACKPORT: zsmalloc: require GFP in zs_malloc()
Sergey Senozhatsky [Fri, 20 May 2016 23:59:48 +0000 (16:59 -0700)]
BACKPORT: zsmalloc: require GFP in zs_malloc()

Pass GFP flags to zs_malloc() instead of using a fixed mask supplied to
zs_create_pool(), so we can be more flexible, but, more importantly, we
need this to switch zram to per-cpu compression streams -- zram will try
to allocate handle with preemption disabled in a fast path and switch to
a slow path (using different gfp mask) if the fast one has failed.

Apart from that, this also align zs_malloc() interface with zspool/zbud.

[sergey.senozhatsky@gmail.com: pass GFP flags to zs_malloc() instead of using a fixed mask]
Link: http://lkml.kernel.org/r/20160429150942.GA637@swordfish
Link: http://lkml.kernel.org/r/20160429150942.GA637@swordfish
Signed-off-by: Sergey Senozhatsky <sergey.senozhatsky@gmail.com>
Acked-by: Minchan Kim <minchan@kernel.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
(cherry picked from commit d0d8da2dc49dfdfe1d788eaf4d55eb5d4964d926)
Signed-off-by: Peter Kalauskas <peskal@google.com>
Bug: 112488418
Change-Id: I31276c9351be21a4ed588681b332e98142b76526

2 years agoUPSTREAM: zram/zcomp: do not zero out zcomp private pages
Sergey Senozhatsky [Thu, 14 Jan 2016 23:22:35 +0000 (15:22 -0800)]
UPSTREAM: zram/zcomp: do not zero out zcomp private pages

Do not __GFP_ZERO allocated zcomp ->private pages.  We keep allocated
streams around and use them for read/write requests, so we supply a
zeroed out ->private to compression algorithm as a scratch buffer only
once -- the first time we use that stream.  For the rest of IO requests
served by this stream ->private usually contains some temporarily data
from the previous requests.

Signed-off-by: Sergey Senozhatsky <sergey.senozhatsky@gmail.com>
Acked-by: Minchan Kim <minchan@kernel.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
(cherry picked from commit e02d238c9852a91b30da9ea32ce36d1416cdc683)
Signed-off-by: Peter Kalauskas <peskal@google.com>
Bug: 112488418
Change-Id: I911832da703f596998a4139d6033ef1564848c9e

2 years agoUPSTREAM: zram: pass gfp from zcomp frontend to backend
Minchan Kim [Thu, 14 Jan 2016 23:22:32 +0000 (15:22 -0800)]
UPSTREAM: zram: pass gfp from zcomp frontend to backend

Each zcomp backend uses own gfp flag but it's pointless because the
context they could be called is driven by upper layer(ie, zcomp
frontend).  As well, zcomp frondend could call them in different
context.  One context(ie, zram init part) is it should be better to make
sure successful allocation other context(ie, further stream allocation
part for accelarating I/O speed) is just optional so let's pass gfp down
from driver (ie, zcomp frontend) like normal MM convention.

[sergey.senozhatsky@gmail.com: add missing __vmalloc zero and highmem gfps]
Signed-off-by: Minchan Kim <minchan@kernel.org>
Signed-off-by: Sergey Senozhatsky <sergey.senozhatsky@gmail.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
(cherry picked from commit 75d8947a36d0c9aedd69118d1f14bf424005c7c2)
Signed-off-by: Peter Kalauskas <peskal@google.com>
Bug: 112488418
Change-Id: I572d0565de5aff94ebe0782eba9d34f9c9862060

2 years agogud: fix mobicore initialization
Stricted [Wed, 28 Aug 2019 15:26:26 +0000 (15:26 +0000)]
gud: fix mobicore initialization

* backported from s9

Change-Id: I48476e899495490ded64a9e173e3daa3c4cdafa0

2 years agovideo: mdnie: fix lux node permissions
Stricted [Mon, 26 Aug 2019 18:03:34 +0000 (18:03 +0000)]
video: mdnie: fix lux node permissions

2 years agovideo: mdnie: Lift RGB tuning restrictions
Christopher N. Hesse [Fri, 27 Jan 2017 23:07:07 +0000 (00:07 +0100)]
video: mdnie: Lift RGB tuning restrictions

Change-Id: Ibbf1efd2aa19a2790773bd84da3364cfeffffe4b

2 years agoBACKPORT: ARM64: dts: msm: Mount the system partition during early init
Swetha Chikkaboraiah [Mon, 10 Jul 2017 06:06:21 +0000 (11:36 +0530)]
BACKPORT: ARM64: dts: msm: Mount the system partition during early init

Add support to early mount system partition so that system
modules can be loaded during early init for msm8226 and msm8974.

Change-Id: I9d75bec6ff9bada5ab2db6de2a58e40323aa6ca2

2 years agofs: ifdef samsung zswap lmkd integration
Michael Benedict [Mon, 26 Aug 2019 15:48:44 +0000 (01:48 +1000)]
fs: ifdef samsung zswap lmkd integration

Signed-off-by: Michael Benedict <michaelbt@live.com>
2 years agodefconfig: enable zram
Michael Benedict [Mon, 26 Aug 2019 15:39:00 +0000 (01:39 +1000)]
defconfig: enable zram

Signed-off-by: Michael Benedict <michaelbt@live.com>
2 years agodefconfig: sync
Michael Benedict [Mon, 26 Aug 2019 15:37:03 +0000 (01:37 +1000)]
defconfig: sync

Signed-off-by: Michael Benedict <michaelbt@live.com>
2 years agocrypto: fix section mismatch
Michael Benedict [Thu, 6 Jun 2019 13:53:14 +0000 (23:53 +1000)]
crypto: fix section mismatch

Signed-off-by: Michael Benedict <michaelbt@live.com>
2 years agodefconfig: disable crypto_fips
Michael Benedict [Thu, 6 Jun 2019 13:49:37 +0000 (23:49 +1000)]
defconfig: disable crypto_fips

Signed-off-by: Michael Benedict <michaelbt@live.com>
2 years agoEnable CONFIG_NETFILTER_XT_TARGET_CT
ivanmeler [Tue, 19 Mar 2019 22:35:32 +0000 (22:35 +0000)]
Enable CONFIG_NETFILTER_XT_TARGET_CT
resolves issues with tethering after november security update

2 years agoARM64: configs: Enable support for sdFAT filesystem
ivanmeler [Tue, 19 Mar 2019 22:34:12 +0000 (22:34 +0000)]
ARM64: configs: Enable support for sdFAT filesystem
 * Update default charset for FAT to UTF-8, matching sdFAT's default.

2 years agofs: sdfat: Add MODULE_ALIAS_FS for supported filesystems
Paul Keith [Wed, 28 Mar 2018 17:52:29 +0000 (19:52 +0200)]
fs: sdfat: Add MODULE_ALIAS_FS for supported filesystems

* This is the proper thing to do for filesystem drivers

Change-Id: I109b201d85e324cc0a72c3fcd09df4a3e1703042
Signed-off-by: Paul Keith <javelinanddart@gmail.com>
2 years agofs: sdfat: Add config option to register sdFAT for VFAT
Paul Keith [Fri, 2 Mar 2018 04:10:27 +0000 (05:10 +0100)]
fs: sdfat: Add config option to register sdFAT for VFAT

Change-Id: I72ba7a14b56175535884390e8601960b5d8ed1cf
Signed-off-by: Paul Keith <javelinanddart@gmail.com>
2 years agofs: sdfat: Add config option to register sdFAT for exFAT
Paul Keith [Fri, 2 Mar 2018 03:51:53 +0000 (04:51 +0100)]
fs: sdfat: Add config option to register sdFAT for exFAT

Change-Id: Id57abf0a4bd0b433fecc622eecb383cd4ea29d17
Signed-off-by: Paul Keith <javelinanddart@gmail.com>
2 years agodos2unix bbdpl Kconfig
Michael Benedict [Sat, 24 Aug 2019 15:47:41 +0000 (01:47 +1000)]
dos2unix bbdpl Kconfig

Signed-off-by: Michael Benedict <michaelbt@live.com>
2 years agoselinux: remove sec_selinux
Michael Benedict [Sat, 25 May 2019 06:57:58 +0000 (16:57 +1000)]
selinux: remove sec_selinux

Signed-off-by: Michael Benedict <michaelbt@live.com>
2 years agoMTP: force generic mtp driver instead of Samsung one
Fevax [Tue, 12 Sep 2017 23:38:33 +0000 (20:38 -0300)]
MTP: force generic mtp driver instead of Samsung one

2 years agoSelinux: force permissive
ivanmeler [Fri, 24 May 2019 10:32:26 +0000 (10:32 +0000)]
Selinux: force permissive

2 years agosigcontext ifdifed 64bit
Fevax [Thu, 7 Sep 2017 02:59:06 +0000 (23:59 -0300)]
sigcontext ifdifed 64bit

2 years agobattery: sec_battery: export {CURRENT/VOLTAGE}_MAX to sysfs
Jesse Chan [Sat, 21 Apr 2018 07:08:51 +0000 (00:08 -0700)]
battery: sec_battery: export {CURRENT/VOLTAGE}_MAX to sysfs

Change-Id: I54c775bb80c2151bdc69ea9fb53a48a34327bbef

2 years agousb: remove tizen if function
Michael Benedict [Wed, 23 Jan 2019 14:13:18 +0000 (21:13 +0700)]
usb: remove tizen if function

Signed-off-by: Michael Benedict <michaelbt@live.com>
2 years agofirmware: convert binary to ihex
Michael Benedict [Sat, 24 Aug 2019 15:42:32 +0000 (01:42 +1000)]
firmware: convert binary to ihex

Signed-off-by: Michael Benedict <michaelbt@live.com>
2 years agodts: import specific dts to each defconfig
Michael Benedict [Fri, 24 May 2019 11:17:51 +0000 (21:17 +1000)]
dts: import specific dts to each defconfig

Signed-off-by: Michael Benedict <michaelbt@live.com>
2 years agonet: ipv4: only use when knox_ncm is enabled
Michael Benedict [Wed, 6 Jun 2018 15:54:25 +0000 (01:54 +1000)]
net: ipv4: only use when knox_ncm is enabled

Signed-off-by: Michael Benedict <michaelbt@live.com>
2 years agodefconfig: disable samsung unnecessary security feature
Michael Benedict [Thu, 21 Feb 2019 13:53:30 +0000 (20:53 +0700)]
defconfig: disable samsung unnecessary security feature

Signed-off-by: Michael Benedict <michaelbt@live.com>
2 years agosource: N950F DSE2
Michael Benedict [Sun, 25 Aug 2019 07:43:22 +0000 (17:43 +1000)]
source: N950F DSE2

2 years agosource: G955F DSE4
Michael Benedict [Sat, 24 Aug 2019 15:39:07 +0000 (01:39 +1000)]
source: G955F DSE4

Signed-off-by: Michael Benedict <michaelbt@live.com>
2 years agosource: G950F DSE4
Michael Benedict [Sat, 24 Aug 2019 15:31:53 +0000 (01:31 +1000)]
source: G950F DSE4

Signed-off-by: Michael Benedict <michaelbt@live.com>
2 years agodriver/battery: wrap around not available values compare
corsicanu [Sun, 1 Mar 2020 20:31:34 +0000 (22:31 +0200)]
driver/battery: wrap around not available values

Signed-off-by: corsicanu <corsicanu22@gmail.com>
2 years agoImport N950FXXSGDUG7 kernel source + dreamlte dt
ivanmeler [Tue, 12 Apr 2022 17:19:01 +0000 (17:19 +0000)]
Import N950FXXSGDUG7 kernel source + dreamlte dt

2 years agoImport dtb for rest of devices
ivanmeler [Tue, 12 Apr 2022 16:49:35 +0000 (16:49 +0000)]
Import dtb for rest of devices

2 years agoG955FXXUCDUD1
ivanmeler [Tue, 12 Apr 2022 14:27:46 +0000 (14:27 +0000)]
G955FXXUCDUD1

2 years agoG955FXXS5DSI1
ivanmeler [Tue, 12 Apr 2022 14:25:09 +0000 (14:25 +0000)]
G955FXXS5DSI1

2 years agoFix compilation of exynos-ss after disabling tracing lineage-18.1
ivanmeler [Tue, 29 Mar 2022 17:12:01 +0000 (17:12 +0000)]
Fix compilation of exynos-ss after disabling tracing

2 years agoexynos8895: regenerate defconfig
ivanmeler [Tue, 29 Mar 2022 16:35:23 +0000 (16:35 +0000)]
exynos8895: regenerate defconfig

2 years agokernel: Fix compilation after disabling tracing
SamarV-121 [Tue, 10 Aug 2021 08:44:46 +0000 (14:14 +0530)]
kernel: Fix compilation after disabling tracing

Change-Id: Ieeb06ec47ad0ffd795d85db0de811ba7eaec2998

2 years agokernel: Disable tracing
SamarV-121 [Tue, 10 Aug 2021 08:44:46 +0000 (14:14 +0530)]
kernel: Disable tracing

 * much less overhead now
 - also, its barely making any diff in app launching speed after disabling iorap.
   tested using `adb logcat | grep Displayed`

Change-Id: I824a55253e472fae7e1f6e0541f4a53eda18e4a9
Signed-off-by: SamarV-121 <samarvispute121@pm.me>
2 years agodrivers: modem_v1: Fix void pointer to enum cast lineage-19.0
ivanmeler [Tue, 29 Mar 2022 18:09:27 +0000 (18:09 +0000)]
drivers: modem_v1: Fix void pointer to enum cast

2 years agodrivers: clk: Fix void pointer to enum cast
Anan Jaser [Tue, 29 Sep 2020 08:03:12 +0000 (12:03 +0400)]
drivers: clk: Fix void pointer to enum cast

drivers/clk/samsung/clk-exynos-audss.c:93:12: error: cast to smaller integer type 'enum exynos_audss_clk_type' from 'const void *' [-Werror,-Wvoid-pointer-to-enum-cast]
        variant = (enum exynos_audss_clk_type)match->data;

2 years agomm: rmap: Fix invalid casting from a void to an enumerator.
Jyotiraditya Panda [Tue, 12 Oct 2021 17:51:03 +0000 (17:51 +0000)]
mm: rmap: Fix invalid casting from a void to an enumerator.
 fixes:

../mm/rmap.c:1344:25: warning: cast to smaller integer type 'enum ttu_flags' from 'void *' [-Wvoid-pointer-to-enum-cast]
        enum ttu_flags flags = (enum ttu_flags)arg;
                               ^~~~~~~~~~~~~~~~~~~

2 years agoRevert "DNM: (chuckles) I'm in danger."
ivanmeler [Tue, 29 Mar 2022 17:36:56 +0000 (17:36 +0000)]
Revert "DNM: (chuckles) I'm in danger."

This reverts commit a25e7b8ba2f7d5bae165d9345e00ed3a31096af8.

2 years agoFix compilation of exynos-ss after disabling tracing
ivanmeler [Tue, 29 Mar 2022 17:12:01 +0000 (17:12 +0000)]
Fix compilation of exynos-ss after disabling tracing

2 years agoexynos8895: regenerate defconfig
ivanmeler [Tue, 29 Mar 2022 16:35:23 +0000 (16:35 +0000)]
exynos8895: regenerate defconfig

2 years agokernel: Fix compilation after disabling tracing
SamarV-121 [Tue, 10 Aug 2021 08:44:46 +0000 (14:14 +0530)]
kernel: Fix compilation after disabling tracing

Change-Id: Ieeb06ec47ad0ffd795d85db0de811ba7eaec2998

2 years agokernel: Disable tracing
SamarV-121 [Tue, 10 Aug 2021 08:44:46 +0000 (14:14 +0530)]
kernel: Disable tracing

 * much less overhead now
 - also, its barely making any diff in app launching speed after disabling iorap.
   tested using `adb logcat | grep Displayed`

Change-Id: I824a55253e472fae7e1f6e0541f4a53eda18e4a9
Signed-off-by: SamarV-121 <samarvispute121@pm.me>
2 years agoarch/arm64: configs: disable CONFIG_RT_GROUP_SCHED
zhenyolka [Tue, 16 Nov 2021 17:22:03 +0000 (20:22 +0300)]
arch/arm64: configs: disable CONFIG_RT_GROUP_SCHED

According to the Kconfig, "if enabled, it will also make it impossible
to schedule realtime tasks for non-root users until you allocate
realtime bandwidth for them."

This fixes the issue of libbluetooth unable to create timer with
SCHED_FIFO thread.

W libc    : pthread_create sched_setscheduler(1, {1}) call failed: Operation not permitted
E bt_osi_alarm: system/bt/osi/src/alarm.cc:683 timer_create_internal: timer_create_internal unable to create timer with clock 7: Operation not permitted

2 years agokernel: sched: fix compilation without CONFIG_RT_GROUP_SCHED
Tim Zimmermann [Sun, 24 Oct 2021 18:52:14 +0000 (20:52 +0200)]
kernel: sched: fix compilation without CONFIG_RT_GROUP_SCHED

Change-Id: If7a3ad6061edc11240f9ad5623afe9888132ea11

3 years agolib/string.c: implement stpcpy
Nick Desaulniers [Thu, 4 Feb 2021 04:58:22 +0000 (10:43 +0545)]
lib/string.c: implement stpcpy

LLVM implemented a recent "libcall optimization" that lowers calls to
`sprintf(dest, "%s", str)` where the return value is used to `stpcpy(dest,
str) - dest`.  This generally avoids the machinery involved in parsing
format strings.  `stpcpy` is just like `strcpy` except it returns the
pointer to the new tail of `dest`.  This optimization was introduced into
clang-12.

Implement this so that we don't observe linkage failures due to missing
symbol definitions for `stpcpy`.

Similar to last year's fire drill with: commit 5f074f3e192f
("lib/string.c: implement a basic bcmp")

The kernel is somewhere between a "freestanding" environment (no full
libc) and "hosted" environment (many symbols from libc exist with the same
type, function signature, and semantics).

As H.  Peter Anvin notes, there's not really a great way to inform the
compiler that you're targeting a freestanding environment but would like
to opt-in to some libcall optimizations (see pr/47280 below), rather than
opt-out.

Arvind notes, -fno-builtin-* behaves slightly differently between GCC and
Clang, and Clang is missing many __builtin_* definitions, which I consider
a bug in Clang and am working on fixing.

Masahiro summarizes the subtle distinction between compilers justly:
  To prevent transformation from foo() into bar(), there are two ways in
  Clang to do that; -fno-builtin-foo, and -fno-builtin-bar.  There is
  only one in GCC; -fno-buitin-foo.

(Any difference in that behavior in Clang is likely a bug from a missing
__builtin_* definition.)

Masahiro also notes:
  We want to disable optimization from foo() to bar(),
  but we may still benefit from the optimization from
  foo() into something else. If GCC implements the same transform, we
  would run into a problem because it is not -fno-builtin-bar, but
  -fno-builtin-foo that disables that optimization.

  In this regard, -fno-builtin-foo would be more future-proof than
  -fno-built-bar, but -fno-builtin-foo is still potentially overkill. We
  may want to prevent calls from foo() being optimized into calls to
  bar(), but we still may want other optimization on calls to foo().

It seems that compilers today don't quite provide the fine grain control
over which libcall optimizations pseudo-freestanding environments would
prefer.

Finally, Kees notes that this interface is unsafe, so we should not
encourage its use.  As such, I've removed the declaration from any header,
but it still needs to be exported to avoid linkage errors in modules.

Link: https://lkml.kernel.org/r/20200825140001.2941001-1-ndesaulniers@google.com
Link: https://bugs.llvm.org/show_bug.cgi?id=47162
Link: https://bugs.llvm.org/show_bug.cgi?id=47280
Link: ClangBuiltLinux/linux#1126
Link: https://man7.org/linux/man-pages/man3/stpcpy.3.html
Link: https://pubs.opengroup.org/onlinepubs/9699919799/functions/stpcpy.html
Link: https://reviews.llvm.org/D85963
Signed-off-by: Nick Desaulniers <ndesaulniers@google.com>
Reported-by: Sami Tolvanen <samitolvanen@google.com>
Tested-by: Nathan Chancellor <natechancellor@gmail.com>
Suggested-by: Andy Lavr <andy.lavr@gmail.com>
Suggested-by: Arvind Sankar <nivedita@alum.mit.edu>
Suggested-by: Joe Perches <joe@perches.com>
Suggested-by: Masahiro Yamada <masahiroy@kernel.org>
Suggested-by: Rasmus Villemoes <linux@rasmusvillemoes.dk>
Cc: <stable@vger.kernel.org>
Cc: Kees Cook <keescook@chromium.org>
Cc: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Cc: Alexandru Ardelean <alexandru.ardelean@analog.com>
Cc: Yury Norov <yury.norov@gmail.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Stephen Rothwell <sfr@canb.auug.org.au>
Change-Id: Id6bf5e796fdab4dd421519b9136c6bd9cd7cbe42

3 years agoDNM: (chuckles) I'm in danger.
ivanmeler [Fri, 8 Oct 2021 12:28:35 +0000 (12:28 +0000)]
DNM: (chuckles) I'm in danger.

3 years agoscripts/dtc: Remove redundant YYLOC global declaration
Dirk Mueller [Tue, 14 Jan 2020 17:53:41 +0000 (18:53 +0100)]
scripts/dtc: Remove redundant YYLOC global declaration

gcc 10 will default to -fno-common, which causes this error at link
time:

  (.text+0x0): multiple definition of `yylloc'; dtc-lexer.lex.o (symbol from plugin):(.text+0x0): first defined here

This is because both dtc-lexer as well as dtc-parser define the same
global symbol yyloc. Before with -fcommon those were merged into one
defintion. The proper solution would be to to mark this as "extern",
however that leads to:

  dtc-lexer.l:26:16: error: redundant redeclaration of 'yylloc' [-Werror=redundant-decls]
   26 | extern YYLTYPE yylloc;
      |                ^~~~~~
In file included from dtc-lexer.l:24:
dtc-parser.tab.h:127:16: note: previous declaration of 'yylloc' was here
  127 | extern YYLTYPE yylloc;
      |                ^~~~~~
cc1: all warnings being treated as errors

which means the declaration is completely redundant and can just be
dropped.

Signed-off-by: Dirk Mueller <dmueller@suse.com>
Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
[robh: cherry-pick from upstream]
Cc: stable@vger.kernel.org
Signed-off-by: Rob Herring <robh@kernel.org>
Change-Id: Ie5f32479b6fb948472bbfdec45a07c3728855c28
Signed-off-by: SamarV-121 <samarvispute121@pm.me>
4 years agomedia: fimc-is-sysfs: silence Wsizeof-array-div
Anan Jaser [Tue, 22 Sep 2020 20:50:20 +0000 (00:50 +0400)]
media: fimc-is-sysfs: silence Wsizeof-array-div

drivers/media/platform/exynos/fimc-is2/vendor/mcd/fimc-is-sysfs.c:248:40: error: expression does not compute the number of elements in this arr
ay; element type is 'struct ssrm_camera_data', not 'int' [-Werror,-Wsizeof-array-div]
        if (ret_count > sizeof(SsrmCameraInfo)/sizeof(int))

Change-Id: I2f3b33c7c1951cfa316a9cc59d87308564ffbd93

4 years agowireless: bcmdhd4361: fix overlapping comparisons
Anan Jaser [Tue, 22 Sep 2020 20:33:22 +0000 (00:33 +0400)]
wireless: bcmdhd4361: fix overlapping comparisons

drivers/net/wireless/bcmdhd4361/wl_android.c:7107:22: error: overlapping comparisons always evaluate to false [-Werror,-Wtautological-overlap-compare]
        if ((adps_mode < 0) && (1 < adps_mode)) {

Change-Id: Ic52de37d5048341a0851b011463522b4865d119a

4 years agoplatform: fimc: fix bitwise negation of a boolean expression
Anan Jaser [Tue, 22 Sep 2020 20:28:13 +0000 (00:28 +0400)]
platform: fimc: fix bitwise negation of a boolean expression

drivers/media/platform/exynos/fimc-is2/sensor/flite/fimc-is-hw-flite-v4_20_0.c:28:9: error: bitwise negation of a boolean expression; did you m
ean logical negation? [-Werror,-Wbool-operation]
        cfg |= FLITE_REG_BINNINGON_CLKGATE_ON(enable);
               ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
drivers/media/platform/exynos/fimc-is2/sensor/flite/fimc-is-hw-flite-v4_20_0.h:112:45: note: expanded from macro 'FLITE_REG_BINNINGON_CLKGATE_O
N'

Change-Id: I3974e42c46d235cae0ad4cfdd5d4cc0af7e7fafe

4 years agodrivers: ufs: fix buffer overflow in sprintf
Anan Jaser [Tue, 22 Sep 2020 20:22:57 +0000 (00:22 +0400)]
drivers: ufs: fix buffer overflow in sprintf

drivers/scsi/ufs/ufshcd.c:7588:3: error: 'sprintf' will always overflow; destination buffer has size 16, but format string expands to at le
ast 17 [-Werror,-Wfortify-source]
                sprintf(buf, "U%dH%dL%dX%dQ%dR%dW%dF%d",
                ^

Change-Id: Ic03043dc5df59faf7f19a03deb2fb2d558910db0

4 years agowireless: bcmdhd4361: fix fix comparing a pointer to a null character
Anan Jaser [Tue, 22 Sep 2020 20:16:54 +0000 (00:16 +0400)]
wireless: bcmdhd4361: fix fix comparing a pointer to a null character

drivers/net/wireless/bcmdhd4361/dhd_common.c:3839:19: error: comparing a pointer to a null character constant; did you mean to compare to N
ULL? [-Werror,-Wpointer-compare]
                        if (argv[i] == '\0') {
                                       ^~~~
                                       (void *)0

Change-Id: I4b6613761ff3965cb8741046d4d62d2ea04a852e

4 years agoMakefile: Add '-fno-builtin-bcmp' to CLANG_FLAGS
Nathan Chancellor [Tue, 22 Sep 2020 22:06:57 +0000 (02:06 +0400)]
Makefile: Add '-fno-builtin-bcmp' to CLANG_FLAGS

After LLVM revision r355672 [1], all known working kernel
configurations fail to link [2]:

ld: init/do_mounts.o: in function `prepare_namespace':
do_mounts.c:(.init.text+0x5ca): undefined reference to `bcmp'
ld: do_mounts.c:(.init.text+0x5e6): undefined reference to `bcmp'
ld: init/initramfs.o: in function `do_header':
initramfs.c:(.init.text+0x6e0): undefined reference to `bcmp'
ld: initramfs.c:(.init.text+0x6f8): undefined reference to `bcmp'
ld: arch/x86/kernel/setup.o: in function `setup_arch':
setup.c:(.init.text+0x21d): undefined reference to `bcmp'

Commit 6edfba1b33c7 ("[PATCH] x86_64: Don't define string functions to
builtin") removed '-ffreestanding' globally and the kernel doesn't
provide a bcmp definition so the linker cannot find a reference to it.

Fix this by explicitly telling LLVM through Clang not to emit bcmp
references. This flag does not need to be behind 'cc-option' because all
working versions of Clang support this flag.

[1]: https://github.com/llvm/llvm-project/commit/8e16d73346f8091461319a7dfc4ddd18eedcff13
[2]: https://travis-ci.com/ClangBuiltLinux/continuous-integration/builds/104027249

Link: https://github.com/ClangBuiltLinux/linux/issues/416
Link: https://bugs.llvm.org/show_bug.cgi?id=41035
Cc: stable@vger.kernel.org
Signed-off-by: Nathan Chancellor <natechancellor@gmail.com>
Change-Id: Ide8b905b0406ef698916f07d728c7d5fd72978e2

4 years agostaging: abc: fix comparing a pointer to a null character
Anan Jaser [Tue, 22 Sep 2020 23:01:25 +0000 (03:01 +0400)]
staging: abc: fix comparing a pointer to a null character

Change-Id: Ic062052928e84f6b065472a5dee4bf8a49fc964e

4 years agodrivers: tty: samsung: fix misleading intendation
Anan Jaser [Tue, 22 Sep 2020 23:00:03 +0000 (03:00 +0400)]
drivers: tty: samsung: fix misleading intendation

Change-Id: I00acbf1c674d63edb7d3ce3d693145c7580945ab

4 years agodrivers: usb: gadget: fix misleading intendation
Anan Jaser [Tue, 22 Sep 2020 22:59:43 +0000 (02:59 +0400)]
drivers: usb: gadget: fix misleading intendation

Change-Id: Ic8db56d29b69dfade03b28b1be9535c7da96527c

4 years agokernel: sched: fix misleading intendation
Anan Jaser [Tue, 22 Sep 2020 22:59:17 +0000 (02:59 +0400)]
kernel: sched: fix misleading intendation

Change-Id: Ife6638d4ce17a1e8f58c747b905b87257ebe170b

4 years agonet: core: sock: fix misleading intendation
Anan Jaser [Tue, 22 Sep 2020 22:56:55 +0000 (02:56 +0400)]
net: core: sock: fix misleading intendation

Change-Id: Ib5b351ac865374331f93ef9aa9f58c2af8b6915e

4 years agofs: encryptfs: fix misleading intendation
Anan Jaser [Tue, 22 Sep 2020 22:56:08 +0000 (02:56 +0400)]
fs: encryptfs: fix misleading intendation

Change-Id: I7d864c8141156ef8d6e5c08ad2829a13adaa00a7

4 years agodrivers: sensorhub: fix misleading intendation
Anan Jaser [Tue, 22 Sep 2020 22:55:52 +0000 (02:55 +0400)]
drivers: sensorhub: fix misleading intendation

Change-Id: I76ef0a3f15e1f58d58a6895bc764d5e9c180c166

4 years agodrivers: battery_v2: fix misleading intendation
Anan Jaser [Tue, 22 Sep 2020 22:55:28 +0000 (02:55 +0400)]
drivers: battery_v2: fix misleading intendation

Change-Id: I2a37344987cbef9496b48ff1d1a8d9f0dc913f3e

4 years agousb: gadget: f_mtp: Avoid race between mtp_read and mtp_function_disable lineage-17.1
Pratham Pratap [Tue, 8 May 2018 10:47:52 +0000 (16:17 +0530)]
usb: gadget: f_mtp: Avoid race between mtp_read and mtp_function_disable

While mtp_read is being executed and mtp_function_disable
is called then all the eps will be disabled which will
lead to NULL pointer dereference in usb_ep_align_maybe
function which will subsequently try to access endpoint
descriptors.
Add spinlock protection in mtp_function_disable to
avoid race between mtp_read and mtp_function_disable.

Change-Id: If7f00ff2a98f75d2782e6bb35ad5fe59e4db6734
Signed-off-by: Pratham Pratap <prathampratap@codeaurora.org>
4 years agoscripts/setlocalversion: Improve -dirty check with git-status --no-optional-locks
Brian Norris [Thu, 15 Nov 2018 02:11:18 +0000 (18:11 -0800)]
scripts/setlocalversion: Improve -dirty check with git-status --no-optional-locks

[ Upstream commit ff64dd4857303dd5550faed9fd598ac90f0f2238 ]

git-diff-index does not refresh the index for you, so using it for a
"-dirty" check can give misleading results. Commit 6147b1cf19651
("scripts/setlocalversion: git: Make -dirty check more robust") tried to
fix this by switching to git-status, but it overlooked the fact that
git-status also writes to the .git directory of the source tree, which
is definitely not kosher for an out-of-tree (O=) build. That is getting
reverted.

Fortunately, git-status now supports avoiding writing to the index via
the --no-optional-locks flag, as of git 2.14. It still calculates an
up-to-date index, but it avoids writing it out to the .git directory.

So, let's retry the solution from commit 6147b1cf19651 using this new
flag first, and if it fails, we assume this is an older version of git
and just use the old git-diff-index method.

It's hairy to get the 'grep -vq' (inverted matching) correct by stashing
the output of git-status (you have to be careful about the difference
betwen "empty stdin" and "blank line on stdin"), so just pipe the output
directly to grep and use a regex that's good enough for both the
git-status and git-diff-index version.

Change-Id: Ieb6e2ff2db99c081b17332136db860260d165385
Cc: Christian Kujau <lists@nerdbynature.de>
Cc: Guenter Roeck <linux@roeck-us.net>
Suggested-by: Alexander Kapshuk <alexander.kapshuk@gmail.com>
Signed-off-by: Brian Norris <briannorris@chromium.org>
Tested-by: Genki Sky <sky@genki.is>
Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
4 years agoadd toggle for disabling newly added USB devices
Daniel Micay [Tue, 16 May 2017 21:51:48 +0000 (17:51 -0400)]
add toggle for disabling newly added USB devices

Based on the public grsecurity patches.

4 years agodts: early mount efs
Michael Benedict [Mon, 30 Dec 2019 05:12:50 +0000 (16:12 +1100)]
dts: early mount efs

system was early mounted and it doesnt have the time to import efs prop, so early mount efs too

Signed-off-by: Michael Benedict <michaelbt@live.com>
4 years agofix clang building for greatlte
Stricted [Tue, 24 Dec 2019 07:50:27 +0000 (07:50 +0000)]
fix clang building for greatlte

5 years agodefconfig: set extra cmdline for apex
Michael Benedict [Sat, 12 Oct 2019 12:04:47 +0000 (23:04 +1100)]
defconfig: set extra cmdline for apex

Signed-off-by: Michael Benedict <michaelbt@live.com>
5 years agoblock: Restore original read_ahead_kb mode
LuK1337 [Tue, 24 Sep 2019 14:53:33 +0000 (16:53 +0200)]
block: Restore original read_ahead_kb mode

* Apex isn't able to write to it without S_IWUSR.

Change-Id: I374b4acb3239bf1f3ab2109e4391671c85131be5

5 years agobcmdhd: fix build error after source merge
Michael Benedict [Fri, 11 Oct 2019 07:19:43 +0000 (18:19 +1100)]
bcmdhd: fix build error after source merge

Signed-off-by: Michael Benedict <michaelbt@live.com>
5 years agosource: G955FXXS5DSI1
Michael Benedict [Sat, 5 Oct 2019 10:05:37 +0000 (20:05 +1000)]
source: G955FXXS5DSI1

Signed-off-by: Michael Benedict <michaelbt@live.com>
5 years agosource: G950FXXS5DSI1
Michael Benedict [Sat, 5 Oct 2019 10:03:32 +0000 (20:03 +1000)]
source: G950FXXS5DSI1

Signed-off-by: Michael Benedict <michaelbt@live.com>
5 years agouniversal8895: set blk loop min to 16
Michael Benedict [Sat, 5 Oct 2019 02:34:47 +0000 (12:34 +1000)]
universal8895: set blk loop min to 16

Signed-off-by: Michael Benedict <michaelbt@live.com>
5 years agoUPSTREAM: loop: drop caches if offset or block_size are changed
Jaegeuk Kim [Fri, 14 Dec 2018 19:14:38 +0000 (11:14 -0800)]
UPSTREAM: loop: drop caches if offset or block_size are changed

If we don't drop caches used in old offset or block_size, we can get old data
from new offset/block_size, which gives unexpected data to user.

For example, Martijn found a loopback bug in the below scenario.
1) LOOP_SET_FD loads first two pages on loop file
2) LOOP_SET_STATUS64 changes the offset on the loop file
3) mount is failed due to the cached pages having wrong superblock

Cc: Jens Axboe <axboe@kernel.dk>
Cc: linux-block@vger.kernel.org
Reported-by: Martijn Coenen <maco@google.com>
Reviewed-by: Bart Van Assche <bvanassche@acm.org>
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
Signed-off-by: Jens Axboe <axboe@kernel.dk>
(cherry picked from commit 490b8c65b9db45896769e1095e78725775f47b3e)
Change-Id: Iffb7e1f04ab587e1a8785bc862a425efb654be24

5 years agoRevert "ANDROID: dm verity: add minimum prefetch size"
Sami Tolvanen [Fri, 11 Jan 2019 00:07:19 +0000 (16:07 -0800)]
Revert "ANDROID: dm verity: add minimum prefetch size"

This reverts commit ace74ccf82cfb2b73ce1df2e698d20c2fbc559dd.

Bug: 71728490
Change-Id: Iebcb0cd9982f36c4bd2552811f9147325a291db0
Signed-off-by: Sami Tolvanen <samitolvanen@google.com>
5 years agoANDROID: mnt: Propagate remount correctly
Daniel Rosenberg [Sat, 12 Jan 2019 02:44:18 +0000 (18:44 -0800)]
ANDROID: mnt: Propagate remount correctly

This switches over to propagation_next to respect
namepsace semantics.

Test: Remounting to change the options of a fs with mount based
      options should propagate to all shared copies of that mount,
      and the slaves/indirect slaves of those.
Bug: 122428178
Signed-off-by: Daniel Rosenberg <drosen@google.com>
Change-Id: Ic35cd2782a646435689f5bedfa1f218fe4ab8254

5 years agoUPSTREAM: loop: Add LOOP_SET_BLOCK_SIZE in compat ioctl
Evan Green [Mon, 2 Jul 2018 23:03:46 +0000 (16:03 -0700)]
UPSTREAM: loop: Add LOOP_SET_BLOCK_SIZE in compat ioctl

This change adds LOOP_SET_BLOCK_SIZE as one of the supported ioctls
in lo_compat_ioctl. It only takes an unsigned long argument, and
in practice a 32-bit value works fine.

Bug: 117823094
Change-Id: I0061a082eb2632c47b7d66f35f2c909d33ff1653
Reviewed-by: Omar Sandoval <osandov@fb.com>
Signed-off-by: Evan Green <evgreen@chromium.org>
Signed-off-by: Jens Axboe <axboe@kernel.dk>
(cherry picked from commit 9fea4b395260175de4016b42982f45a3e6e03d0b)
Signed-off-by: Martijn Coenen <maco@android.com>
5 years agoBACKPORT: block/loop: set hw_sectors
Shaohua Li [Fri, 1 Sep 2017 05:09:45 +0000 (22:09 -0700)]
BACKPORT: block/loop: set hw_sectors

Loop can handle any size of request. Limiting it to 255 sectors just
burns the CPU for bio split and request merge for underlayer disk and
also cause bad fs block allocation in directio mode.

Bug: 117823094
Change-Id: Ic4957181433c5a0d15f4cfdbf69dc5558d6dc5bd
Reviewed-by: Omar Sandoval <osandov@fb.com>
Reviewed-by: Ming Lei <ming.lei@redhat.com>
Signed-off-by: Shaohua Li <shli@fb.com>
Signed-off-by: Jens Axboe <axboe@kernel.dk>
(cherry picked from commit 54bb0ade6627a183c211345761ec46e4bf0048fe)
Signed-off-by: Martijn Coenen <maco@android.com>
5 years agoUPSTREAM: loop: add ioctl for changing logical block size
Omar Sandoval [Thu, 24 Aug 2017 07:03:43 +0000 (00:03 -0700)]
UPSTREAM: loop: add ioctl for changing logical block size

This is a different approach from the first attempt in f2c6df7dbf9a
("loop: support 4k physical blocksize"). Rather than extending
LOOP_{GET,SET}_STATUS, add a separate ioctl just for setting the block
size.

Bug: 117823094
Change-Id: I8e69b8839d7fee3be564cbfce1797ce108e1aa1e
Reviewed-by: Ming Lei <ming.lei@redhat.com>
Reviewed-by: Hannes Reinecke <hare@suse.com>
Signed-off-by: Omar Sandoval <osandov@fb.com>
Signed-off-by: Jens Axboe <axboe@kernel.dk>
(cherry picked from commit 89e4fdecb51cf5535867026274bc97de9480ade5)
Signed-off-by: Martijn Coenen <maco@android.com>
5 years agokbuild: clang: choose GCC_TOOLCHAIN_DIR not on LD
Nick Desaulniers [Mon, 11 Feb 2019 19:30:04 +0000 (11:30 -0800)]
kbuild: clang: choose GCC_TOOLCHAIN_DIR not on LD

commit ad15006cc78459d059af56729c4d9bed7c7fd860 upstream.

This causes an issue when trying to build with `make LD=ld.lld` if
ld.lld and the rest of your cross tools aren't in the same directory
(ex. /usr/local/bin) (as is the case for Android's build system), as the
GCC_TOOLCHAIN_DIR then gets set based on `which $(LD)` which will point
where LLVM tools are, not GCC/binutils tools are located.

Instead, select the GCC_TOOLCHAIN_DIR based on another tool provided by
binutils for which LLVM does not provide a substitute for, such as
elfedit.

Fixes: 785f11aa595b ("kbuild: Add better clang cross build support")
Change-Id: I6c5356dee86e2fa7e6b195aba82509c3a876630d
Link: https://github.com/ClangBuiltLinux/linux/issues/341
Suggested-by: Nathan Chancellor <natechancellor@gmail.com>
Reviewed-by: Nathan Chancellor <natechancellor@gmail.com>
Tested-by: Nathan Chancellor <natechancellor@gmail.com>
Signed-off-by: Nick Desaulniers <ndesaulniers@google.com>
Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
Signed-off-by: Nathan Chancellor <natechancellor@gmail.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
5 years agokbuild: allow to use GCC toolchain not in Clang search path
Stefan Agner [Tue, 18 Sep 2018 02:31:57 +0000 (19:31 -0700)]
kbuild: allow to use GCC toolchain not in Clang search path

commit ef8c4ed9db80261f397f0c0bf723684601ae3b52 upstream.

When using a GCC cross toolchain which is not in a compiled in
Clang search path, Clang reverts to the system assembler and
linker. This leads to assembler or linker errors, depending on
which tool is first used for a given architecture.

It seems that Clang is not searching $PATH for a matching
assembler or linker.

Make sure that Clang picks up the correct assembler or linker by
passing the cross compilers bin directory as search path.

This allows to use Clang provided by distributions with GCC
toolchains not in /usr/bin.

Change-Id: Ia5683ef2a9def6122219bb38d834ad45e2d204c2
Link: https://github.com/ClangBuiltLinux/linux/issues/78
Signed-off-by: Stefan Agner <stefan@agner.ch>
Reviewed-and-tested-by: Nick Desaulniers <ndesaulniers@google.com>
Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
[nc: Adjust context]
Signed-off-by: Nathan Chancellor <natechancellor@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
5 years agoFROMLIST: arm64: Build vDSO with -ffixed-x18
Peter Collingbourne [Wed, 7 Nov 2018 00:39:13 +0000 (16:39 -0800)]
FROMLIST: arm64: Build vDSO with -ffixed-x18

The vDSO needs to be build with x18 reserved in order to accommodate
userspace platform ABIs built on top of Linux that use the register
to carry inter-procedural state, as provided for by the AAPCS.
An example of such a platform ABI is the one that will be used by an
upcoming version of Android.

Although this change is currently a no-op due to the fact that the vDSO
is currently implemented in pure assembly on arm64, it is necessary
in order to prepare for another change [1] that will add C code to
the vDSO.

[1] https://patchwork.kernel.org/patch/10044501/

Change-Id: Icaac4b1c9127d81d754d3b8688274e9afc781760
Signed-off-by: Peter Collingbourne <pcc@google.com>
Signed-off-by: Vincenzo Frascino <vincenzo.frascino@arm.com>
Cc: Mark Salyzyn <salyzyn@google.com>
Cc: Will Deacon <will.deacon@arm.com>
Cc: linux-arm-kernel@lists.infradead.org
5 years agoFROMLIST: arm64: vdso32: Use full path to Clang instead of relying on PATH
Nathan Chancellor [Tue, 22 May 2018 21:59:35 +0000 (14:59 -0700)]
FROMLIST: arm64: vdso32: Use full path to Clang instead of relying on PATH

Currently, in order to build the compat VDSO with Clang, this format
has to be used:

  PATH=${BIN_FOLDER}:${PATH} make CC=clang

Prior to the addition of this file, this format would also be
acceptable:

  make CC=${BIN_FOLDER}/clang

This is because the vdso32 Makefile uses cc-name instead of CC. After
this path, CC will still evaluate to clang for the first case as
expected but now the second case will use the specified Clang, rather
than the host's copy, which may not be compatible as shown below.

/usr/bin/as: unrecognized option '-mfloat-abi=soft'
clang-6.0: error: assembler command failed with exit code 1

Signed-off-by: Nathan Chancellor <natechancellor@gmail.com>
(cherry picked from https://patchwork.kernel.org/patch/10419665)
Bug: 80184372
Change-Id: If90a5a4edbc2b5883b4c78161081ebeafbebdcde

5 years agoANDROID: clock_gettime(CLOCK_BOOTTIME,) slows down >20x
Mark Salyzyn [Wed, 24 Jan 2018 22:00:19 +0000 (14:00 -0800)]
ANDROID: clock_gettime(CLOCK_BOOTTIME,) slows down >20x

clock_gettime(CLOCK_BOOTTIME,) slows down after significant
accumulation of suspend time creating a large offset between it and
CLOCK_MONOTONIC time.  The __iter_div_u64_rem() is only for the usage
of adding a few second+nanosecond times and saving cycles on more
expensive remainder and division operations, but iterates one second
at a time which quickly goes out of scale in CLOCK_BOOTTIME's case
since it was specified as nanoseconds only.

The fix is to split off seconds from the boot time and cap the
nanoseconds so that __iter_div_u64_rem does not iterate.

Signed-off-by: Mark Salyzyn <salyzyn@google.com>
Bug: 72406285
Change-Id: Ia647ef1e76b7ba3b0c003028d4b3b955635adabb

5 years agoANDROID: arm64: vdso32: fix CC=clang build
Mark Salyzyn [Wed, 10 Jan 2018 00:55:17 +0000 (16:55 -0800)]
ANDROID: arm64: vdso32: fix CC=clang build

clang build had wrong --gcc-toolchain for cross compiler.

Signed-off-by: Mark Salyzyn <salyzyn@google.com>
Bug: 63737556
Change-Id: Ib0c3bbb250943a0309da021ba5335a8320b584f4

5 years agoANDROID: CROSS_COMPILE_ARM32 must work if CONFIG_COMPAT_VDSO
Mark Salyzyn [Tue, 28 Mar 2017 21:11:02 +0000 (14:11 -0700)]
ANDROID: CROSS_COMPILE_ARM32 must work if CONFIG_COMPAT_VDSO

Prevent surprise loss of vdso32 support.

Signed-off-by: Mark Salyzyn <salyzyn@google.com>
Bug: 63737556
Bug: 20045882
Bug: 19198045
Change-Id: I8b381f7649b95b298ea9e1a99aa3794c7bc08d09

5 years agoFROMLIST: BACKPORT: [PATCH 6/6] arm64: Wire up and expose the new compat vDSO
Kevin Brodsky [Fri, 13 May 2016 08:59:28 +0000 (09:59 +0100)]
FROMLIST: BACKPORT: [PATCH 6/6] arm64: Wire up and expose the new compat vDSO

(cherry pick from url https://patchwork.kernel.org/patch/10060447/)

Expose the new compat vDSO via the COMPAT_VDSO config option.

The option is not enabled in defconfig because we really need a 32-bit
compiler this time, and we rely on the user to provide it themselves
by setting CROSS_COMPILE_ARM32. Therefore enabling the option by
default would make little sense, since the user must explicitly set a
non-standard environment variable anyway.

CONFIG_COMPAT_VDSO is not directly used in the code, because we want
to ignore it (build as if it were not set) if the user didn't set
CROSS_COMPILE_ARM32. If the variable has been set to a valid prefix,
CONFIG_VDSO32 will be set; this is the option that the code and
Makefiles test.

For more flexibility, like CROSS_COMPILE, CROSS_COMPILE_ARM32 can also
be set via CONFIG_CROSS_COMPILE_ARM32 (the environment variable
overrides the config option, as expected).

Signed-off-by: Kevin Brodsky <kevin.brodsky@arm.com>
Also needs to set CONFIG_ARM_ARCH_TIMER_VCT_ACCESS when CONFIG_VDSO32
is selected.

Signed-off-by: Mark Salyzyn <salyzyn@android.com>
Cc: Catalin Marinas <catalin.marinas@arm.com>
Cc: Will Deacon <will.deacon@arm.com>
Cc: Dave Martin <Dave.Martin@arm.com>
Cc: "Eric W. Biederman" <ebiederm@xmission.com>
Cc: linux-arm-kernel@lists.infradead.org
Cc: linux-kernel@vger.kernel.org
Bug: 63737556
Bug: 20045882
Change-Id: Ie8a7d6c2b5ba3edca591a9a953ce99ec792da882

5 years agoFROMLIST: BACKPORT: [PATCH 5/6] arm64: compat: 32-bit vDSO setup
Kevin Brodsky [Thu, 8 Sep 2016 13:25:04 +0000 (14:25 +0100)]
FROMLIST: BACKPORT: [PATCH 5/6] arm64: compat: 32-bit vDSO setup

(cherry pick from url https://patchwork.kernel.org/patch/10060459/)

If the compat vDSO is enabled, install it in compat processes. In this
case, the compat vDSO replaces the sigreturn page (it provides its own
sigreturn trampolines).

Signed-off-by: Kevin Brodsky <kevin.brodsky@arm.com>
Signed-off-by: Mark Salyzyn <salyzyn@android.com>
Cc: Catalin Marinas <catalin.marinas@arm.com>
Cc: Will Deacon <will.deacon@arm.com>
Cc: Dave Martin <Dave.Martin@arm.com>
Cc: "Eric W. Biederman" <ebiederm@xmission.com>
Cc: linux-arm-kernel@lists.infradead.org
Cc: linux-kernel@vger.kernel.org
Bug: 63737556
Bug: 20045882
Change-Id: Ia6acf4c3ffea636bc750ac00853ea762c182e5b5

5 years agoFROMLIST: [PATCH 4/6] arm64: compat: Add a 32-bit vDSO
Kevin Brodsky [Wed, 11 May 2016 10:42:22 +0000 (11:42 +0100)]
FROMLIST: [PATCH 4/6] arm64: compat: Add a 32-bit vDSO

(cherry pick from url https://patchwork.kernel.org/patch/10060445/)

Provide the files necessary for building a compat (AArch32) vDSO in
kernel/vdso32.

This is mostly an adaptation of the arm vDSO. The most significant
change in vgettimeofday.c is the use of the arm64 vdso_data struct,
allowing the vDSO data page to be shared between the 32 and 64-bit
vDSOs. Additionally, a different set of barrier macros is used (see
aarch32-barrier.h), as we want to support old 32-bit compilers that
may not support ARMv8 and its new barrier arguments (*ld).

In addition to the time functions, sigreturn trampolines are also
provided, aiming at replacing those in the sigreturn page as the
latter don't provide any unwinding information (and it's easier to
have just one "user code" page). arm-specific unwinding directives are
used, based on glibc's implementation. Symbol offsets are made
available to the kernel using the same method as the 64-bit vDSO.

There is unfortunately an important caveat: we cannot get away with
hand-coding 32-bit instructions like in kernel/kuser32.S, this time we
really need a 32-bit compiler. The compat vDSO Makefile relies on
CROSS_COMPILE_ARM32 to provide a 32-bit compiler, appropriate logic
will be added to the arm64 Makefile later on to ensure that an attempt
to build the compat vDSO is made only if this variable has been set
properly.

Signed-off-by: Kevin Brodsky <kevin.brodsky@arm.com>
Take an effort to recode the arm64 vdso code from assembler to C
previously submitted by Andrew Pinski <apinski@cavium.com>, rework
it for use in both arm and arm64, overlapping any optimizations
for each architecture.

Signed-off-by: Mark Salyzyn <salyzyn@android.com>
Cc: Catalin Marinas <catalin.marinas@arm.com>
Cc: Will Deacon <will.deacon@arm.com>
Cc: Dave Martin <Dave.Martin@arm.com>
Cc: "Eric W. Biederman" <ebiederm@xmission.com>
Cc: linux-arm-kernel@lists.infradead.org
Cc: linux-kernel@vger.kernel.org
Bug: 63737556
Bug: 20045882
Change-Id: I3fb9d21b29bd9fec1408f2274d090e6def546b0d

5 years agoFROMLIST: [PATCH 3/6] arm64: Refactor vDSO init/setup
Kevin Brodsky [Tue, 10 May 2016 12:51:54 +0000 (13:51 +0100)]
FROMLIST: [PATCH 3/6] arm64: Refactor vDSO init/setup

(cherry pick from url https://patchwork.kernel.org/patch/10060439/)

Move the logic for setting up mappings and pages for the vDSO into
static functions. This makes the vDSO setup code more consistent with
the compat side and will allow to reuse it for the future compat vDSO.

Signed-off-by: Kevin Brodsky <kevin.brodsky@arm.com>
Signed-off-by: Mark Salyzyn <salyzyn@android.com>
Cc: Catalin Marinas <catalin.marinas@arm.com>
Cc: Will Deacon <will.deacon@arm.com>
Cc: Dave Martin <Dave.Martin@arm.com>
Cc: "Eric W. Biederman" <ebiederm@xmission.com>
Cc: linux-arm-kernel@lists.infradead.org
Cc: linux-kernel@vger.kernel.org
Bug: 63737556
Bug: 20045882
Change-Id: I13e84479591091669190360f2a7f4d04462e6344

5 years agoFROMLIST: [PATCH 2/6] arm64: elf: Set AT_SYSINFO_EHDR in compat processes
Kevin Brodsky [Thu, 12 May 2016 08:53:26 +0000 (09:53 +0100)]
FROMLIST: [PATCH 2/6] arm64: elf: Set AT_SYSINFO_EHDR in compat processes

(cherry pick from url https://patchwork.kernel.org/patch/10060431/)

If the compat vDSO is enabled, we need to set AT_SYSINFO_EHDR in the
auxiliary vector of compat processes to the address of the vDSO code
page, so that the dynamic linker can find it (just like the regular vDSO).

Note that we cast context.vdso to Elf64_Off, instead of elf_addr_t,
because elf_addr_t is Elf32_Off in compat_binfmt_elf.c, and casting
context.vdso to u32 would trigger a pointer narrowing warning.

Signed-off-by: Kevin Brodsky <kevin.brodsky@arm.com>
Signed-off-by: Mark Salyzyn <salyzyn@android.com>
Cc: Catalin Marinas <catalin.marinas@arm.com>
Cc: Will Deacon <will.deacon@arm.com>
Cc: Dave Martin <Dave.Martin@arm.com>
Cc: "Eric W. Biederman" <ebiederm@xmission.com>
Cc: linux-arm-kernel@lists.infradead.org
Cc: linux-kernel@vger.kernel.org
Bug: 63737556
Bug: 20045882
Change-Id: I5d0b191d3b2f4c0b2ec31fe9faef0246253635ce

5 years agoFROMLIST: [PATCH 1/6] arm64: compat: Use vDSO sigreturn trampolines if available
Kevin Brodsky [Thu, 12 May 2016 09:55:47 +0000 (10:55 +0100)]
FROMLIST: [PATCH 1/6] arm64: compat: Use vDSO sigreturn trampolines if available

(cherry pick from url https://patchwork.kernel.org/patch/10060449/)

If the compat vDSO is enabled, it replaces the sigreturn page.
Therefore, we use the sigreturn trampolines the vDSO provides instead.

Signed-off-by: Kevin Brodsky <kevin.brodsky@arm.com>
Signed-off-by: Mark Salyzyn <salyzyn@android.com>
Bug: 63737556
Bug: 20045882
Change-Id: Ic0933741e321e1bf66409b7e190a776f12948024

5 years agoFROMLIST: lib: vdso: add support for time
Mark Salyzyn [Fri, 27 Oct 2017 15:58:18 +0000 (08:58 -0700)]
FROMLIST: lib: vdso: add support for time

(cherry pick from url https://patchwork.kernel.org/patch/10053549/)

Add time() vdso support to match up with existing support in the x86's
vdso.  Currently benefitting arm and arm64 which uses the common
vgettimeofday.c implementation.  On arm provides about a ~14 fold
improvement in speed over the straight syscall, and about a ~5 fold
improvement in speed over an alternate library implementation that
relies on the vdso call to gettimeofday to fulfill the request.

We can provide __vdso_time even if we can not provide a speed
enhanced __vdso_gettimeofday.

Signed-off-by: Mark Salyzyn <salyzyn@android.com>
Bug: 63737556
Bug: 20045882
Change-Id: I0bb3c6bafe57f9ed69350e2dd54edaae58316e8f

5 years agoFROMLIST: [PATCH] arm64: compat: Expose offset to registers in sigframes
Kevin Brodsky [Tue, 10 May 2016 12:32:58 +0000 (13:32 +0100)]
FROMLIST: [PATCH] arm64: compat: Expose offset to registers in sigframes

(cherry picked from url https://patchwork.kernel.org/patch/10006025/)

This will be needed to provide unwinding information in compat
sigreturn trampolines, part of the future compat vDSO. There is no
obvious header the compat_sig* struct's should be moved to, so let's
put them in signal32.h.

Also fix minor style issues reported by checkpatch.

Signed-off-by: Kevin Brodsky <kevin.brodsky@arm.com>
Signed-off-by: Mark Salyzyn <salyzyn@android.com>
Cc: Catalin Marinas <catalin.marinas@arm.com>
Cc: Will Deacon <will.deacon@arm.com>
Cc: Mark Rutland <mark.rutland@arm.com>
Cc: Andy Gross <andy.gross@linaro.org>
Cc: Dave Martin <Dave.Martin@arm.com>
Cc: Eric W. Biederman <ebiederm@xmission.com>
Cc: linux-arm-kernel@lists.infradead.org
Cc: linux-kernel@vger.kernel.org
Bug: 63737556
Bug: 20045882
Change-Id: I9c23dd6b56ca48c0953cbf78ccb7b49ded906052

5 years agoFROMLIST: [PATCH v5 12/12] lib: vdso: do not expose gettimeofday, if no arch supporte...
Mark Salyzyn [Fri, 27 Oct 2017 15:58:18 +0000 (08:58 -0700)]
FROMLIST: [PATCH v5 12/12] lib: vdso: do not expose gettimeofday, if no arch supported timer

(cherry pick from url https://patchwork.kernel.org/patch/10044539/)

Take an effort to recode the arm64 vdso code from assembler to C
previously submitted by Andrew Pinski <apinski@cavium.com>, rework
it for use in both arm and arm64, overlapping any optimizations
for each architecture. But instead of landing it in arm64, land the
result into lib/vdso and unify both implementations to simplify
future maintenance.

If ARCH_PROVIDES_TIMER is not defined, do not expose gettimeofday.
libc will default directly to syscall.  Also ifdef clock_gettime
switch cases and stubs if not supported and other unused components.

Signed-off-by: Mark Salyzyn <salyzyn@android.com>
Cc: James Morse <james.morse@arm.com>
Cc: Russell King <linux@armlinux.org.uk>
Cc: Catalin Marinas <catalin.marinas@arm.com>
Cc: Will Deacon <will.deacon@arm.com>
Cc: Andy Lutomirski <luto@amacapital.net>
Cc: Dmitry Safonov <dsafonov@virtuozzo.com>
Cc: John Stultz <john.stultz@linaro.org>
Cc: Mark Rutland <mark.rutland@arm.com>
Cc: Laura Abbott <labbott@redhat.com>
Cc: Kees Cook <keescook@chromium.org>
Cc: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Cc: Andy Gross <andy.gross@linaro.org>
Cc: Kevin Brodsky <kevin.brodsky@arm.com>
Cc: Andrew Pinski <apinski@cavium.com>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: linux-kernel@vger.kernel.org
Cc: linux-arm-kernel@lists.infradead.org
Bug: 63737556
Bug: 20045882
Change-Id: I362a7114db0aac800e16eb90d14a8739e18f42e4