Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 90565f52 authored by qctecmdr's avatar qctecmdr Committed by Gerrit - the friendly Code Review server
Browse files

Merge "Merge android-4.14.151 (2bb70f40) into msm-4.14"

parents f2180965 8ad87c80
Loading
Loading
Loading
Loading
+76 −0
Original line number Diff line number Diff line
What:		/sys/class/wakeup/
Date:		June 2019
Contact:	Tri Vo <trong@android.com>
Description:
		The /sys/class/wakeup/ directory contains pointers to all
		wakeup sources in the kernel at that moment in time.

What:		/sys/class/wakeup/.../name
Date:		June 2019
Contact:	Tri Vo <trong@android.com>
Description:
		This file contains the name of the wakeup source.

What:		/sys/class/wakeup/.../active_count
Date:		June 2019
Contact:	Tri Vo <trong@android.com>
Description:
		This file contains the number of times the wakeup source was
		activated.

What:		/sys/class/wakeup/.../event_count
Date:		June 2019
Contact:	Tri Vo <trong@android.com>
Description:
		This file contains the number of signaled wakeup events
		associated with the wakeup source.

What:		/sys/class/wakeup/.../wakeup_count
Date:		June 2019
Contact:	Tri Vo <trong@android.com>
Description:
		This file contains the number of times the wakeup source might
		abort suspend.

What:		/sys/class/wakeup/.../expire_count
Date:		June 2019
Contact:	Tri Vo <trong@android.com>
Description:
		This file contains the number of times the wakeup source's
		timeout has expired.

What:		/sys/class/wakeup/.../active_time_ms
Date:		June 2019
Contact:	Tri Vo <trong@android.com>
Description:
		This file contains the amount of time the wakeup source has
		been continuously active, in milliseconds.  If the wakeup
		source is not active, this file contains '0'.

What:		/sys/class/wakeup/.../total_time_ms
Date:		June 2019
Contact:	Tri Vo <trong@android.com>
Description:
		This file contains the total amount of time this wakeup source
		has been active, in milliseconds.

What:		/sys/class/wakeup/.../max_time_ms
Date:		June 2019
Contact:	Tri Vo <trong@android.com>
Description:
		This file contains the maximum amount of time this wakeup
		source has been continuously active, in milliseconds.

What:		/sys/class/wakeup/.../last_change_ms
Date:		June 2019
Contact:	Tri Vo <trong@android.com>
Description:
		This file contains the monotonic clock time when the wakeup
		source was touched last time, in milliseconds.

What:		/sys/class/wakeup/.../prevent_suspend_time_ms
Date:		June 2019
Contact:	Tri Vo <trong@android.com>
Description:
		The file contains the total amount of time this wakeup source
		has been preventing autosleep, in milliseconds.
+15 −0
Original line number Diff line number Diff line
@@ -243,3 +243,18 @@ Description:
		 - Del: echo '[h/c]!extension' > /sys/fs/f2fs/<disk>/extension_list
		 - [h] means add/del hot file extension
		 - [c] means add/del cold file extension

What:		/sys/fs/f2fs/<disk>/unusable
Date		April 2019
Contact:	"Daniel Rosenberg" <drosen@google.com>
Description:
		If checkpoint=disable, it displays the number of blocks that are unusable.
                If checkpoint=enable it displays the enumber of blocks that would be unusable
                if checkpoint=disable were to be set.

What:		/sys/fs/f2fs/<disk>/encoding
Date		July 2019
Contact:	"Daniel Rosenberg" <drosen@google.com>
Description:
		Displays name and version of the encoding set for the filesystem.
                If no encoding is set, displays (none)
+120 −0
Original line number Diff line number Diff line
@@ -285,3 +285,123 @@ Description:
		Writing a "1" to this file enables the debug messages and
		writing a "0" (default) to it disables them.  Reads from
		this file return the current value.

What:		/sys/power/resume_offset
Date:		April 2018
Contact:	Mario Limonciello <mario.limonciello@dell.com>
Description:
		This file is used for telling the kernel an offset into a disk
		to use when hibernating the system such as with a swap file.

		Reads from this file will display the current offset
		the kernel will be using on the next hibernation
		attempt.

		Using this sysfs file will override any values that were
		set using the kernel command line for disk offset.

What:		/sys/power/suspend_stats
Date:		July 2019
Contact:	Kalesh Singh <kaleshsingh96@gmail.com>
Description:
		The /sys/power/suspend_stats directory contains suspend related
		statistics.

What:		/sys/power/suspend_stats/success
Date:		July 2019
Contact:	Kalesh Singh <kaleshsingh96@gmail.com>
Description:
		The /sys/power/suspend_stats/success file contains the number
		of times entering system sleep state succeeded.

What:		/sys/power/suspend_stats/fail
Date:		July 2019
Contact:	Kalesh Singh <kaleshsingh96@gmail.com>
Description:
		The /sys/power/suspend_stats/fail file contains the number
		of times entering system sleep state failed.

