Skip to content

Commit 450a60e

Browse files
committed
regmap: Implement regmap_multi_reg_read()
Merge series from Guenter Roeck <[email protected]>: regmap_multi_reg_read() is similar to regmap_bilk_read() but reads from an array of non-sequential registers. It is helpful if multiple non- sequential registers need to be read in a single operation which would otherwise have to be mutex protected. The name of the new function was chosen to match the existing function regmap_multi_reg_write().
2 parents f21711b + 3c1ff93 commit 450a60e

File tree

294 files changed

+3883
-1831
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

294 files changed

+3883
-1831
lines changed

.mailmap

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -608,6 +608,7 @@ Simon Kelley <[email protected]>
608608
Sricharan Ramabadhran <[email protected]> <[email protected]>
609609
610610
611+
Stanislav Fomichev <[email protected]> <[email protected]>
611612
612613
Stéphane Witzmann <[email protected]>
613614

Documentation/admin-guide/kernel-parameters.txt

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2192,12 +2192,6 @@
21922192
Format: 0 | 1
21932193
Default set by CONFIG_INIT_ON_FREE_DEFAULT_ON.
21942194

2195-
init_mlocked_on_free= [MM] Fill freed userspace memory with zeroes if
2196-
it was mlock'ed and not explicitly munlock'ed
2197-
afterwards.
2198-
Format: 0 | 1
2199-
Default set by CONFIG_INIT_MLOCKED_ON_FREE_DEFAULT_ON
2200-
22012195
init_pkru= [X86] Specify the default memory protection keys rights
22022196
register contents for all processes. 0x55555554 by
22032197
default (disallow access to all but pkey 0). Can

Documentation/devicetree/bindings/dma/fsl,edma.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -59,8 +59,8 @@ properties:
5959
- 3
6060

6161
dma-channels:
62-
minItems: 1
63-
maxItems: 64
62+
minimum: 1
63+
maximum: 64
6464

6565
clocks:
6666
minItems: 1

Documentation/devicetree/bindings/i2c/atmel,at91sam-i2c.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ required:
7777
- clocks
7878

7979
allOf:
80-
- $ref: i2c-controller.yaml
80+
- $ref: /schemas/i2c/i2c-controller.yaml#
8181
- if:
8282
properties:
8383
compatible:

Documentation/devicetree/bindings/i2c/google,cros-ec-i2c-tunnel.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ description: |
2121
google,cros-ec-spi or google,cros-ec-i2c.
2222
2323
allOf:
24-
- $ref: i2c-controller.yaml#
24+
- $ref: /schemas/i2c/i2c-controller.yaml#
2525

2626
properties:
2727
compatible:

Documentation/i2c/i2c_bus.svg

Lines changed: 8 additions & 7 deletions
Loading

Documentation/i2c/summary.rst

Lines changed: 50 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -3,59 +3,80 @@ Introduction to I2C and SMBus
33
=============================
44

55
I²C (pronounce: I squared C and written I2C in the kernel documentation) is
6-
a protocol developed by Philips. It is a slow two-wire protocol (variable
7-
speed, up to 400 kHz), with a high speed extension (3.4 MHz). It provides
6+
a protocol developed by Philips. It is a two-wire protocol with variable
7+
speed (typically up to 400 kHz, high speed modes up to 5 MHz). It provides
88
an inexpensive bus for connecting many types of devices with infrequent or
9-
low bandwidth communications needs. I2C is widely used with embedded
10-
systems. Some systems use variants that don't meet branding requirements,
9+
low bandwidth communications needs. I2C is widely used with embedded
10+
systems. Some systems use variants that don't meet branding requirements,
1111
and so are not advertised as being I2C but come under different names,
1212
e.g. TWI (Two Wire Interface), IIC.
1313

14-
The latest official I2C specification is the `"I2C-bus specification and user
15-
manual" (UM10204) <https://www.nxp.com/webapp/Download?colCode=UM10204>`_
16-
published by NXP Semiconductors. However, you need to log-in to the site to
17-
access the PDF. An older version of the specification (revision 6) is archived
18-
`here <https://web.archive.org/web/20210813122132/https://www.nxp.com/docs/en/user-guide/UM10204.pdf>`_.
14+
The latest official I2C specification is the `"I²C-bus specification and user
15+
manual" (UM10204) <https://www.nxp.com/docs/en/user-guide/UM10204.pdf>`_
16+
published by NXP Semiconductors, version 7 as of this writing.
1917

