Skip to content
This project is mirrored from https://github.com/goshawk22/android_kernel_oplus_sdm710.git. Pull mirroring updated .
  1. Jan 14, 2023
    • someone5678's avatar
      Makefile: Enforce ld.lld as a default linker · 08a3eaf9
      someone5678 authored
        GEN     ./Makefile
        HOSTCC  scripts/basic/fixdep
      clang-14: error: unable to execute command: Executable "ld" doesn't exist!
      clang-14: error: linker command failed with exit code 1 (use -v to see invocation)
      make[2]: *** [scripts/Makefile.host:102: scripts/basic/fixdep] Error 1
      08a3eaf9
    • Adhitya Mohan's avatar
      qcacld: Fix code syntax in a few places · a042924c
      Adhitya Mohan authored
      thanks to @idoybh for the catch
      "#justcafthings"
      a042924c
    • Nathan Chancellor's avatar
      arm64: vdso32: Fix '--prefix=' value for newer versions of clang · a9d3db57
      Nathan Chancellor authored
      Newer versions of clang only look for $(COMPAT_GCC_TOOLCHAIN_DIR)as [1],
      rather than $(COMPAT_GCC_TOOLCHAIN_DIR)$(CROSS_COMPILE_COMPAT)as,
      resulting in the following build error:
      
      $ make -skj"$(nproc)" ARCH=arm64 CROSS_COMPILE=aarch64-linux-gnu- \
      CROSS_COMPILE_COMPAT=arm-linux-gnueabi- LLVM=1 O=out/aarch64 distclean \
      defconfig arch/arm64/kernel/vdso32/
      ...
      /home/nathan/cbl/toolchains/llvm-binutils/bin/as: unrecognized option '-EL'
      clang-12: error: assembler command failed with exit code 1 (use -v to see invocation)
      make[3]: *** [arch/arm64/kernel/vdso32/Makefile:181: arch/arm64/kernel/vdso32/note.o] Error 1
      ...
      
      Adding the value of CROSS_COMPILE_COMPAT (adding notdir to account for a
      full path for CROSS_COMPILE_COMPAT) fixes this issue, which matches the
      solution done for the main Makefile [2].
      
      [1]: https://github.com/llvm/llvm-project/commit/3452a0d8c17f7166f479706b293caf6ac76ffd90
      [2]: https://lore.kernel.org/lkml/20200721173125.1273884-1-maskray@google.com/
      
      
      
      Signed-off-by: default avatarNathan Chancellor <natechancellor@gmail.com>
      Cc: stable@vger.kernel.org
      Link: https://github.com/ClangBuiltLinux/linux/issues/1099
      Link: https://lore.kernel.org/r/20200723041509.400450-1-natechancellor@gmail.com
      
      
      Signed-off-by: default avatarWill Deacon <will@kernel.org>
      [dl: Backported to 4.14, depends on commit 38253a0ed057c49dde77588eef05fdcb4008ce0b
           ("vdso32: Invoke clang with correct path to GCC toolchain")
           from the Pixel 4 kernel]
      Signed-off-by: default avatarDanny Lin <danny@kdrag0n.dev>
      a9d3db57
    • Mark Salyzyn's avatar
      ARM64: configs: turn on VDSO · 27e74346
      Mark Salyzyn authored
      
      
      Turn on the vdso32 feature on an arm64 kernel.
      
      Results in roughly a 4 fold speedup for clock_gettime() and other
      timekeeping functions for arm32 executables in the environment.
      
      Signed-off-by: default avatarMark Salyzyn <salyzyn@google.com>
      Bug: 20045882
      Bug: 19198045
      Bug: 63737556
      Change-Id: If39bfad8b287a5455dc8240a73dcc8951e4bc13f
      Signed-off-by: default avatarkhusika <khusikadhamar@gmail.com>
      27e74346
    • Peter Collingbourne's avatar
      FROMLIST: arm64: Build vDSO with -ffixed-x18 · 112dd6ee
      Peter Collingbourne authored
      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: default avatarPeter Collingbourne <pcc@google.com>
      Signed-off-by: default avatarVincenzo 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
      Signed-off-by: default avatarKhusika Dhamar Gusti <khusikadhamar@gmail.com>
      112dd6ee
    • Mark Salyzyn's avatar
      ANDROID: turn on VCT access from 32-bit applications · 802bd7e1
      Mark Salyzyn authored
      
      
      Deal with regression from 7b4edf24
      ("clocksource: arch_timer: make virtual counter access configurable")
      by selecting ARM_ARCH_TIMER_VCT_ACCESS if COMPAT_VDSO is selected.
      
      Signed-off-by: default avatarMark Salyzyn <salyzyn@google.com>
      Bug: 72417836
      Change-Id: Ie11498880941977a8014adb8b8a3b07a6ef82e27
      Signed-off-by: default avatarkhusika <khusikadhamar@gmail.com>
      802bd7e1
    • Daniel Mentz's avatar
      vdso32: Invoke clang with correct path to GCC toolchain · 7b5dd6b3
      Daniel Mentz authored
      
      
      Clang needs to have access to a GCC toolchain which we advertise using
      the command line option --gcc-toolchain=. Clang previously picked the
      wrong toolchain which resulted in the following error message:
      
      /..//bin/as: unrecognized option '-EL'
      
      Bug: 123422077
      Signed-off-by: default avatarDaniel Mentz <danielmentz@google.com>
      Change-Id: I3e339dd446b71e2c75eb9e2c186eba715b3771cd
      Signed-off-by: default avatarkhusika <khusikadhamar@gmail.com>
      7b5dd6b3
    • Nathan Chancellor's avatar
      FROMLIST: arm64: vdso32: Use full path to Clang instead of relying on PATH · 4b01f210
      Nathan Chancellor authored
      
      
      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: default avatarNathan Chancellor <natechancellor@gmail.com>
      (cherry picked from https://patchwork.kernel.org/patch/10419665
      
      )
      Bug: 80184372
      Change-Id: If90a5a4edbc2b5883b4c78161081ebeafbebdcde
      Signed-off-by: default avatarkhusika <khusikadhamar@gmail.com>
      4b01f210
    • Mark Salyzyn's avatar
      ANDROID: clock_gettime(CLOCK_BOOTTIME,) slows down >20x · 2af52a17
      Mark Salyzyn authored
      
      
      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: default avatarMark Salyzyn <salyzyn@google.com>
      Bug: 72406285
      Change-Id: Ia647ef1e76b7ba3b0c003028d4b3b955635adabb
      Signed-off-by: default avatarkhusika <khusikadhamar@gmail.com>
      2af52a17
    • Mark Salyzyn's avatar
      ANDROID: CROSS_COMPILE_ARM32 must work if CONFIG_COMPAT_VDSO · 1a045fd7
      Mark Salyzyn authored
      
      
      Prevent surprise loss of vdso32 support.
      
      Signed-off-by: default avatarMark Salyzyn <salyzyn@google.com>
      Bug: 63737556
      Bug: 20045882
      Bug: 19198045
      Change-Id: I8b381f7649b95b298ea9e1a99aa3794c7bc08d09
      Signed-off-by: default avatarkhusika <khusikadhamar@gmail.com>
      1a045fd7
    • Kevin Brodsky's avatar
      FROMLIST: BACKPORT: [PATCH 6/6] arm64: Wire up and expose the new compat vDSO · 86363d23
      Kevin Brodsky authored
      (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: default avatarKevin Brodsky <kevin.brodsky@arm.com>
      Signed-off-by: default avatarMark 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
      Signed-off-by: default avatarkhusika <khusikadhamar@gmail.com>
      86363d23
    • Kevin Brodsky's avatar
      FROMLIST: [PATCH 5/6] arm64: compat: 32-bit vDSO setup · 29dadd77
      Kevin Brodsky authored
      (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: default avatarKevin Brodsky <kevin.brodsky@arm.com>
      Signed-off-by: default avatarMark 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
      Signed-off-by: default avatarkhusika <khusikadhamar@gmail.com>
      29dadd77
    • Kevin Brodsky's avatar
      FROMLIST: [PATCH 4/6] arm64: compat: Add a 32-bit vDSO · 3fb2afd0
      Kevin Brodsky authored
      (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: default avatarKevin 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: default avatarMark 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
      Signed-off-by: default avatarkhusika <khusikadhamar@gmail.com>
      3fb2afd0
    • Kevin Brodsky's avatar
      FROMLIST: BACKPORT: [PATCH 3/6] arm64: Refactor vDSO init/setup · 990e47a7
      Kevin Brodsky authored
      (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: default avatarKevin Brodsky <kevin.brodsky@arm.com>
      Signed-off-by: default avatarMark 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
      Signed-off-by: default avatarkhusika <khusikadhamar@gmail.com>
      990e47a7
    • Kevin Brodsky's avatar
      FROMLIST: [PATCH 2/6] arm64: elf: Set AT_SYSINFO_EHDR in compat processes · 5561e75a
      Kevin Brodsky authored
      (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: default avatarKevin Brodsky <kevin.brodsky@arm.com>
      Signed-off-by: default avatarMark 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
      Signed-off-by: default avatarkhusika <khusikadhamar@gmail.com>
      5561e75a
    • Kevin Brodsky's avatar
      FROMLIST: [PATCH 1/6] arm64: compat: Use vDSO sigreturn trampolines if available · 73d065bb
      Kevin Brodsky authored
      (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: default avatarKevin Brodsky <kevin.brodsky@arm.com>
      Signed-off-by: default avatarMark 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: Ic0933741e321e1bf66409b7e190a776f12948024
      Signed-off-by: default avatarkhusika <khusikadhamar@gmail.com>
      73d065bb
    • Mark Salyzyn's avatar
      FROMLIST: lib: vdso: add support for time · b3085789
      Mark Salyzyn authored
      (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: default avatarMark Salyzyn <salyzyn@android.com>
      Bug: 63737556
      Bug: 20045882
      Change-Id: I0bb3c6bafe57f9ed69350e2dd54edaae58316e8f
      Signed-off-by: default avatarkhusika <khusikadhamar@gmail.com>
      b3085789
    • Kevin Brodsky's avatar
      FROMLIST: [PATCH] arm64: compat: Expose offset to registers in sigframes · 09fbabfb
      Kevin Brodsky authored
      (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: default avatarKevin Brodsky <kevin.brodsky@arm.com>
      Signed-off-by: default avatarMark 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
      Signed-off-by: default avatarkhusika <khusikadhamar@gmail.com>
      09fbabfb
    • Mark Salyzyn's avatar
      FROMLIST: [PATCH v5 12/12] lib: vdso: do not expose gettimeofday, if no arch supported timer · 7ffcf553
      Mark Salyzyn authored
      (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: default avatarMark 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
      Signed-off-by: default avatarkhusika <khusikadhamar@gmail.com>
      7ffcf553
    • Mark Salyzyn's avatar
      FROMLIST: [PATCH v5 11/12] lib: vdso: Add support for CLOCK_BOOTTIME · bae63281
      Mark Salyzyn authored
      (cherry pick from url https://patchwork.kernel.org/patch/10044503/
      
      )
      
      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.
      
      Add a case for CLOCK_BOOTTIME as it is popular for measuring
      relative time on systems expected to suspend() or hibernate().
      
      Android uses CLOCK_BOOTTIME for all relative time measurements
      and timeouts. Switching to vdso reduced CPU utilization and improves
      accuracy. There is also a desire by some partners to switch all
      logging over to CLOCK_BOOTTIME, and thus this operation alone would
      contribute to a near percentile CPU load.
      
      Signed-off-by: default avatarMark 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: I76c26b054baf7f1100e03c65d6b16fe649b883b1
      Signed-off-by: default avatarkhusika <khusikadhamar@gmail.com>
      bae63281
    • Mark Salyzyn's avatar
      FROMLIST: [PATCH v5 10/12] arm64: vdso: replace gettimeofday.S with global vgettimeofday.C · c80f5d5a
      Mark Salyzyn authored
      (cherry picked from url https://patchwork.kernel.org/patch/10044501/
      
      )
      
      Take an effort from the previous 9 patches 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.
      
      apinski@cavium.com makes the following claims in the original patch:
      
      This allows the compiler to optimize the divide by 1000 and remove
      the other divides.
      
      On ThunderX, gettimeofday improves by 32%.  On ThunderX 2,
      gettimeofday improves by 18%.
      
      Note I noticed a bug in the old (arm64) implementation of
      __kernel_clock_getres; it was checking only the lower 32bits of the
      pointer; this would work for most cases but could fail in a few.
      
      <end of claim>
      
      Signed-off-by: default avatarMark 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: I71ff27ff5bfa323354fda6867b01ec908d8d6cbd
      Signed-off-by: default avatarkhusika <khusikadhamar@gmail.com>
      c80f5d5a
    • Mark Salyzyn's avatar
      FROMLIST: [PATCH v5 09/12] arm: vdso: move vgettimeofday.c to lib/vdso/ · edfff9c8
      Mark Salyzyn authored
      (cherry pick from url https://patchwork.kernel.org/patch/10044497/
      
      )
      
      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.
      
      Declare arch/arm/vdso/vgettimeofday.c to be a candidate for a global
      implementation of the vdso timer calls.  The hope is that new
      architectures can take advantage of the current unification of
      arm and arm64 implementations.
      
      We urge future efforts to merge their implementations into the
      global vgettimeofday.c file and thus provide functional parity.
      
      Signed-off-by: default avatarMark 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: If7da1d8144684d52ed9520a581e6023c623df931
      Signed-off-by: default avatarkhusika <khusikadhamar@gmail.com>
      edfff9c8
    • Mark Salyzyn's avatar
      FROMLIST: [PATCH v5 08/12] arm: vdso: Add ARCH_CLOCK_FIXED_MASK · ba7d0fba
      Mark Salyzyn authored
      (cherry picked from url https://patchwork.kernel.org/patch/10044543/
      
      )
      
      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.
      
      Add ARCH_CLOCK_FIXED_MASK as an efficiency since arm64 has no
      purpose for cs_mask vdso_data variable.
      
      Signed-off-by: default avatarMark 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: Iadf94bed6166d2ee43bb46bdf54636618e4b8854
      Signed-off-by: default avatarkhusika <khusikadhamar@gmail.com>
      ba7d0fba
    • Mark Salyzyn's avatar
      FROMLIST: [PATCH v5 07/12] arm: vdso: disable profiling · 360b5d5a
      Mark Salyzyn authored
      (cherry pick from url https://patchwork.kernel.org/patch/10044491/
      
      )
      
      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.
      
      Make sure kasan and ubsan profiling, and kcov instrumentation,
      is turned off for VDSO code.
      
      Signed-off-by: default avatarMark 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: I2b44c1edd81665b8bb235a65ba642767c35f1e61
      Signed-off-by: default avatarkhusika <khusikadhamar@gmail.com>
      360b5d5a
    • Mark Salyzyn's avatar
      FROMLIST: [PATCH v5 06/12] arm: vdso: add support for clock_getres · b2342f85
      Mark Salyzyn authored
      (cherry picked from url https://patchwork.kernel.org/patch/10044545/
      
      )
      
      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.
      
      Add clock_getres vdso support to match up with existing support in
      the arm64's vdso.
      
      Signed-off-by: default avatarMark 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: Ie37bf76d2992027f06a2cdd001d8654a860d2aac
      Signed-off-by: default avatarkhusika <khusikadhamar@gmail.com>
      b2342f85
    • Mark Salyzyn's avatar
      FROMLIST: [PATCH v6 05/12] arm: vdso: Add support for CLOCK_MONOTONIC_RAW · df9c3bff
      Mark Salyzyn authored
      (cherry pick from url https://patchwork.kernel.org/patch/10052099/
      
      )
      
      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.
      
      Add a case for CLOCK_MONOTONIC_RAW to match up with support that
      is available in arm64's vdso.
      
      Signed-off-by: default avatarMark 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: If9c09d131e236ba4a483dbc122e6b876f471df72
      Signed-off-by: default avatarkhusika <khusikadhamar@gmail.com>
      df9c3bff
    • Mark Salyzyn's avatar
      FROMLIST: [PATCH v5 04/12] arm: vdso: do calculations outside reader loops · 2073e156
      Mark Salyzyn authored
      (cherry picked from url https://patchwork.kernel.org/patch/10044477/
      
      )
      
      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.
      
      In variable timer reading loops, pick up just the values until all
      are synchronized, then outside of loop pick up cntvct and perform
      calculations to determine final offset, shifted and multiplied
      output value.
      
      This replaces get_ns with get_clock_shifted_nsec as cntvct reader.
      
      Signed-off-by: default avatarMark 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: I8008197f08485ef89b267128e41624ff69c33f6b
      Signed-off-by: default avatarkhusika <khusikadhamar@gmail.com>
      2073e156
    • Mark Salyzyn's avatar
      FROMLIST: [PATCH v5 03/12] arm: vdso: inline assembler operations to compiler.h · 3bc68d53
      Mark Salyzyn authored
      (cherry picked from commit https://patchwork.kernel.org/patch/10044507/
      
      )
      
      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.
      
      Move compiler-specific code to a local compiler.h file:
      
      - CONFIG_AEABI dependency check.
      - System call fallback functions standardized into a
        DEFINE_FALLBACK macro.
      - Replace arch_counter_get_cntvct() with arch_vdso_read_counter.
      - Deal with architecture specific unresolved references emitted
        by GCC.
      - Optimize handling of fallback calls in callers.
      - For time functions that always return success, do not waste time
        checking return value for switch to fallback.
      - Optimize unlikely nullptr checking in __vdso_gettimeofday,
        if tv null no need to proceed to fallback, as vdso is still
        capable of filling in the tv values.
      
      Signed-off-by: default avatarMark 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: I468e4c32b5136d199982bf25df8967321e384d90
      Signed-off-by: default avatarkhusika <khusikadhamar@gmail.com>
      3bc68d53
    • Mark Salyzyn's avatar
      FROMLIST: [PATCH v5 02/12] arm: vdso: add include file defining __get_datapage() · 90355a74
      Mark Salyzyn authored
      (cherry picked from url https://patchwork.kernel.org/patch/10044481/
      
      )
      
      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.
      
      Define the prototype for __get_datapage() in local datapage.h header.
      Rename all vdata variable that point to the datapage shortened to vd
      to relect a consistent and concise style. Make sure that all
      references to the datapage in vdso operations are readonly (const).
      Make sure datapage is first parameter to all subroutines to also
      be consistent.
      
      Signed-off-by: default avatarMark 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: I9512b49d36d53ca1b71d3ff82219a7c64e0fc613
      Signed-off-by: default avatarkhusika <khusikadhamar@gmail.com>
      90355a74
    • Mark Salyzyn's avatar
      FROMLIST: [PATCH v5 01/12] arm: vdso: rename vdso_datapage variables · cd13fbe4
      Mark Salyzyn authored
      (cherry picked from url https://patchwork.kernel.org/patch/10044505/
      
      )
      
      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.
      
      Rename seq_count to tb_seq_count. Rename tk_is_cntvct to use_syscall.
      Rename cs_mult to cs_mono_mult. All to align with the variables in the
      arm64 vdso datapage. Rework vdso_read_begin() and vdso_read_retry()
      functions to reflect modern access patterns for tb_seq_count field.
      
      Update copyright message to reflect the start of the contributions in
      this series.
      
      Signed-off-by: default avatarMark 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: I13f16e71b1ecba3d72b999caafef72e3c7f48dfe
      Signed-off-by: default avatarkhusika <khusikadhamar@gmail.com>
      cd13fbe4
    • Kevin Brodsky's avatar
      FROMLIST: [PATCH v3 3/3] arm64: compat: Add CONFIG_KUSER_HELPERS · d9c70400
      Kevin Brodsky authored
      (cherry picked from url http://lkml.iu.edu/hypermail/linux/kernel/1709.1/01903.html
      
      )
      
      Make it possible to disable the kuser helpers by adding a KUSER_HELPERS
      config option (enabled by default). When disabled, all kuser
      helpers-related code is removed from the kernel and no mapping is done
      at the fixed high address (0xffff0000); any attempt to use a kuser
      helper from a 32-bit process will result in a segfault.
      
      Signed-off-by: default avatarKevin Brodsky <kevin.brodsky@arm.com>
      Signed-off-by: default avatarMark Salyzyn <salyzyn@android.com>
      Bug: 9674955
      Bug: 63737556
      Bug: 20045882
      Change-Id: Ie8c543301d39bfe88ef71fb6a669e571914b117b
      Signed-off-by: default avatarkhusika <khusikadhamar@gmail.com>
      d9c70400
    • Kevin Brodsky's avatar
      FROMLIST: [PATCH v3 2/3] arm64: compat: Split the sigreturn trampolines and... · 4431ff38
      Kevin Brodsky authored
      FROMLIST: [PATCH v3 2/3] arm64: compat: Split the sigreturn trampolines and kuser helpers (assembler sources)
      
      (cherry picked from url http://lkml.iu.edu/hypermail/linux/kernel/1709.1/01902.html
      
      )
      
      AArch32 processes are currently installed a special [vectors] page that
      contains the sigreturn trampolines and the kuser helpers, at the fixed
      address mandated by the kuser helpers ABI.
      
      Having both functionalities in the same page has become problematic,
      because:
      
      * It makes it impossible to disable the kuser helpers (the sigreturn
        trampolines cannot be removed), which is possible on arm.
      
      * A future 32-bit vDSO would provide the sigreturn trampolines itself,
        making those in [vectors] redundant.
      
      This patch addresses the problem by moving the sigreturn trampolines
      sources to its own file.  Wrapped the comments to reduce the wrath of
      checkpatch.pl.
      
      Signed-off-by: default avatarKevin Brodsky <kevin.brodsky@arm.com>
      Signed-off-by: default avatarMark Salyzyn <salyzyn@android.com>
      Bug: 9674955
      Bug: 63737556
      Bug: 20045882
      Change-Id: I1d7b96e7cfbe979ecf4cb4996befd1f3ae0e64fd
      Signed-off-by: default avatarkhusika <khusikadhamar@gmail.com>
      4431ff38
    • Kevin Brodsky's avatar
      FROMLIST: [PATCH v3 1/3] arm64: compat: Split the sigreturn trampolines and... · 0857aa4b
      Kevin Brodsky authored
      FROMLIST: [PATCH v3 1/3] arm64: compat: Split the sigreturn trampolines and kuser helpers (C sources)
      
      (cherry picked from url http://lkml.iu.edu/hypermail/linux/kernel/1709.1/01901.html
      
      )
      
      AArch32 processes are currently installed a special [vectors] page that
      contains the sigreturn trampolines and the kuser helpers, at the fixed
      address mandated by the kuser helpers ABI.
      
      Having both functionalities in the same page has become problematic,
      because:
      
      * It makes it impossible to disable the kuser helpers (the sigreturn
        trampolines cannot be removed), which is possible on arm.
      
      * A future 32-bit vDSO would provide the sigreturn trampolines itself,
        making those in [vectors] redundant.
      
      This patch addresses the problem by moving the sigreturn trampolines to
      a separate [sigpage] page, mirroring [sigpage] on arm.
      
      Even though [vectors] has always been a misnomer on arm64/compat, as
      there is no AArch32 vector there (and now only the kuser helpers),
      its name has been left unchanged, for compatibility with arm (there
      are reports of software relying on [vectors] being there as the last
      mapping in /proc/maps).
      
      mm->context.vdso used to point to the [vectors] page, which is
      unnecessary (as its address is fixed). It now points to the [sigpage]
      page (whose address is randomized like a vDSO).
      
      Signed-off-by: default avatarKevin Brodsky <kevin.brodsky@arm.com>
      Signed-off-by: default avatarMark Salyzyn <salyzyn@android.com>
      Bug: 9674955
      Bug: 63737556
      Bug: 20045882
      Change-Id: I52a56ea71d7326df8c784f90eb73b5c324fe9d20
      Signed-off-by: default avatarkhusika <khusikadhamar@gmail.com>
      0857aa4b
    • Nathan Chancellor's avatar
      msm: camera: ife: Fix enum conversion warning · 93fb34ad
      Nathan Chancellor authored
      
      
      Signed-off-by: default avatarNathan Chancellor <natechancellor@gmail.com>
      Signed-off-by: default avatarkhusika <khusikadhamar@gmail.com>
      Change-Id: I0b52356cd5a0506b9e10f58f151e996711e10ae6
      93fb34ad
    • Nathan Chancellor's avatar
      mmc: sdio: Fix strlcpy usage · aab999fa
      Nathan Chancellor authored
      
      
      Fixes the following clang warning:
      
      ../drivers/mmc/core/sdio_cis.c:58:31: warning: size argument in
      'strlcpy' call appears to be size of the source; expected the size of
      the destination [-Wstrlcpy-strlcat-size]
      
      Signed-off-by: default avatarNathan Chancellor <natechancellor@gmail.com>
      Signed-off-by: default avatarkhusika <khusikadhamar@gmail.com>
      Change-Id: I1b35b56039e03fb3bf6572037fa2421302c6fe32
      aab999fa
    • Greg Hackmann's avatar
      ANDROID: Kbuild, LLVMLinux: disable clang -Wpointer-bool-conversion · a1fdbe5a
      Greg Hackmann authored
      
      
      clang warns when converting the address of an array or function to
      boolean, since it can never be NULL.  The kernel relies on gcc silently
      optimizing these checks away, like when dealing with cpumask_var_t
      (which can be either a pointer or an array object, depending on the
      value of CONFIG_CPUMASK_OFFSTACK).
      
      Change-Id: I322568a6e467d7278f065503f37dd1dddd340ef4
      Signed-off-by: default avatarGreg Hackmann <ghackmann@google.com>
      Signed-off-by: default avatarNathan Chancellor <natechancellor@gmail.com>
      Signed-off-by: default avatarkhusika <khusikadhamar@gmail.com>
      a1fdbe5a
    • Ian Abbott's avatar
      UPSTREAM: kernel.h: handle pointers to arrays better in container_of() · d8765885
      Ian Abbott authored
      If the first parameter of container_of() is a pointer to a
      non-const-qualified array type (and the third parameter names a
      non-const-qualified array member), the local variable __mptr will be
      defined with a const-qualified array type.  In ISO C, these types are
      incompatible.  They work as expected in GNU C, but some versions will
      issue warnings.  For example, GCC 4.9 produces the warning
      "initialization from incompatible pointer type".
      
      Here is an example of where the problem occurs:
      
      -------------------------------------------------------
         #include <linux/kernel.h>
         #include <linux/module.h>
      
        MODULE_LICENSE("GPL");
      
        struct st {
        	int a;
        	char b[16];
        };
      
        static int __init example_init(void) {
        	struct st t = { .a = 101, .b = "hello" };
        	char (*p)[16] = &t.b;
        	struct st *x = container_of(p, struct st, b);
        	printk(KERN_DEBUG "%p %p\n", (void *)&t, (void *)x);
        	return 0;
        }
      
        static void __exit example_exit(void) {
        }
      
        module_init(example_init);
        module_exit(example_exit);
      -------------------------------------------------------
      
      Building the module with gcc-4.9 results in these warnings (where '{m}'
      is the module source and '{k}' is the kernel source):
      
      -------------------------------------------------------
        In file included from {m}/example.c:1:0:
        {m}/example.c: In function `example_init':
        {k}/include/linux/kernel.h:854:48: warning: initialization from incompatible pointer type
          const typeof( ((type *)0)->member ) *__mptr = (ptr); \
                                                        ^
        {m}/example.c:14:17: note: in expansion of macro `container_of'
          struct st *x = container_of(p, struct st, b);
                         ^
        {k}/include/linux/kernel.h:854:48: warning: (near initialization for `x')
          const typeof( ((type *)0)->member ) *__mptr = (ptr); \
                                                        ^
        {m}/example.c:14:17: note: in expansion of macro `container_of'
          struct st *x = container_of(p, struct st, b);
                         ^
      -------------------------------------------------------
      
      Replace the type checking performed by the macro to avoid these
      warnings.  Make sure `*(ptr)` either has type compatible with the
      member, or has type compatible with `void`, ignoring qualifiers.  Raise
      compiler errors if this is not true.  This is stronger than the previous
      behaviour, which only resulted in compiler warnings for a type mismatch.
      
      [arnd@arndb.de: fix new warnings for container_of()]
        Link: http://lkml.kernel.org/r/20170620200940.90557-1-arnd@arndb.de
      Link: http://lkml.kernel.org/r/20170525120316.24473-7-abbotti@mev.co.uk
      
      
      Signed-off-by: default avatarIan Abbott <abbotti@mev.co.uk>
      Signed-off-by: default avatarArnd Bergmann <arnd@arndb.de>
      Acked-by: default avatarMichal Nazarewicz <mina86@mina86.com>
      Acked-by: default avatarKees Cook <keescook@chromium.org>
      Cc: Hidehiro Kawai <hidehiro.kawai.ez@hitachi.com>
      Cc: Borislav Petkov <bp@suse.de>
      Cc: Rasmus Villemoes <linux@rasmusvillemoes.dk>
      Cc: Johannes Berg <johannes.berg@intel.com>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Alexander Potapenko <glider@google.com>
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      
      (cherry picked from commit c7acec713d14c6ce8a20154f9dfda258d6bcad3b)
      
      Signed-off-by: default avatarNathan Chancellor <natechancellor@gmail.com>
      Signed-off-by: default avatarkhusika <khusikadhamar@gmail.com>
      Change-Id: I1f828bf8f910e41d2f40c290a2628707d42e4c87
      d8765885
    • Stephen Rothwell's avatar
      UPSTREAM: include/linux/dcache.h: use unsigned chars in struct name_snapshot · 2b0d210b
      Stephen Rothwell authored
      "kernel.h: handle pointers to arrays better in container_of()" triggers:
      
      In file included from include/uapi/linux/stddef.h:1:0,
                       from include/linux/stddef.h:4,
                       from include/uapi/linux/posix_types.h:4,
                       from include/uapi/linux/types.h:13,
                       from include/linux/types.h:5,
                       from include/linux/syscalls.h:71,
                       from fs/dcache.c:17:
      fs/dcache.c: In function 'release_dentry_name_snapshot':
      include/linux/compiler.h:542:38: error: call to '__compiletime_assert_305' declared with attribute error: pointer type mismatch in container_of()
        _compiletime_assert(condition, msg, __compiletime_assert_, __LINE__)
                                            ^
      include/linux/compiler.h:525:4: note: in definition of macro '__compiletime_assert'
          prefix ## suffix();    \
          ^
      include/linux/compiler.h:542:2: note: in expansion of macro '_compiletime_assert'
        _compiletime_assert(condition, msg, __compiletime_assert_, __LINE__)
        ^
      include/linux/build_bug.h:46:37: note: in expansion of macro 'compiletime_assert'
       #define BUILD_BUG_ON_MSG(cond, msg) compiletime_assert(!(cond), msg)
                                           ^
      include/linux/kernel.h:860:2: note: in expansion of macro 'BUILD_BUG_ON_MSG'
        BUILD_BUG_ON_MSG(!__same_type(*(ptr), ((type *)0)->member) && \
        ^
      fs/dcache.c:305:7: note: in expansion of macro 'container_of'
         p = container_of(name->name, struct external_name, name[0]);
      
      Switch name_snapshot to use unsigned chars, matching struct qstr and
      struct external_name.
      
      Link: http://lkml.kernel.org/r/20170710152134.0f78c1e6@canb.auug.org.au
      
      
      Signed-off-by: default avatarStephen Rothwell <sfr@canb.auug.org.au>
      Cc: Al Viro <viro@zeniv.linux.org.uk>
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      (cherry picked from commit 0a2c13d9cd76c84f2520f573ff83f777eb7464aa)
      Signed-off-by: default avatarNathan Chancellor <natechancellor@gmail.com>
      Signed-off-by: default avatarkhusika <khusikadhamar@gmail.com>
      Change-Id: Ia62795251230b81969f588132d1da0c5cdf1bd8e
      2b0d210b
    • Nathan Chancellor's avatar
      crypto: msm: Increase frame-larger-than warning · 0eb4d45b
      Nathan Chancellor authored
      
      
      Signed-off-by: default avatarNathan Chancellor <natechancellor@gmail.com>
      Signed-off-by: default avatarkhusika <khusikadhamar@gmail.com>
      Change-Id: I8479fa22f339a71a41a3a947b7dbad2960c32224
      0eb4d45b
    • Sami Tolvanen's avatar
      soc: qcom: smp2p: fix __iomem access in SMP2P_{GET,SET}_* · f24fca19
      Sami Tolvanen authored
      
      
      Bug: 64527440
      Bug: 62093296
      Change-Id: I42b4d433f24b30e5e3fedd2e86b1191f7175c7a8
      Signed-off-by: default avatarSami Tolvanen <samitolvanen@google.com>
      [@nathanchance: Forward port to msm-4.9]
      Signed-off-by: default avatarNathan Chancellor <natechancellor@gmail.com>
      Signed-off-by: default avatarkhusika <khusikadhamar@gmail.com>
      f24fca19
Loading