What:		/sys/power/suspend_stats/failed_freeze
Date:		July 2019
Contact:	Kalesh Singh <kaleshsingh96@gmail.com>
Description:
		The /sys/power/suspend_stats/failed_freeze file contains the
		number of times freezing processes failed.

What:		/sys/power/suspend_stats/failed_prepare
Date:		July 2019
Contact:	Kalesh Singh <kaleshsingh96@gmail.com>
Description:
		The /sys/power/suspend_stats/failed_prepare file contains the
		number of times preparing all non-sysdev devices for
		a system PM transition failed.

What:		/sys/power/suspend_stats/failed_resume
Date:		July 2019
Contact:	Kalesh Singh <kaleshsingh96@gmail.com>
Description:
		The /sys/power/suspend_stats/failed_resume file contains the
		number of times executing "resume" callbacks of
		non-sysdev devices failed.

What:		/sys/power/suspend_stats/failed_resume_early
Date:		July 2019
Contact:	Kalesh Singh <kaleshsingh96@gmail.com>
Description:
		The /sys/power/suspend_stats/failed_resume_early file contains
		the number of times executing "early resume" callbacks
		of devices failed.

What:		/sys/power/suspend_stats/failed_resume_noirq
Date:		July 2019
Contact:	Kalesh Singh <kaleshsingh96@gmail.com>
Description:
		The /sys/power/suspend_stats/failed_resume_noirq file contains
		the number of times executing "noirq resume" callbacks
		of devices failed.

What:		/sys/power/suspend_stats/failed_suspend
Date:		July 2019
Contact:	Kalesh Singh <kaleshsingh96@gmail.com>
Description:
		The /sys/power/suspend_stats/failed_suspend file contains
		the number of times executing "suspend" callbacks
		of all non-sysdev devices failed.

What:		/sys/power/suspend_stats/failed_suspend_late
Date:		July 2019
Contact:	Kalesh Singh <kaleshsingh96@gmail.com>
Description:
		The /sys/power/suspend_stats/failed_suspend_late file contains
		the number of times executing "late suspend" callbacks
		of all devices failed.

What:		/sys/power/suspend_stats/failed_suspend_noirq
Date:		July 2019
Contact:	Kalesh Singh <kaleshsingh96@gmail.com>
Description:
		The /sys/power/suspend_stats/failed_suspend_noirq file contains
		the number of times executing "noirq suspend" callbacks
		of all devices failed.

What:		/sys/power/suspend_stats/last_failed_dev
Date:		July 2019
Contact:	Kalesh Singh <kaleshsingh96@gmail.com>
Description:
		The /sys/power/suspend_stats/last_failed_dev file contains
		the last device for which a suspend/resume callback failed.

What:		/sys/power/suspend_stats/last_failed_errno
Date:		July 2019
Contact:	Kalesh Singh <kaleshsingh96@gmail.com>
Description:
		The /sys/power/suspend_stats/last_failed_errno file contains
		the errno of the last failed attempt at entering
		system sleep state.

What:		/sys/power/suspend_stats/last_failed_step
Date:		July 2019
Contact:	Kalesh Singh <kaleshsingh96@gmail.com>
Description:
		The /sys/power/suspend_stats/last_failed_step file contains
		the last failed step in the suspend/resume path.
+10 −1
Original line number Diff line number Diff line
@@ -1581,6 +1581,15 @@

	initrd=		[BOOT] Specify the location of the initial ramdisk

	init_on_alloc=	[MM] Fill newly allocated pages and heap objects with
			zeroes.
			Format: 0 | 1
			Default set by CONFIG_INIT_ON_ALLOC_DEFAULT_ON.

	init_on_free=	[MM] Fill freed pages and heap objects with zeroes.
			Format: 0 | 1
			Default set by CONFIG_INIT_ON_FREE_DEFAULT_ON.

	init_pkru=	[x86] Specify the default memory protection keys rights
			register contents for all processes.  0x55555554 by
			default (disallow access to all but pkey 0).  Can
+156 −0
Original line number Diff line number Diff line
==========================
AArch64 TAGGED ADDRESS ABI
==========================

Authors: Vincenzo Frascino <vincenzo.frascino@arm.com>
         Catalin Marinas <catalin.marinas@arm.com>

Date: 21 August 2019

This document describes the usage and semantics of the Tagged Address
ABI on AArch64 Linux.

1. Introduction
---------------

On AArch64 the ``TCR_EL1.TBI0`` bit is set by default, allowing
userspace (EL0) to perform memory accesses through 64-bit pointers with
a non-zero top byte. This document describes the relaxation of the
syscall ABI that allows userspace to pass certain tagged pointers to
kernel syscalls.

2. AArch64 Tagged Address ABI
-----------------------------