2018
SMBus (System Management Bus) is based on the I2C protocol, and is mostly
21-
a subset of I2C protocols and signaling. Many I2C devices will work on an
19+
a subset of I2C protocols and signaling. Many I2C devices will work on an
2220
SMBus, but some SMBus protocols add semantics beyond what is required to
23-
achieve I2C branding. Modern PC mainboards rely on SMBus. The most common
21+
achieve I2C branding. Modern PC mainboards rely on SMBus. The most common
2422
devices connected through SMBus are RAM modules configured using I2C EEPROMs,
2523
and hardware monitoring chips.
2624

2725
Because the SMBus is mostly a subset of the generalized I2C bus, we can
28-
use its protocols on many I2C systems. However, there are systems that don't
26+
use its protocols on many I2C systems. However, there are systems that don't
2927
meet both SMBus and I2C electrical constraints; and others which can't
3028
implement all the common SMBus protocol semantics or messages.
3129

3230

3331
Terminology
3432
===========
3533

36-
Using the terminology from the official documentation, the I2C bus connects
37-
one or more *master* chips and one or more *slave* chips.
34+
The I2C bus connects one or more controller chips and one or more target chips.
3835

3936
.. kernel-figure:: i2c_bus.svg
40-
:alt: Simple I2C bus with one master and 3 slaves
37+
:alt: Simple I2C bus with one controller and 3 targets
4138

4239
Simple I2C bus
4340

44-
A **master** chip is a node that starts communications with slaves. In the
45-
Linux kernel implementation it is called an **adapter** or bus. Adapter
46-
drivers are in the ``drivers/i2c/busses/`` subdirectory.
41+
A **controller** chip is a node that starts communications with targets. In the
42+
Linux kernel implementation it is also called an "adapter" or "bus". Controller
43+
drivers are usually in the ``drivers/i2c/busses/`` subdirectory.
4744

48-
An **algorithm** contains general code that can be used to implement a
49-
whole class of I2C adapters. Each specific adapter driver either depends on
50-
an algorithm driver in the ``drivers/i2c/algos/`` subdirectory, or includes
51-
its own implementation.
45+
An **algorithm** contains general code that can be used to implement a whole
46+
class of I2C controllers. Each specific controller driver either depends on an
47+
algorithm driver in the ``drivers/i2c/algos/`` subdirectory, or includes its
48+
own implementation.
5249

53-
A **slave** chip is a node that responds to communications when addressed
54-
by the master. In Linux it is called a **client**. Client drivers are kept
55-
in a directory specific to the feature they provide, for example
56-
``drivers/media/gpio/`` for GPIO expanders and ``drivers/media/i2c/`` for
50+
A **target** chip is a node that responds to communications when addressed by a
51+
controller. In the Linux kernel implementation it is also called a "client".
52+
While targets are usually separate external chips, Linux can also act as a
53+
target (needs hardware support) and respond to another controller on the bus.
54+
This is then called a **local target**. In contrast, an external chip is called
55+
a **remote target**.
56+
57+
Target drivers are kept in a directory specific to the feature they provide,
58+
for example ``drivers/gpio/`` for GPIO expanders and ``drivers/media/i2c/`` for
5759
video-related chips.
5860

59-
For the example configuration in figure, you will need a driver for your
60-
I2C adapter, and drivers for your I2C devices (usually one driver for each
61-
device).
61+
For the example configuration in the figure above, you will need one driver for
62+
the I2C controller, and drivers for your I2C targets. Usually one driver for
63+
each target.
64+
65+
Synonyms
66+
--------
67+
68+
As mentioned above, the Linux I2C implementation historically uses the terms
69+
"adapter" for controller and "client" for target. A number of data structures
70+
have these synonyms in their name. So, when discussing implementation details,
71+
you should be aware of these terms as well. The official wording is preferred,
72+
though.
73+
74+
Outdated terminology
75+
--------------------
76+
77+
In earlier I2C specifications, controller was named "master" and target was
78+
named "slave". These terms have been obsoleted with v7 of the specification and
79+
their use is also discouraged by the Linux Kernel Code of Conduct. You may
80+
still find them in references to documentation which has not been updated. The
81+
general attitude, however, is to use the inclusive terms: controller and
82+
target. Work to replace the old terminology in the Linux Kernel is on-going.