From the kernel syscall interface perspective and for the purposes of
this document, a "valid tagged pointer" is a pointer with a potentially
non-zero top-byte that references an address in the user process address
space obtained in one of the following ways:

- ``mmap()`` syscall where either:

  - flags have the ``MAP_ANONYMOUS`` bit set or
  - the file descriptor refers to a regular file (including those
    returned by ``memfd_create()``) or ``/dev/zero``

- ``brk()`` syscall (i.e. the heap area between the initial location of
  the program break at process creation and its current location).

- any memory mapped by the kernel in the address space of the process
  during creation and with the same restrictions as for ``mmap()`` above
  (e.g. data, bss, stack).

The AArch64 Tagged Address ABI has two stages of relaxation depending
how the user addresses are used by the kernel:

1. User addresses not accessed by the kernel but used for address space
   management (e.g. ``mmap()``, ``mprotect()``, ``madvise()``). The use
   of valid tagged pointers in this context is always allowed.

2. User addresses accessed by the kernel (e.g. ``write()``). This ABI
   relaxation is disabled by default and the application thread needs to
   explicitly enable it via ``prctl()`` as follows:

   - ``PR_SET_TAGGED_ADDR_CTRL``: enable or disable the AArch64 Tagged
     Address ABI for the calling thread.

     The ``(unsigned int) arg2`` argument is a bit mask describing the
     control mode used:

     - ``PR_TAGGED_ADDR_ENABLE``: enable AArch64 Tagged Address ABI.
       Default status is disabled.

     Arguments ``arg3``, ``arg4``, and ``arg5`` must be 0.

   - ``PR_GET_TAGGED_ADDR_CTRL``: get the status of the AArch64 Tagged
     Address ABI for the calling thread.

     Arguments ``arg2``, ``arg3``, ``arg4``, and ``arg5`` must be 0.

   The ABI properties described above are thread-scoped, inherited on
   clone() and fork() and cleared on exec().

   Calling ``prctl(PR_SET_TAGGED_ADDR_CTRL, PR_TAGGED_ADDR_ENABLE, 0, 0, 0)``
   returns ``-EINVAL`` if the AArch64 Tagged Address ABI is globally
   disabled by ``sysctl abi.tagged_addr_disabled=1``. The default
   ``sysctl abi.tagged_addr_disabled`` configuration is 0.

When the AArch64 Tagged Address ABI is enabled for a thread, the
following behaviours are guaranteed:

- All syscalls except the cases mentioned in section 3 can accept any
  valid tagged pointer.

- The syscall behaviour is undefined for invalid tagged pointers: it may
  result in an error code being returned, a (fatal) signal being raised,
  or other modes of failure.

- The syscall behaviour for a valid tagged pointer is the same as for
  the corresponding untagged pointer.


A definition of the meaning of tagged pointers on AArch64 can be found
in Documentation/arm64/tagged-pointers.rst.

3. AArch64 Tagged Address ABI Exceptions
-----------------------------------------

The following system call parameters must be untagged regardless of the
ABI relaxation:

- ``prctl()`` other than pointers to user data either passed directly or
  indirectly as arguments to be accessed by the kernel.

- ``ioctl()`` other than pointers to user data either passed directly or
  indirectly as arguments to be accessed by the kernel.

- ``shmat()`` and ``shmdt()``.

Any attempt to use non-zero tagged pointers may result in an error code
being returned, a (fatal) signal being raised, or other modes of
failure.

4. Example of correct usage
---------------------------
.. code-block:: c

   #include <stdlib.h>
   #include <string.h>
   #include <unistd.h>
   #include <sys/mman.h>
   #include <sys/prctl.h>
   
   #define PR_SET_TAGGED_ADDR_CTRL	55
   #define PR_TAGGED_ADDR_ENABLE	(1UL << 0)
   
   #define TAG_SHIFT		56
   
   int main(void)
   {
   	int tbi_enabled = 0;
   	unsigned long tag = 0;
   	char *ptr;
   
   	/* check/enable the tagged address ABI */
   	if (!prctl(PR_SET_TAGGED_ADDR_CTRL, PR_TAGGED_ADDR_ENABLE, 0, 0, 0))
   		tbi_enabled = 1;
   
   	/* memory allocation */
   	ptr = mmap(NULL, sysconf(_SC_PAGE_SIZE), PROT_READ | PROT_WRITE,
   		   MAP_PRIVATE | MAP_ANONYMOUS, -1, 0);
   	if (ptr == MAP_FAILED)
   		return 1;
   
   	/* set a non-zero tag if the ABI is available */
   	if (tbi_enabled)
   		tag = rand() & 0xff;
   	ptr = (char *)((unsigned long)ptr | (tag << TAG_SHIFT));
   
   	/* memory access to a tagged address */
   	strcpy(ptr, "tagged pointer\n");
   
   	/* syscall with a tagged pointer */
   	write(1, ptr, strlen(ptr));
   
   	return 0;
   }
Loading