Documentation/netlink/specs/nfsd.yaml

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -123,8 +123,6 @@ operations:
123123
doc: dump pending nfsd rpc
124124
attribute-set: rpc-status
125125
dump:
126-
pre: nfsd-nl-rpc-status-get-start
127-
post: nfsd-nl-rpc-status-get-done
128126
reply:
129127
attributes:
130128
- xid

Documentation/userspace-api/index.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@ Security-related interfaces
3232
seccomp_filter
3333
landlock
3434
lsm
35+
mfd_noexec
3536
spec_ctrl
3637
tee
3738

Lines changed: 86 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,86 @@
1+
.. SPDX-License-Identifier: GPL-2.0
2+
3+
==================================
4+
Introduction of non-executable mfd
5+
==================================
6+
:Author:
7+
Daniel Verkamp <[email protected]>
8+
9+
10+
:Contributor:
11+
Aleksa Sarai <[email protected]>
12+
13+
Since Linux introduced the memfd feature, memfds have always had their
14+
execute bit set, and the memfd_create() syscall doesn't allow setting
15+
it differently.
16+
17+
However, in a secure-by-default system, such as ChromeOS, (where all
18+
executables should come from the rootfs, which is protected by verified
19+
boot), this executable nature of memfd opens a door for NoExec bypass
20+
and enables “confused deputy attack”. E.g, in VRP bug [1]: cros_vm
21+
process created a memfd to share the content with an external process,
22+
however the memfd is overwritten and used for executing arbitrary code
23+
and root escalation. [2] lists more VRP of this kind.
24+
25+
On the other hand, executable memfd has its legit use: runc uses memfd’s
26+
seal and executable feature to copy the contents of the binary then
27+
execute them. For such a system, we need a solution to differentiate runc's
28+
use of executable memfds and an attacker's [3].
29+
30+
To address those above:
31+
- Let memfd_create() set X bit at creation time.
32+
- Let memfd be sealed for modifying X bit when NX is set.
33+
- Add a new pid namespace sysctl: vm.memfd_noexec to help applications in
34+
migrating and enforcing non-executable MFD.
35+
36+
User API
37+
========
38+
``int memfd_create(const char *name, unsigned int flags)``
39+
40+
``MFD_NOEXEC_SEAL``
41+
When MFD_NOEXEC_SEAL bit is set in the ``flags``, memfd is created
42+
with NX. F_SEAL_EXEC is set and the memfd can't be modified to
43+
add X later. MFD_ALLOW_SEALING is also implied.
44+
This is the most common case for the application to use memfd.
45+
46+
``MFD_EXEC``
47+
When MFD_EXEC bit is set in the ``flags``, memfd is created with X.
48+
49+
Note:
50+
``MFD_NOEXEC_SEAL`` implies ``MFD_ALLOW_SEALING``. In case that
51+
an app doesn't want sealing, it can add F_SEAL_SEAL after creation.
52+
53+
54+
Sysctl:
55+
========
56+
``pid namespaced sysctl vm.memfd_noexec``
57+
58+
The new pid namespaced sysctl vm.memfd_noexec has 3 values:
59+
60+
- 0: MEMFD_NOEXEC_SCOPE_EXEC
61+
memfd_create() without MFD_EXEC nor MFD_NOEXEC_SEAL acts like
62+
MFD_EXEC was set.
63+
64+
- 1: MEMFD_NOEXEC_SCOPE_NOEXEC_SEAL
65+
memfd_create() without MFD_EXEC nor MFD_NOEXEC_SEAL acts like
66+
MFD_NOEXEC_SEAL was set.
67+
68+
- 2: MEMFD_NOEXEC_SCOPE_NOEXEC_ENFORCED
69+
memfd_create() without MFD_NOEXEC_SEAL will be rejected.
70+
71+
The sysctl allows finer control of memfd_create for old software that
72+
doesn't set the executable bit; for example, a container with
73+
vm.memfd_noexec=1 means the old software will create non-executable memfd
74+
by default while new software can create executable memfd by setting
75+
MFD_EXEC.
76+
77+
The value of vm.memfd_noexec is passed to child namespace at creation
78+
time. In addition, the setting is hierarchical, i.e. during memfd_create,
79+
we will search from current ns to root ns and use the most restrictive
80+
setting.
81+
82+
[1] https://crbug.com/1305267
83+
84+
[2] https://bugs.chromium.org/p/chromium/issues/list?q=type%3Dbug-security%20memfd%20escalation&can=1
85+
86+
[3] https://lwn.net/Articles/781013/

0 commit comments

Comments
 (0)