]> git.proxmox.com Git - mirror_ubuntu-hirsute-kernel.git/log
mirror_ubuntu-hirsute-kernel.git
3 years agoUBUNTU: [Config] Update CONFIG_E1000E for ppc64el in annotations
Seth Forshee [Wed, 4 Nov 2020 20:46:21 +0000 (14:46 -0600)]
UBUNTU: [Config] Update CONFIG_E1000E for ppc64el in annotations

BugLink: https://bugs.launchpad.net/bugs/1902687
This option now depends on CONFIG_DMI, and thus is no longer
selectable for ppc64el. Update the annotations accordingly.

Signed-off-by: Seth Forshee <seth.forshee@canonical.com>
3 years agoUBUNTU: SAUCE: e1000e: Add more Dell CML systems into s0ix heuristics
Mario Limonciello [Tue, 3 Nov 2020 10:31:17 +0000 (12:31 +0200)]
UBUNTU: SAUCE: e1000e: Add more Dell CML systems into s0ix heuristics

BugLink: https://bugs.launchpad.net/bugs/1902687
These comet lake systems are not yet released, but have been validated
on pre-release hardware.

This is being submitted separately from released hardware in case of
a regression between pre-release and release hardware so this commit
can be reverted alone.

Signed-off-by: Mario Limonciello <mario.limonciello@dell.com>
Tested-by: Yijun Shen <Yijun.shen@dell.com>
Signed-off-by: Timo Aaltonen <timo.aaltonen@canonical.com>
Signed-off-by: Seth Forshee <seth.forshee@canonical.com>
3 years agoUBUNTU: SAUCE: e1000e: Add Dell's Comet Lake systems into s0ix heuristics
Mario Limonciello [Tue, 3 Nov 2020 10:31:16 +0000 (12:31 +0200)]
UBUNTU: SAUCE: e1000e: Add Dell's Comet Lake systems into s0ix heuristics

BugLink: https://bugs.launchpad.net/bugs/1902687
Dell's Comet Lake Latitude and Precision systems containing i219LM are
properly configured and should use the s0ix flows.

Signed-off-by: Mario Limonciello <mario.limonciello@dell.com>
Tested-by: Yijun Shen <Yijun.shen@dell.com>
Signed-off-by: Timo Aaltonen <timo.aaltonen@canonical.com>
Signed-off-by: Seth Forshee <seth.forshee@canonical.com>
3 years agoUBUNTU: SAUCE: e1000e: allow turning s0ix flows on for systems with ME
Mario Limonciello [Tue, 3 Nov 2020 10:31:15 +0000 (12:31 +0200)]
UBUNTU: SAUCE: e1000e: allow turning s0ix flows on for systems with ME

BugLink: https://bugs.launchpad.net/bugs/1902687
S0ix for GBE flows are needed for allowing the system to get into deepest
power state, but these require coordination of components outside of
control of Linux kernel.  For systems that have confirmed to coordinate
this properly, allow turning on the s0ix flows at load time or runtime.

Fixes: e086ba2fccda ("e1000e: disable s0ix entry and exit flows for ME systems")
Signed-off-by: Mario Limonciello <mario.limonciello@dell.com>
Tested-by: Aaron Brown <aaron.f.brown@intel.com>
Signed-off-by: Timo Aaltonen <timo.aaltonen@canonical.com>
Signed-off-by: Seth Forshee <seth.forshee@canonical.com>
3 years agoUBUNTU: [Config] Disable CONFIG_CRYPTO_USER_API_ENABLE_OBSOLETE
dann frazier [Mon, 2 Nov 2020 16:42:18 +0000 (09:42 -0700)]
UBUNTU: [Config] Disable CONFIG_CRYPTO_USER_API_ENABLE_OBSOLETE

Disables deprecated algorithms unused by the kernel but exposed to userspace
via AF_ALG as recommended here:

 https://lists.linaro.org/pipermail/cross-distro/2020-October/000938.html

As noted, iwd (universe) did have a dependency on the kernel's ecb(arc4) but
upstream has now replaced that with a userspace version:

https://git.kernel.org/pub/scm/network/wireless/iwd.git/commit/?id=1db8a85a60c645232eb5bba1ec0cd0a2927ccd16

While we have a new enough iwd in hirsute, focal's version still has this
dependency. So, if we decide to do this, we may also want to SRU that back.

Signed-off-by: dann frazier <dann.frazier@canonical.com>
[ saf: add disabled modules to modules.ignore ]
Signed-off-by: Seth Forshee <seth.forshee@canonical.com>
3 years agoUBUNTU: SAUCE: perf/x86/intel/uncore: Add Rocket Lake support
Kan Liang [Thu, 29 Oct 2020 09:09:27 +0000 (11:09 +0200)]
UBUNTU: SAUCE: perf/x86/intel/uncore: Add Rocket Lake support

BugLink: https://bugs.launchpad.net/bugs/1902004
For Rocket Lake, the MSR uncore, e.g., CBOX, ARB and CLOCKBOX, are the
same as Tiger Lake. Share the perf code with it.

For Rocket Lake and Tiger Lake, the 8th CBOX is not mapped into a
different MSR space anymore. Add rkl_uncore_msr_init_box() to replace
skl_uncore_msr_init_box().

The IMC uncore is the similar to Ice Lake. Add new PCIIDs of IMC for
Rocket Lake.

Signed-off-by: Kan Liang <kan.liang@linux.intel.com>
Signed-off-by: Timo Aaltonen <timo.aaltonen@canonical.com>
Signed-off-by: Seth Forshee <seth.forshee@canonical.com>
3 years agoUBUNTU: SAUCE: perf/x86/msr: Add Rocket Lake CPU support
Kan Liang [Thu, 29 Oct 2020 09:09:26 +0000 (11:09 +0200)]
UBUNTU: SAUCE: perf/x86/msr: Add Rocket Lake CPU support

BugLink: https://bugs.launchpad.net/bugs/1902004
Like Ice Lake and Tiger Lake, PPERF and SMI_COUNT MSRs are also
supported by Rocket Lake.

Signed-off-by: Kan Liang <kan.liang@linux.intel.com>
Signed-off-by: Timo Aaltonen <timo.aaltonen@canonical.com>
Signed-off-by: Seth Forshee <seth.forshee@canonical.com>
3 years agoUBUNTU: SAUCE: perf/x86/cstate: Add Rocket Lake CPU support
Kan Liang [Thu, 29 Oct 2020 09:09:25 +0000 (11:09 +0200)]
UBUNTU: SAUCE: perf/x86/cstate: Add Rocket Lake CPU support

BugLink: https://bugs.launchpad.net/bugs/1902004
From the perspective of Intel cstate residency counters, Rocket Lake is
the same as Ice Lake and Tiger Lake. Share the code with them. Update
the comments for Rocket Lake.

Signed-off-by: Kan Liang <kan.liang@linux.intel.com>
Signed-off-by: Timo Aaltonen <timo.aaltonen@canonical.com>
Signed-off-by: Seth Forshee <seth.forshee@canonical.com>
3 years agoUBUNTU: SAUCE: perf/x86/intel: Add Rocket Lake CPU support
Kan Liang [Thu, 29 Oct 2020 09:09:24 +0000 (11:09 +0200)]
UBUNTU: SAUCE: perf/x86/intel: Add Rocket Lake CPU support

BugLink: https://bugs.launchpad.net/bugs/1902004
From the perspective of Intel PMU, Rocket Lake is the same as Ice Lake
and Tiger Lake. Share the perf code with them.

Signed-off-by: Kan Liang <kan.liang@linux.intel.com>
Signed-off-by: Timo Aaltonen <timo.aaltonen@canonical.com>
Signed-off-by: Seth Forshee <seth.forshee@canonical.com>
3 years agoUBUNTU: Ubuntu-5.10-5.10.0-2.3
Seth Forshee [Wed, 4 Nov 2020 03:01:52 +0000 (21:01 -0600)]
UBUNTU: Ubuntu-5.10-5.10.0-2.3

Signed-off-by: Seth Forshee <seth.forshee@canonical.com>
3 years agoUBUNTU: Start new release
Seth Forshee [Wed, 4 Nov 2020 03:00:43 +0000 (21:00 -0600)]
UBUNTU: Start new release

Ignore: yes
Signed-off-by: Seth Forshee <seth.forshee@canonical.com>
3 years agoUBUNTU: [Debian] Update package names in getabis
Seth Forshee [Wed, 4 Nov 2020 03:00:13 +0000 (21:00 -0600)]
UBUNTU: [Debian] Update package names in getabis

Ignore: yes
Signed-off-by: Seth Forshee <seth.forshee@canonical.com>
3 years agoUBUNTU: [Debian] Include scripts/module.lds from builddir in headers package
Seth Forshee [Wed, 4 Nov 2020 00:12:45 +0000 (18:12 -0600)]
UBUNTU: [Debian] Include scripts/module.lds from builddir in headers package

The script which was previously named scripts/module-common.lds
has now been renamed to scripts/module.lds.S. We need the final
linker script in headers packages. Move it to the per-arch
headers packages since it may now differ between architectures.

Signed-off-by: Seth Forshee <seth.forshee@canonical.com>
3 years agoUBUNTU: [Config] Switch arm64 default cpufreq governor to ondemand
Seth Forshee [Tue, 3 Nov 2020 13:22:34 +0000 (07:22 -0600)]
UBUNTU: [Config] Switch arm64 default cpufreq governor to ondemand

Reverting back to the previous setting on the advice of cking.

Signed-off-by: Seth Forshee <seth.forshee@canonical.com>
3 years agoUBUNTU: Ubuntu-5.10-5.10.0-1.2
Seth Forshee [Mon, 2 Nov 2020 19:18:27 +0000 (13:18 -0600)]
UBUNTU: Ubuntu-5.10-5.10.0-1.2

Signed-off-by: Seth Forshee <seth.forshee@canonical.com>
3 years agoUBUNTU: update dkms package versions
Seth Forshee [Mon, 2 Nov 2020 19:15:36 +0000 (13:15 -0600)]
UBUNTU: update dkms package versions

BugLink: https://bugs.launchpad.net/bugs/1786013
Signed-off-by: Seth Forshee <seth.forshee@canonical.com>
3 years agoUBUNTU: [Config] Temporarily disable DEBUG_INFO_BTF for armhf
Seth Forshee [Mon, 2 Nov 2020 19:10:39 +0000 (13:10 -0600)]
UBUNTU: [Config] Temporarily disable DEBUG_INFO_BTF for armhf

pahole is segfaulting on armhf. A fix is in progress, but in the
mean time disable BTF to get a working build.

Signed-off-by: Seth Forshee <seth.forshee@canonical.com>
3 years agoUBUNTU: [Config] Switch default CPUFreq governer for arm64/armhf to schedultil
Seth Forshee [Mon, 2 Nov 2020 18:12:52 +0000 (12:12 -0600)]
UBUNTU: [Config] Switch default CPUFreq governer for arm64/armhf to schedultil

This is now the upstream default for these architectures, so
update our configs to match.

Signed-off-by: Seth Forshee <seth.forshee@canonical.com>
3 years agoUBUNTU: [Config] Update numerous configs to conform with policy
Seth Forshee [Mon, 2 Nov 2020 18:05:57 +0000 (12:05 -0600)]
UBUNTU: [Config] Update numerous configs to conform with policy

When reviewing the annotations updates for the 5.10-rc2 rebase,
I noted a large number of options which did not conform to our
config policy. These have been updated. I suspect there may be
others from the 5.10-rc1 rebase which also do not conform to
policy, so further review is needed.

Signed-off-by: Seth Forshee <seth.forshee@canonical.com>
3 years agoUBUNTU: [Config] Update configs and annotations after rebase to 5.10-rc2
Seth Forshee [Mon, 2 Nov 2020 15:35:18 +0000 (09:35 -0600)]
UBUNTU: [Config] Update configs and annotations after rebase to 5.10-rc2

Signed-off-by: Seth Forshee <seth.forshee@canonical.com>
3 years agoUBUNTU: Rebase to v5.10-rc2
Seth Forshee [Mon, 2 Nov 2020 15:33:40 +0000 (09:33 -0600)]
UBUNTU: Rebase to v5.10-rc2

Ignore: yes
Signed-off-by: Seth Forshee <seth.forshee@canonical.com>
3 years agoUBUNTU: Start new release
Seth Forshee [Mon, 2 Nov 2020 15:33:04 +0000 (09:33 -0600)]
UBUNTU: Start new release

Ignore: yes
Signed-off-by: Seth Forshee <seth.forshee@canonical.com>
3 years agoUBUNTU: [Packaging] move to hirsute
Paolo Pisati [Thu, 29 Oct 2020 15:30:09 +0000 (16:30 +0100)]
UBUNTU: [Packaging] move to hirsute

Signed-off-by: Paolo Pisati <paolo.pisati@canonical.com>
3 years agoUBUNTU: SAUCE: PCI: Enable ACS quirk on all CML root ports
Kai-Heng Feng [Thu, 22 Oct 2020 05:51:00 +0000 (07:51 +0200)]
UBUNTU: SAUCE: PCI: Enable ACS quirk on all CML root ports

BugLink: https://bugs.launchpad.net/bugs/1900847
In addition to KIOXIA NVMe, Intel NVMe under another root port also has
the same ACS violation issue.

According to Intel, all CML root ports need this workaround, so add all
root ports from [1] to existing quirk.

[1] Intel® 400 Series Chipset Family Platform Controller Hub (PCH) Datasheet, Volume 1 of 2, Content ID: 620854 Version: 002

Signed-off-by: Kai-Heng Feng <kai.heng.feng@canonical.com>
Acked-by: Stefan Bader <stefan.bader@canonical.com>
Acked-by: Kleber Sacilotto de Souza <kleber.souza@canonical.com>
Signed-off-by: Kleber Sacilotto de Souza <kleber.souza@canonical.com>
Signed-off-by: Paolo Pisati <paolo.pisati@canonical.com>
3 years agoUBUNTU: Ubuntu-5.10-5.10.0-0.1
Paolo Pisati [Tue, 27 Oct 2020 15:57:08 +0000 (16:57 +0100)]
UBUNTU: Ubuntu-5.10-5.10.0-0.1

Signed-off-by: Paolo Pisati <paolo.pisati@canonical.com>
3 years agoUBUNTU: update dkms package versions
Paolo Pisati [Tue, 27 Oct 2020 15:55:58 +0000 (16:55 +0100)]
UBUNTU: update dkms package versions

BugLink: https://bugs.launchpad.net/bugs/1786013
Signed-off-by: Paolo Pisati <paolo.pisati@canonical.com>
3 years agoUBUNTU: SAUCE: LSM: Use lsmblob in smk_netlbl_mls()
Paolo Pisati [Tue, 27 Oct 2020 11:04:12 +0000 (11:04 +0000)]
UBUNTU: SAUCE: LSM: Use lsmblob in smk_netlbl_mls()

Signed-off-by: Paolo Pisati <paolo.pisati@canonical.com>
3 years agoUBUNTU: SAUCE: LSM: change ima_read_file() to use lsmblob
Paolo Pisati [Tue, 27 Oct 2020 10:27:39 +0000 (10:27 +0000)]
UBUNTU: SAUCE: LSM: change ima_read_file() to use lsmblob

Signed-off-by: Paolo Pisati <paolo.pisati@canonical.com>
3 years agoUBUNTU: SAUCE: apparmor: rename kzfree() to kfree_sensitive()
Paolo Pisati [Tue, 27 Oct 2020 09:45:23 +0000 (09:45 +0000)]
UBUNTU: SAUCE: apparmor: rename kzfree() to kfree_sensitive()

Signed-off-by: Paolo Pisati <paolo.pisati@canonical.com>
3 years agoUBUNTU: SAUCE: platform/x86: dell-uart-backlight: rename kzfree() to kfree_sensitive()
Paolo Pisati [Tue, 27 Oct 2020 09:43:59 +0000 (09:43 +0000)]
UBUNTU: SAUCE: platform/x86: dell-uart-backlight: rename kzfree() to kfree_sensitive()

Signed-off-by: Paolo Pisati <paolo.pisati@canonical.com>
3 years agoUBUNTU: [Config] Update configs and annotations for v5.10-rc1
Paolo Pisati [Mon, 26 Oct 2020 15:12:41 +0000 (16:12 +0100)]
UBUNTU: [Config] Update configs and annotations for v5.10-rc1

Signed-off-by: Paolo Pisati <paolo.pisati@canonical.com>
3 years agoUBUNTU: Rebase to v5.10-rc1
Paolo Pisati [Mon, 26 Oct 2020 14:32:18 +0000 (15:32 +0100)]
UBUNTU: Rebase to v5.10-rc1

Ignore: yes
Signed-off-by: Paolo Pisati <paolo.pisati@canonical.com>
3 years agoUBUNTU: Start new release
Paolo Pisati [Mon, 26 Oct 2020 13:55:49 +0000 (14:55 +0100)]
UBUNTU: Start new release

Ignore: yes
Signed-off-by: Paolo Pisati <paolo.pisati@canonical.com>
3 years agoUBUNTU: SAUCE: doc: remove python3-venv dependency
Paolo Pisati [Thu, 8 Oct 2020 09:33:20 +0000 (11:33 +0200)]
UBUNTU: SAUCE: doc: remove python3-venv dependency

BugLink: https://bugs.launchpad.net/bugs/1896801
Since upstream has removed python3-venv, update our build dependencies and let
linux-doc build outside a virtualenv.

Signed-off-by: Paolo Pisati <paolo.pisati@canonical.com>
Acked-by: Colin Ian King <colin.king@canonical.com>
Acked-by: Andrea Righi <andrea.righi@canonical.com>
Signed-off-by: Seth Forshee <seth.forshee@canonical.com>
3 years agoUBUNTU: SAUCE: dccp: avoid double free of ccid on child socket
Thadeu Lima de Souza Cascardo [Fri, 28 Aug 2020 02:47:47 +0000 (23:47 -0300)]
UBUNTU: SAUCE: dccp: avoid double free of ccid on child socket

When a dccp socket is cloned, the pointers to dccps_hc_rx_ccid and
dccps_hc_tx_ccid are copied. When CCID features are activated on the child
socket, the CCID objects are freed, leaving the parent socket with dangling
pointers.

During cloning, set dccps_hc_rx_ccid and dccps_hc_tx_ccid to NULL so the
parent objects are not freed.

Reported-by: Hadar Manor
CVE-2020-16119
Signed-off-by: Thadeu Lima de Souza Cascardo <cascardo@canonical.com>
Acked-by: Stefan Bader <stefan.bader@canonical.com>
Acked-by: Juerg Haefliger <juerg.haefliger@canonical.com>
Signed-off-by: Seth Forshee <seth.forshee@canonical.com>
3 years agoUBUNTU: SAUCE: drm/dp: HP DreamColor panel brigntness fix
Kai-Heng Feng [Wed, 7 Oct 2020 11:54:03 +0000 (19:54 +0800)]
UBUNTU: SAUCE: drm/dp: HP DreamColor panel brigntness fix

BugLink: https://bugs.launchpad.net/bugs/1898865
HP DreamColor panel, which is used by new HP ZBook Studio, needs to use
DPCD to control brightness.

Signed-off-by: Kai-Heng Feng <kai.heng.feng@canonical.com>
Acked-by: Stefan Bader <stefan.bader@canonical.com>
Acked-by: Kleber Sacilotto de Souza <kleber.souza@canonical.com>
Signed-off-by: Seth Forshee <seth.forshee@canonical.com>
3 years agoUBUNTU: SAUCE: drm/i915/dpcd_bl: Skip testing control capability with force DPCD...
Kai-Heng Feng [Wed, 7 Oct 2020 11:54:00 +0000 (19:54 +0800)]
UBUNTU: SAUCE: drm/i915/dpcd_bl: Skip testing control capability with force DPCD quirk

BugLink: https://bugs.launchpad.net/bugs/1898865
HP DreamColor panel needs to be controlled via AUX interface. However,
it has both DP_EDP_BACKLIGHT_BRIGHTNESS_AUX_SET_CAP and
DP_EDP_BACKLIGHT_BRIGHTNESS_PWM_PIN_CAP set, so it fails to pass
intel_dp_aux_display_control_capable() test.

Skip the test if the panel has force DPCD quirk.

Signed-off-by: Kai-Heng Feng <kai.heng.feng@canonical.com>
Acked-by: Stefan Bader <stefan.bader@canonical.com>
Acked-by: Kleber Sacilotto de Souza <kleber.souza@canonical.com>
Signed-off-by: Seth Forshee <seth.forshee@canonical.com>
3 years agoUBUNTU: SAUCE: Audit: Fix for missing NULL check
Casey Schaufler [Tue, 1 Sep 2020 18:19:11 +0000 (11:19 -0700)]
UBUNTU: SAUCE: Audit: Fix for missing NULL check

AppArmor audit calls can have a NULL audit context,
so the LSM context audit needs to check for this.

Signed-off-by: Casey Schaufler <casey@schaufler-ca.com>
Signed-off-by: John Johansen <john.johansen@canonical.com>
Acked-by: Andrea Righi <andrea.righi@canonical.com>
Signed-off-by: Seth Forshee <seth.forshee@canonical.com>
3 years agoUBUNTU: SAUCE: AppArmor: Remove the exclusive flag
Casey Schaufler [Mon, 6 Apr 2020 15:05:13 +0000 (08:05 -0700)]
UBUNTU: SAUCE: AppArmor: Remove the exclusive flag

With the inclusion of the "display" process attribute
mechanism AppArmor no longer needs to be treated as an
"exclusive" security module. Remove the flag that indicates
it is exclusive. Remove the stub getpeersec_dgram AppArmor
hook as it has no effect in the single LSM case and
interferes in the multiple LSM case.

Acked-by: Stephen Smalley <sds@tycho.nsa.gov>
Reviewed-by: Kees Cook <keescook@chromium.org>
Reviewed-by: John Johansen <john.johansen@canonical.com>
Signed-off-by: Casey Schaufler <casey@schaufler-ca.com>
Signed-off-by: John Johansen <john.johansen@canonical.com>
Acked-by: Andrea Righi <andrea.righi@canonical.com>
Signed-off-by: Seth Forshee <seth.forshee@canonical.com>
3 years agoUBUNTU: SAUCE: LSM: Add /proc attr entry for full LSM context
Casey Schaufler [Fri, 21 Aug 2020 22:27:38 +0000 (15:27 -0700)]
UBUNTU: SAUCE: LSM: Add /proc attr entry for full LSM context

Add an entry /proc/.../attr/context which displays the full
process security "context" in compound format:
        lsm1\0value\0lsm2\0value\0...
This entry is not writable.

A security module may decide that its policy does not allow
this information to be displayed. In this case none of the
information will be displayed.

Reviewed-by: Kees Cook <keescook@chromium.org>
Signed-off-by: Casey Schaufler <casey@schaufler-ca.com>
Cc: linux-api@vger.kernel.org
Signed-off-by: John Johansen <john.johansen@canonical.com>
Acked-by: Andrea Righi <andrea.righi@canonical.com>
Signed-off-by: Seth Forshee <seth.forshee@canonical.com>
3 years agoUBUNTU: SAUCE: Audit: Add a new record for multiple object LSM
Casey Schaufler [Fri, 21 Aug 2020 21:59:03 +0000 (14:59 -0700)]
UBUNTU: SAUCE: Audit: Add a new record for multiple object LSM
 attributes

Create a new audit record type to contain the object information
when there are multiple security modules that require such data.
This record is emitted before the other records for the event, but
is linked with the same timestamp and serial number.

Signed-off-by: Casey Schaufler <casey@schaufler-ca.com>
Cc: linux-audit@redhat.com
Signed-off-by: John Johansen <john.johansen@canonical.com>
Acked-by: Andrea Righi <andrea.righi@canonical.com>
Signed-off-by: Seth Forshee <seth.forshee@canonical.com>
3 years agoUBUNTU: SAUCE: Audit: Add new record for multiple process LSM attributes
Casey Schaufler [Fri, 21 Aug 2020 21:29:19 +0000 (14:29 -0700)]
UBUNTU: SAUCE: Audit: Add new record for multiple process LSM attributes

Create a new audit record type to contain the subject information
when there are multiple security modules that require such data.
This record is linked with the same timestamp and serial number.
The record is produced only in cases where there is more than one
security module with a process "context".

Before this change the only audit events that required multiple
records were syscall events. Several non-syscall events include
subject contexts, so the use of audit_context data has been expanded
as necessary.

Signed-off-by: Casey Schaufler <casey@schaufler-ca.com>
Cc: linux-audit@redhat.com
Signed-off-by: John Johansen <john.johansen@canonical.com>
Acked-by: Andrea Righi <andrea.righi@canonical.com>
Signed-off-by: Seth Forshee <seth.forshee@canonical.com>
3 years agoUBUNTU: SAUCE: LSM: Verify LSM display sanity in binder
Casey Schaufler [Tue, 24 Mar 2020 00:00:09 +0000 (17:00 -0700)]
UBUNTU: SAUCE: LSM: Verify LSM display sanity in binder

Verify that the tasks on the ends of a binder transaction
use the same "display" security module. This prevents confusion
of security "contexts".

Reviewed-by: Kees Cook <keescook@chromium.org>
Acked-by: Stephen Smalley <sds@tycho.nsa.gov>
Signed-off-by: Casey Schaufler <casey@schaufler-ca.com>
Signed-off-by: John Johansen <john.johansen@canonical.com>
Acked-by: Andrea Righi <andrea.righi@canonical.com>
Signed-off-by: Seth Forshee <seth.forshee@canonical.com>
3 years agoUBUNTU: SAUCE: NET: Store LSM netlabel data in a lsmblob
Casey Schaufler [Fri, 21 Aug 2020 17:54:15 +0000 (10:54 -0700)]
UBUNTU: SAUCE: NET: Store LSM netlabel data in a lsmblob

Netlabel uses LSM interfaces requiring an lsmblob and
the internal storage is used to pass information between
these interfaces, so change the internal data from a secid
to a lsmblob. Update the netlabel interfaces and their
callers to accommodate the change. This requires that the
modules using netlabel use the lsm_id.slot to access the
correct secid when using netlabel.

Reviewed-by: Kees Cook <keescook@chromium.org>
Reviewed-by: John Johansen <john.johansen@canonical.com>
Acked-by: Stephen Smalley <sds@tycho.nsa.gov>
Signed-off-by: Casey Schaufler <casey@schaufler-ca.com>
Cc: netdev@vger.kernel.org
Signed-off-by: John Johansen <john.johansen@canonical.com>
Acked-by: Andrea Righi <andrea.righi@canonical.com>
Signed-off-by: Seth Forshee <seth.forshee@canonical.com>
3 years agoUBUNTU: SAUCE: LSM: security_secid_to_secctx in netlink netfilter
Casey Schaufler [Fri, 21 Aug 2020 00:14:14 +0000 (17:14 -0700)]
UBUNTU: SAUCE: LSM: security_secid_to_secctx in netlink netfilter

Change netlink netfilter interfaces to use lsmcontext
pointers, and remove scaffolding.

Reviewed-by: Kees Cook <keescook@chromium.org>
Reviewed-by: John Johansen <john.johansen@canonical.com>
Acked-by: Stephen Smalley <sds@tycho.nsa.gov>
Signed-off-by: Casey Schaufler <casey@schaufler-ca.com>
cc: netdev@vger.kernel.org
Signed-off-by: John Johansen <john.johansen@canonical.com>
Acked-by: Andrea Righi <andrea.righi@canonical.com>
Signed-off-by: Seth Forshee <seth.forshee@canonical.com>
3 years agoUBUNTU: SAUCE: LSM: Use lsmcontext in security_inode_getsecctx
Casey Schaufler [Thu, 20 Aug 2020 23:25:25 +0000 (16:25 -0700)]
UBUNTU: SAUCE: LSM: Use lsmcontext in security_inode_getsecctx

Change the security_inode_getsecctx() interface to fill
a lsmcontext structure instead of data and length pointers.
This provides the information about which LSM created the
context so that security_release_secctx() can use the
correct hook.

Acked-by: Stephen Smalley <sds@tycho.nsa.gov>
Signed-off-by: Casey Schaufler <casey@schaufler-ca.com>
Signed-off-by: John Johansen <john.johansen@canonical.com>
Acked-by: Andrea Righi <andrea.righi@canonical.com>
Signed-off-by: Seth Forshee <seth.forshee@canonical.com>
3 years agoUBUNTU: SAUCE: LSM: Use lsmcontext in security_secid_to_secctx
Casey Schaufler [Thu, 20 Aug 2020 22:19:52 +0000 (15:19 -0700)]
UBUNTU: SAUCE: LSM: Use lsmcontext in security_secid_to_secctx

Replace the (secctx,seclen) pointer pair with a single
lsmcontext pointer to allow return of the LSM identifier
along with the context and context length. This allows
security_release_secctx() to know how to release the
context. Callers have been modified to use or save the
returned data from the new structure.

Reviewed-by: Kees Cook <keescook@chromium.org>
Acked-by: Stephen Smalley <sds@tycho.nsa.gov>
Acked-by: Paul Moore <paul@paul-moore.com>
Signed-off-by: Casey Schaufler <casey@schaufler-ca.com>
Cc: netdev@vger.kernel.org
Signed-off-by: John Johansen <john.johansen@canonical.com>
Acked-by: Andrea Righi <andrea.righi@canonical.com>
Signed-off-by: Seth Forshee <seth.forshee@canonical.com>
3 years agoUBUNTU: SAUCE: LSM: Ensure the correct LSM context releaser
Casey Schaufler [Thu, 20 Aug 2020 18:47:01 +0000 (11:47 -0700)]
UBUNTU: SAUCE: LSM: Ensure the correct LSM context releaser

Add a new lsmcontext data structure to hold all the information
about a "security context", including the string, its size and
which LSM allocated the string. The allocation information is
necessary because LSMs have different policies regarding the
lifecycle of these strings. SELinux allocates and destroys
them on each use, whereas Smack provides a pointer to an entry
in a list that never goes away.

Reviewed-by: Kees Cook <keescook@chromium.org>
Reviewed-by: John Johansen <john.johansen@canonical.com>
Acked-by: Stephen Smalley <sds@tycho.nsa.gov>
Signed-off-by: Casey Schaufler <casey@schaufler-ca.com>
Cc: linux-integrity@vger.kernel.org
Cc: netdev@vger.kernel.org
Signed-off-by: John Johansen <john.johansen@canonical.com>
Acked-by: Andrea Righi <andrea.righi@canonical.com>
Signed-off-by: Seth Forshee <seth.forshee@canonical.com>
3 years agoUBUNTU: SAUCE: LSM: Specify which LSM to display
Casey Schaufler [Thu, 20 Aug 2020 17:40:08 +0000 (10:40 -0700)]
UBUNTU: SAUCE: LSM: Specify which LSM to display

Create a new entry "display" in the procfs attr directory for
controlling which LSM security information is displayed for a
process. A process can only read or write its own display value.

The name of an active LSM that supplies hooks for
human readable data may be written to "display" to set the
value. The name of the LSM currently in use can be read from
"display". At this point there can only be one LSM capable
of display active. A helper function lsm_task_display() is
provided to get the display slot for a task_struct.

Setting the "display" requires that all security modules using
setprocattr hooks allow the action. Each security module is
responsible for defining its policy.

AppArmor hook provided by John Johansen <john.johansen@canonical.com>
SELinux hook provided by Stephen Smalley <sds@tycho.nsa.gov>

Reviewed-by: Kees Cook <keescook@chromium.org>
Acked-by: Stephen Smalley <sds@tycho.nsa.gov>
Acked-by: Paul Moore <paul@paul-moore.com>
Signed-off-by: Casey Schaufler <casey@schaufler-ca.com>
Signed-off-by: John Johansen <john.johansen@canonical.com>
Acked-by: Andrea Righi <andrea.righi@canonical.com>
Signed-off-by: Seth Forshee <seth.forshee@canonical.com>
3 years agoUBUNTU: SAUCE: IMA: Change internal interfaces to use lsmblobs
Casey Schaufler [Thu, 20 Aug 2020 16:24:21 +0000 (09:24 -0700)]
UBUNTU: SAUCE: IMA: Change internal interfaces to use lsmblobs

The IMA interfaces ima_get_action() and ima_match_policy()
call LSM functions that use lsmblobs. Change the IMA functions
to pass the lsmblob to be compatible with the LSM functions.

Reviewed-by: Kees Cook <keescook@chromium.org>
Reviewed-by: John Johansen <john.johansen@canonical.com>
Acked-by: Stephen Smalley <sds@tycho.nsa.gov>
Signed-off-by: Casey Schaufler <casey@schaufler-ca.com>
cc: linux-integrity@vger.kernel.org
Signed-off-by: John Johansen <john.johansen@canonical.com>
Acked-by: Andrea Righi <andrea.righi@canonical.com>
[ saf: resolve conflicts ]
Signed-off-by: Seth Forshee <seth.forshee@canonical.com>
3 years agoUBUNTU: SAUCE: LSM: Use lsmblob in security_cred_getsecid
Casey Schaufler [Thu, 20 Aug 2020 15:43:21 +0000 (08:43 -0700)]
UBUNTU: SAUCE: LSM: Use lsmblob in security_cred_getsecid

Change the security_cred_getsecid() interface to fill in a
lsmblob instead of a u32 secid. The associated data elements
in the audit sub-system are changed from a secid to a lsmblob
to accommodate multiple possible LSM audit users.

Reviewed-by: Kees Cook <keescook@chromium.org>
Reviewed-by: John Johansen <john.johansen@canonical.com>
Acked-by: Stephen Smalley <sds@tycho.nsa.gov>
Acked-by: Paul Moore <paul@paul-moore.com>
Signed-off-by: Casey Schaufler <casey@schaufler-ca.com>
cc: linux-integrity@vger.kernel.org
Signed-off-by: John Johansen <john.johansen@canonical.com>
Acked-by: Andrea Righi <andrea.righi@canonical.com>
Signed-off-by: Seth Forshee <seth.forshee@canonical.com>
3 years agoUBUNTU: SAUCE: LSM: Use lsmblob in security_inode_getsecid
Casey Schaufler [Thu, 20 Aug 2020 00:28:57 +0000 (17:28 -0700)]
UBUNTU: SAUCE: LSM: Use lsmblob in security_inode_getsecid

Change the security_inode_getsecid() interface to fill in a
lsmblob structure instead of a u32 secid. This allows for its
callers to gather data from all registered LSMs. Data is provided
for IMA and audit.

Reviewed-by: Kees Cook <keescook@chromium.org>
Reviewed-by: John Johansen <john.johansen@canonical.com>
Signed-off-by: Casey Schaufler <casey@schaufler-ca.com>
Acked-by: Stephen Smalley <sds@tycho.nsa.gov>
cc: linux-integrity@vger.kernel.org
Signed-off-by: John Johansen <john.johansen@canonical.com>
Acked-by: Andrea Righi <andrea.righi@canonical.com>
[ saf: resolve conflicts ]
Signed-off-by: Seth Forshee <seth.forshee@canonical.com>
3 years agoUBUNTU: SAUCE: LSM: Use lsmblob in security_task_getsecid
Casey Schaufler [Wed, 19 Aug 2020 23:06:37 +0000 (16:06 -0700)]
UBUNTU: SAUCE: LSM: Use lsmblob in security_task_getsecid

Change the security_task_getsecid() interface to fill in
a lsmblob structure instead of a u32 secid in support of
LSM stacking. Audit interfaces will need to collect all
possible secids for possible reporting.

Reviewed-by: Kees Cook <keescook@chromium.org>
Reviewed-by: John Johansen <john.johansen@canonical.com>
Acked-by: Stephen Smalley <sds@tycho.nsa.gov>
Signed-off-by: Casey Schaufler <casey@schaufler-ca.com>
cc: linux-integrity@vger.kernel.org
Signed-off-by: John Johansen <john.johansen@canonical.com>
Acked-by: Andrea Righi <andrea.righi@canonical.com>
[ saf: resolve conflicts ]
Signed-off-by: Seth Forshee <seth.forshee@canonical.com>
3 years agoUBUNTU: SAUCE: LSM: Use lsmblob in security_ipc_getsecid
Casey Schaufler [Thu, 19 Mar 2020 16:40:29 +0000 (09:40 -0700)]
UBUNTU: SAUCE: LSM: Use lsmblob in security_ipc_getsecid

There may be more than one LSM that provides IPC data
for auditing. Change security_ipc_getsecid() to fill in
a lsmblob structure instead of the u32 secid. The
audit data structure containing the secid will be updated
later, so there is a bit of scaffolding here.

Reviewed-by: Kees Cook <keescook@chromium.org>
Reviewed-by: John Johansen <john.johansen@canonical.com>
Acked-by: Stephen Smalley <sds@tycho.nsa.gov>
Signed-off-by: Casey Schaufler <casey@schaufler-ca.com>
Signed-off-by: John Johansen <john.johansen@canonical.com>
Acked-by: Andrea Righi <andrea.righi@canonical.com>
Signed-off-by: Seth Forshee <seth.forshee@canonical.com>
3 years agoUBUNTU: SAUCE: LSM: Use lsmblob in security_secid_to_secctx
Casey Schaufler [Wed, 19 Aug 2020 16:32:48 +0000 (09:32 -0700)]
UBUNTU: SAUCE: LSM: Use lsmblob in security_secid_to_secctx

Change security_secid_to_secctx() to take a lsmblob as input
instead of a u32 secid. It will then call the LSM hooks
using the lsmblob element allocated for that module. The
callers have been updated as well. This allows for the
possibility that more than one module may be called upon
to translate a secid to a string, as can occur in the
audit code.

Reviewed-by: Kees Cook <keescook@chromium.org>
Reviewed-by: John Johansen <john.johansen@canonical.com>
Acked-by: Stephen Smalley <sds@tycho.nsa.gov>
Signed-off-by: Casey Schaufler <casey@schaufler-ca.com>
Signed-off-by: John Johansen <john.johansen@canonical.com>
Acked-by: Andrea Righi <andrea.righi@canonical.com>
Signed-off-by: Seth Forshee <seth.forshee@canonical.com>
3 years agoUBUNTU: SAUCE: LSM: Use lsmblob in security_secctx_to_secid
Casey Schaufler [Fri, 3 Jul 2020 16:59:12 +0000 (09:59 -0700)]
UBUNTU: SAUCE: LSM: Use lsmblob in security_secctx_to_secid

Change security_secctx_to_secid() to fill in a lsmblob instead
of a u32 secid. Multiple LSMs may be able to interpret the
string, and this allows for setting whichever secid is
appropriate. Change security_secmark_relabel_packet() to use a
lsmblob instead of a u32 secid. In some other cases there is
scaffolding where interfaces have yet to be converted.

Reviewed-by: Kees Cook <keescook@chromium.org>
Signed-off-by: Casey Schaufler <casey@schaufler-ca.com>
Cc: netdev@vger.kernel.org
Signed-off-by: John Johansen <john.johansen@canonical.com>
Acked-by: Andrea Righi <andrea.righi@canonical.com>
Signed-off-by: Seth Forshee <seth.forshee@canonical.com>
3 years agoUBUNTU: SAUCE: net: Prepare UDS for security module stacking
Casey Schaufler [Tue, 21 Jul 2020 21:05:54 +0000 (14:05 -0700)]
UBUNTU: SAUCE: net: Prepare UDS for security module stacking

Change the data used in UDS SO_PEERSEC processing from a
secid to a more general struct lsmblob. Update the
security_socket_getpeersec_dgram() interface to use the
lsmblob. There is a small amount of scaffolding code
that will come out when the security_secid_to_secctx()
code is brought in line with the lsmblob.

Signed-off-by: Casey Schaufler <casey@schaufler-ca.com>
Signed-off-by: John Johansen <john.johansen@canonical.com>
Acked-by: Andrea Righi <andrea.righi@canonical.com>
Signed-off-by: Seth Forshee <seth.forshee@canonical.com>
3 years agoUBUNTU: SAUCE: LSM: Use lsmblob in security_kernel_act_as
Casey Schaufler [Tue, 18 Aug 2020 17:12:56 +0000 (10:12 -0700)]
UBUNTU: SAUCE: LSM: Use lsmblob in security_kernel_act_as

Change the security_kernel_act_as interface to use a lsmblob
structure in place of the single u32 secid in support of
module stacking. Change its only caller, set_security_override,
to do the same. Change that one's only caller,
set_security_override_from_ctx, to call it with the new
parameter type.

The security module hook is unchanged, still taking a secid.
The infrastructure passes the correct entry from the lsmblob.
lsmblob_init() is used to fill the lsmblob structure, however
this will be removed later in the series when security_secctx_to_secid()
is undated to provide a lsmblob instead of a secid.

Reviewed-by: Kees Cook <keescook@chromium.org>
Reviewed-by: John Johansen <john.johansen@canonical.com>
Acked-by: Stephen Smalley <sds@tycho.nsa.gov>
Signed-off-by: Casey Schaufler <casey@schaufler-ca.com>
Signed-off-by: John Johansen <john.johansen@canonical.com>
Acked-by: Andrea Righi <andrea.righi@canonical.com>
Signed-off-by: Seth Forshee <seth.forshee@canonical.com>
3 years agoUBUNTU: SAUCE: LSM: Use lsmblob in security_audit_rule_match
Casey Schaufler [Tue, 18 Aug 2020 00:15:27 +0000 (17:15 -0700)]
UBUNTU: SAUCE: LSM: Use lsmblob in security_audit_rule_match

Change the secid parameter of security_audit_rule_match
to a lsmblob structure pointer. Pass the entry from the
lsmblob structure for the approprite slot to the LSM hook.

Change the users of security_audit_rule_match to use the
lsmblob instead of a u32. The scaffolding function lsmblob_init()
fills the blob with the value of the old secid, ensuring that
it is available to the appropriate module hook. The sources of
the secid, security_task_getsecid() and security_inode_getsecid(),
will be converted to use the blob structure later in the series.
At the point the use of lsmblob_init() is dropped.

Reviewed-by: Kees Cook <keescook@chromium.org>
Reviewed-by: John Johansen <john.johansen@canonical.com>
Acked-by: Stephen Smalley <sds@tycho.nsa.gov>
Signed-off-by: Casey Schaufler <casey@schaufler-ca.com>
Signed-off-by: John Johansen <john.johansen@canonical.com>
Acked-by: Andrea Righi <andrea.righi@canonical.com>
[ saf: resolve conflicts ]
Signed-off-by: Seth Forshee <seth.forshee@canonical.com>
3 years agoUBUNTU: SAUCE: LSM: Create and manage the lsmblob data structure.
Casey Schaufler [Mon, 17 Aug 2020 23:02:56 +0000 (16:02 -0700)]
UBUNTU: SAUCE: LSM: Create and manage the lsmblob data structure.

When more than one security module is exporting data to
audit and networking sub-systems a single 32 bit integer
is no longer sufficient to represent the data. Add a
structure to be used instead.

The lsmblob structure is currently an array of
u32 "secids". There is an entry for each of the
security modules built into the system that would
use secids if active. The system assigns the module
a "slot" when it registers hooks. If modules are
compiled in but not registered there will be unused
slots.

A new lsm_id structure, which contains the name
of the LSM and its slot number, is created. There
is an instance for each LSM, which assigns the name
and passes it to the infrastructure to set the slot.

The audit rules data is expanded to use an array of
security module data rather than a single instance.
Because IMA uses the audit rule functions it is
affected as well.

Acked-by: Stephen Smalley <sds@tycho.nsa.gov>
Acked-by: Paul Moore <paul@paul-moore.com>
Signed-off-by: Casey Schaufler <casey@schaufler-ca.com>
Signed-off-by: John Johansen <john.johansen@canonical.com>
Acked-by: Andrea Righi <andrea.righi@canonical.com>
[ saf: resolve conflicts ]
Signed-off-by: Seth Forshee <seth.forshee@canonical.com>
3 years agoUBUNTU: SAUCE: LSM: Infrastructure management of the sock security
Casey Schaufler [Wed, 1 Jul 2020 19:59:27 +0000 (12:59 -0700)]
UBUNTU: SAUCE: LSM: Infrastructure management of the sock security

Move management of the sock->sk_security blob out
of the individual security modules and into the security
infrastructure. Instead of allocating the blobs from within
the modules the modules tell the infrastructure how much
space is required, and the space is allocated there.

Acked-by: Paul Moore <paul@paul-moore.com>
Reviewed-by: Kees Cook <keescook@chromium.org>
Reviewed-by: John Johansen <john.johansen@canonical.com>
Acked-by: Stephen Smalley <sds@tycho.nsa.gov>
Signed-off-by: Casey Schaufler <casey@schaufler-ca.com>
Signed-off-by: John Johansen <john.johansen@canonical.com>
Acked-by: Andrea Righi <andrea.righi@canonical.com>
Signed-off-by: Seth Forshee <seth.forshee@canonical.com>
3 years agoUBUNTU: SAUCE: apparmor: LSM stacking: switch from SK_CTX() to aa_sock()
John Johansen [Tue, 6 Oct 2020 21:29:39 +0000 (14:29 -0700)]
UBUNTU: SAUCE: apparmor: LSM stacking: switch from SK_CTX() to aa_sock()

LSM: Infrastructure management of the sock security

changes apparmor to use aa_sock() instead of SK_CTX() but doesn't
update the apparmor unix mediation because that code is not upstream.
So make the change here instead of modifying the LSM patch.

Signed-off-by: John Johansen <john.johansen@canonical.com>
Acked-by: Andrea Righi <andrea.righi@canonical.com>
Signed-off-by: Seth Forshee <seth.forshee@canonical.com>
3 years agoUBUNTU: SAUCE: apparmor: rename aa_sock() to aa_unix_sk()
John Johansen [Tue, 6 Oct 2020 21:01:04 +0000 (14:01 -0700)]
UBUNTU: SAUCE: apparmor: rename aa_sock() to aa_unix_sk()

The LSM stacking patches introduce and use a macro aa_sock
which conflicts with the apparmor unix mediation patches. Rename
aa_sock() in apparmor to avoid a conflict.

Signed-off-by: John Johansen <john.johansen@canonical.com>
Acked-by: Andrea Righi <andrea.righi@canonical.com>
Signed-off-by: Seth Forshee <seth.forshee@canonical.com>
3 years agoUBUNTU: SAUCE: apparmor: disable showing the mode as part of a secid to secctx
John Johansen [Tue, 6 Oct 2020 21:43:16 +0000 (14:43 -0700)]
UBUNTU: SAUCE: apparmor: disable showing the mode as part of a secid to secctx

Displaying the mode as part of the seectx takes up unnecessary memory,
makes it so we can't use refcounted secctx so we need to alloc/free on
every conversion from secid to secctx and introduces a space that
could be potentially mishandled by tooling.

Eg. In an audit record we get

  subj_type=firefix (enforce)

Having the mode reported is not necessary, and might even be confusing
eg. when writing an audit rule to match the above record field you
would use

  -F subj_type=firefox

ie. the mode is not included. AppArmor provides ways to find the mode
without reporting as part of the secctx. So disable this by default
before its use is wide spread and we can't. For now we add a sysctl
to control the behavior as we can't guarentee no one is using this.

Signed-off-by: John Johansen <john.johansen@canonical.com>
Acked-by: Andrea Righi <andrea.righi@canonical.com>
Signed-off-by: Seth Forshee <seth.forshee@canonical.com>
3 years agoUBUNTU: SAUCE: apparmor: drop prefixing abs root labels with '='
John Johansen [Tue, 6 Oct 2020 21:35:10 +0000 (14:35 -0700)]
UBUNTU: SAUCE: apparmor: drop prefixing abs root labels with '='

This prefix was not ever meant to go to the logs, and is just a debug
hint. Unfortunately it is showing up in the logs resulting in a double
'=' eg.

  subj==firefox

which has the potential to break some log parsing tools.

Signed-off-by: John Johansen <john.johansen@canonical.com>
Acked-by: Andrea Righi <andrea.righi@canonical.com>
Signed-off-by: Seth Forshee <seth.forshee@canonical.com>
3 years agoUBUNTU: Add ubuntu-host module
Seth Forshee [Wed, 30 Sep 2020 01:01:09 +0000 (20:01 -0500)]
UBUNTU: Add ubuntu-host module

ubuntu-host is a module for providing data to containers via proc.
Initially it is populated with a single file, esm-token, for
supplying ESM access tokens.

Signed-off-by: Seth Forshee <seth.forshee@canonical.com>
3 years agoUBUNTU: SAUCE: e1000e: Increase polling timeout on MDIC ready bit
Kai-Heng Feng [Tue, 29 Sep 2020 15:07:04 +0000 (23:07 +0800)]
UBUNTU: SAUCE: e1000e: Increase polling timeout on MDIC ready bit

BugLink: https://bugs.launchpad.net/bugs/1897755
We are seeing the following error after S3 resume:
[  704.746874] e1000e 0000:00:1f.6 eno1: Setting page 0x6020
[  704.844232] e1000e 0000:00:1f.6 eno1: MDI Write did not complete
[  704.902817] e1000e 0000:00:1f.6 eno1: Setting page 0x6020
[  704.903075] e1000e 0000:00:1f.6 eno1: reading PHY page 769 (or 0x6020 shifted) reg 0x17
[  704.903281] e1000e 0000:00:1f.6 eno1: Setting page 0x6020
[  704.903486] e1000e 0000:00:1f.6 eno1: writing PHY page 769 (or 0x6020 shifted) reg 0x17
[  704.943155] e1000e 0000:00:1f.6 eno1: MDI Error
...
[  705.108161] e1000e 0000:00:1f.6 eno1: Hardware Error

This patch only papers over the symptom, as we don't really know the
root cause of the issue. The most possible culprit is Intel ME, which
may do its own things that conflict with software.

Intel ethernet devs are aware of this issue, though they think this is
not the right solution. However, instead of papering over the cracks,
they don't have any solution either because they don't support ME under
Linux :)

Full discussion can be found here:
https://lore.kernel.org/lkml/20200923074751.10527-1-kai.heng.feng@canonical.com/

Signed-off-by: Kai-Heng Feng <kai.heng.feng@canonical.com>
Signed-off-by: Seth Forshee <seth.forshee@canonical.com>
3 years agoUBUNTU: SAUCE: PCI/ASPM: Enable LTR for endpoints behind VMD
Kai-Heng Feng [Tue, 22 Sep 2020 10:42:54 +0000 (18:42 +0800)]
UBUNTU: SAUCE: PCI/ASPM: Enable LTR for endpoints behind VMD

BugLink: https://bugs.launchpad.net/bugs/1896598
In addition to ASPM, LTR also needs to be programmed with a reasonable
value to let PCIe link reaches L1.2.

For now, program a hardcoded value that is used under Windows.

While at it, consolidate ASPM and LTR enabling logic to share a same pci
device table.

Signed-off-by: Kai-Heng Feng <kai.heng.feng@canonical.com>
Signed-off-by: Seth Forshee <seth.forshee@canonical.com>
3 years agoUBUNTU: SAUCE: xhci: workaround for S3 issue on AMD SNPS 3.0 xHC
Nehal Bakulchandra Shah [Thu, 3 Sep 2020 06:35:03 +0000 (14:35 +0800)]
UBUNTU: SAUCE: xhci: workaround for S3 issue on AMD SNPS 3.0 xHC

BugLink: https://bugs.launchpad.net/bugs/1893914
On some platform of AMD, S3 fails with HCE and SRE errors.To fix this,
sparse controller enable bit has to be disabled.

Signed-off-by: Nehal Bakulchandra Shah <Nehal-Bakulchandra.shah@amd.com>
Link: https://lkml.org/lkml/2020/8/31/86
Signed-off-by: Aaron Ma <aaron.ma@canonical.com>
Acked-by: Stefan Bader <stefan.bader@canonical.com>
Acked-by: Kleber Sacilotto de Souza <kleber.souza@canonical.com>
Signed-off-by: Seth Forshee <seth.forshee@canonical.com>
3 years agoUBUNTU: SAUCE: PCI: Enable ACS quirk on CML root port
Kai-Heng Feng [Tue, 15 Sep 2020 17:36:55 +0000 (01:36 +0800)]
UBUNTU: SAUCE: PCI: Enable ACS quirk on CML root port

BugLink: https://bugs.launchpad.net/bugs/1895718
Commit "iommu/vt-d: Enable PCI ACS for platform opt in hint" makes
KIOXIA NVMe stops working after S3:
[   50.947816] pcieport 0000:00:1b.0: DPC: containment event, status:0x1f01 source:0x0000
[   50.947817] pcieport 0000:00:1b.0: DPC: unmasked uncorrectable error detected
[   50.947829] pcieport 0000:00:1b.0: PCIe Bus Error: severity=Uncorrected (Non-Fatal), type=Transaction Layer, (Receiver ID)
[   50.947830] pcieport 0000:00:1b.0:   device [8086:06ac] error status/mask=00200000/00010000
[   50.947831] pcieport 0000:00:1b.0:    [21] ACSViol                (First)
[   50.947841] pcieport 0000:00:1b.0: AER: broadcast error_detected message
[   50.947843] nvme nvme0: frozen state error detected, reset controller

Intel thinks CML also needs the ACS quirk, so adding it accordingly

This patch will eventually be replaced by upstream version from Intel.

Signed-off-by: Kai-Heng Feng <kai.heng.feng@canonical.com>
Signed-off-by: Paolo Pisati <paolo.pisati@canonical.com>
3 years agoUBUNTU: SAUCE: PCI/ASPM: Enable ASPM for links under VMD domain
Kai-Heng Feng [Fri, 21 Aug 2020 14:34:41 +0000 (22:34 +0800)]
UBUNTU: SAUCE: PCI/ASPM: Enable ASPM for links under VMD domain

BugLink: https://bugs.launchpad.net/bugs/1889384
New Intel laptops with VMD cannot reach deeper power saving state,
renders very short battery time.

As BIOS may not be able to program the config space for devices under
VMD domain, ASPM needs to be programmed manually by software. This is
also the case under Windows.

The VMD controller itself is a root complex integrated endpoint that
doesn't have ASPM capability, so we can't propagate the ASPM settings to
devices under it. Hence, simply apply ASPM_STATE_ALL to the links under
VMD domain, unsupported states will be cleared out anyway.

Signed-off-by: Kai-Heng Feng <kai.heng.feng@canonical.com>
Acked-by: Stefan Bader <stefan.bader@canonical.com>
Signed-off-by: Seth Forshee <seth.forshee@canonical.com>
3 years agoUBUNTU: SAUCE: remoteproc: qcom: Use div_u64() for 64-bit division
Seth Forshee [Wed, 19 Aug 2020 20:39:23 +0000 (15:39 -0500)]
UBUNTU: SAUCE: remoteproc: qcom: Use div_u64() for 64-bit division

Compiling this module in a 32-bit kernel fails.

 ERROR: modpost: "__aeabi_uldivmod" [drivers/remoteproc/qcom_pil_info.ko] undefined!

Fix this by using div_u64() for the 64-bit division.

Signed-off-by: Seth Forshee <seth.forshee@canonical.com>
3 years agoUBUNTU: hio -- Updates for move of make_request_fn to struct block_device_operations
Seth Forshee [Wed, 19 Aug 2020 16:22:11 +0000 (11:22 -0500)]
UBUNTU: hio -- Updates for move of make_request_fn to struct block_device_operations

Commit c62b37d96b6e ("block: move ->make_request_fn to struct
block_device_operations") from v5.9-rc1 replaces make_request_fn
with a submit_bio method in struct block_device_operations and
removes the request_queue argument. Update the driver accordingly.

Signed-off-by: Seth Forshee <seth.forshee@canonical.com>
3 years agoUBUNTU: hio -- Update blk_queue_split() calls for changes in 5.9-rc1
Seth Forshee [Wed, 19 Aug 2020 16:12:36 +0000 (11:12 -0500)]
UBUNTU: hio -- Update blk_queue_split() calls for changes in 5.9-rc1

Signed-off-by: Seth Forshee <seth.forshee@canonical.com>
3 years agoUBUNTU: SAUCE: i915: Fix build error due to missing struct definition
Seth Forshee [Wed, 19 Aug 2020 16:04:30 +0000 (11:04 -0500)]
UBUNTU: SAUCE: i915: Fix build error due to missing struct definition

FTBFS in v5.9-rc1:

 In file included from /tmp/kernel-sforshee-f5108e59edd8-jyEs/build/drivers/gpu/drm/i915/i915_active.h:12,
                  from /tmp/kernel-sforshee-f5108e59edd8-jyEs/build/drivers/gpu/drm/i915/gt/intel_context_param.c:6:
 /tmp/kernel-sforshee-f5108e59edd8-jyEs/build/drivers/gpu/drm/i915/i915_active_types.h:35:22: error: field 'rwsem' has incomplete type
    35 |  struct rw_semaphore rwsem;
       |                      ^~~~~

Fix by adding an include to provide the definition.

Signed-off-by: Seth Forshee <seth.forshee@canonical.com>
3 years agoUBUNTU: SAUCE: (lockdown) powerpc: lock down kernel in secure boot mode
Daniel Axtens [Thu, 2 Apr 2020 05:16:32 +0000 (16:16 +1100)]
UBUNTU: SAUCE: (lockdown) powerpc: lock down kernel in secure boot mode

BugLink: https://bugs.launchpad.net/bugs/1855668
PowerNV has recently gained Secure Boot support. If it's enabled through
the firmware and bootloader stack, then lock down the kernel.

Signed-off-by: Daniel Axtens <dja@axtens.net>
Signed-off-by: Seth Forshee <seth.forshee@canonical.com>
3 years agoUBUNTU: SAUCE: (lockdown) security: lockdown: Make CONFIG_LOCK_DOWN_IN_EFI_SECURE_BOO...
Seth Forshee [Thu, 10 Oct 2019 16:19:32 +0000 (11:19 -0500)]
UBUNTU: SAUCE: (lockdown) security: lockdown: Make CONFIG_LOCK_DOWN_IN_EFI_SECURE_BOOT more generic

s390 supports secure boot which is not based on EFI. Change the
config option to be more generic, and allow it to be enabled on
s390.

Signed-off-by: Seth Forshee <seth.forshee@canonical.com>
Signed-off-by: Paolo Pisati <paolo.pisati@canonical.com>
3 years agoUBUNTU: SAUCE: (lockdown) arm64: Allow locking down the kernel under EFI secure boot
Seth Forshee [Thu, 10 Oct 2019 15:57:25 +0000 (10:57 -0500)]
UBUNTU: SAUCE: (lockdown) arm64: Allow locking down the kernel under EFI secure boot

Add support to arm64 for the CONFIG_LOCK_DOWN_IN_EFI_SECURE_BOOT
option. When enabled the lockdown LSM will be enabled with
maximum confidentiality when booted under EFI secure boot.

Based on an earlier patch by Linn Crosetto.

Signed-off-by: Seth Forshee <seth.forshee@canonical.com>
[v2: ported to 5.7-rc1 and adapted to the new fdt parsing mechanism]
Signed-off-by: Paolo Pisati <paolo.pisati@canonical.com>
3 years agoUBUNTU: SAUCE: (lockdown) KEYS: Make use of platform keyring for module signature...
Robert Holmes [Tue, 23 Apr 2019 07:39:29 +0000 (07:39 +0000)]
UBUNTU: SAUCE: (lockdown) KEYS: Make use of platform keyring for module signature verify

This patch completes commit 278311e417be ("kexec, KEYS: Make use of
platform keyring for signature verify") which, while adding the
platform keyring for bzImage verification, neglected to also add
this keyring for module verification.

As such, kernel modules signed with keys from the MokList variable
were not successfully verified.

Signed-off-by: Robert Holmes <robeholmes@gmail.com>
Signed-off-by: Jeremy Cline <jcline@redhat.com>
(cherry picked from commit 0d32c182cdbd50dd2fc8d2063d00705d0052387c
 git://git.kernel.org/pub/scm/linux/kernel/git/jwboyer/fedora.git)
Signed-off-by: Seth Forshee <seth.forshee@canonical.com>
3 years agoUBUNTU: SAUCE: (lockdown) s390: Lock down the kernel when the IPL secure flag is set
Jeremy Cline [Wed, 30 Oct 2019 14:37:49 +0000 (14:37 +0000)]
UBUNTU: SAUCE: (lockdown) s390: Lock down the kernel when the IPL secure flag is set

Automatically lock down the kernel to LOCKDOWN_INTEGRITY_MAX if
the IPL secure flag is set.

Suggested-by: Philipp Rudo <prudo@redhat.com>
Signed-off-by: Jeremy Cline <jcline@redhat.com>
(cherry picked from commit 38ec0096d7acf1af5a90d0cefeeecb16ffbb570d
 git://git.kernel.org/pub/scm/linux/kernel/git/jwboyer/fedora.git)
Signed-off-by: Seth Forshee <seth.forshee@canonical.com>
3 years agoUBUNTU: SAUCE: (lockdown) efi: Lock down the kernel if booted in secure boot mode
David Howells [Mon, 30 Sep 2019 21:28:16 +0000 (21:28 +0000)]
UBUNTU: SAUCE: (lockdown) efi: Lock down the kernel if booted in secure boot mode

UEFI Secure Boot provides a mechanism for ensuring that the firmware
will only load signed bootloaders and kernels.  Certain use cases may
also require that all kernel modules also be signed.  Add a
configuration option that to lock down the kernel - which includes
requiring validly signed modules - if the kernel is secure-booted.

Signed-off-by: David Howells <dhowells@redhat.com>
Signed-off-by: Jeremy Cline <jcline@redhat.com>
(cherry picked from commit 2e3e75ce5dfddec32741d4f75d007fbc61aedf39
 git://git.kernel.org/pub/scm/linux/kernel/git/jwboyer/fedora.git)
Signed-off-by: Seth Forshee <seth.forshee@canonical.com>
3 years agoUBUNTU: SAUCE: (lockdown) efi: Add an EFI_SECURE_BOOT flag to indicate secure boot...
David Howells [Tue, 27 Feb 2018 10:04:55 +0000 (10:04 +0000)]
UBUNTU: SAUCE: (lockdown) efi: Add an EFI_SECURE_BOOT flag to indicate secure boot mode

UEFI machines can be booted in Secure Boot mode.  Add an EFI_SECURE_BOOT
flag that can be passed to efi_enabled() to find out whether secure boot is
enabled.

Move the switch-statement in x86's setup_arch() that inteprets the
secure_boot boot parameter to generic code and set the bit there.

Suggested-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Signed-off-by: David Howells <dhowells@redhat.com>
Reviewed-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
cc: linux-efi@vger.kernel.org
[Rebased for context; efi_is_table_address was moved to arch/x86]
Signed-off-by: Jeremy Cline <jcline@redhat.com>
(cherry picked from commit a080e08b637d48dc9bdf4367447e47948f6d98b8
 git://git.kernel.org/pub/scm/linux/kernel/git/jwboyer/fedora.git)
Signed-off-by: Seth Forshee <seth.forshee@canonical.com>
3 years agoUBUNTU: SAUCE: (lockdown) security: lockdown: expose a hook to lock the kernel down
Jeremy Cline [Mon, 30 Sep 2019 21:22:47 +0000 (21:22 +0000)]
UBUNTU: SAUCE: (lockdown) security: lockdown: expose a hook to lock the kernel down

In order to automatically lock down kernels running on UEFI machines
booted in Secure Boot mode, expose the lock_kernel_down() hook.

Signed-off-by: Jeremy Cline <jcline@redhat.com>
(cherry picked from commit 3af5459da853e8c49416d644ea219f334d25563c
 git://git.kernel.org/pub/scm/linux/kernel/git/jwboyer/fedora.git)
Signed-off-by: Seth Forshee <seth.forshee@canonical.com>
3 years agoUBUNTU: SAUCE: (lockdown) Make get_cert_list() use efi_status_to_str() to print error...
Peter Jones [Mon, 2 Oct 2017 22:18:30 +0000 (18:18 -0400)]
UBUNTU: SAUCE: (lockdown) Make get_cert_list() use efi_status_to_str() to print error messages.

Signed-off-by: Peter Jones <pjones@redhat.com>
Signed-off-by: Jeremy Cline <jcline@redhat.com>
(cherry picked from commit 63ca37a77ff29e3951a77a9a1d30f9fbb714ed79
 git://git.kernel.org/pub/scm/linux/kernel/git/jwboyer/fedora.git)
Signed-off-by: Seth Forshee <seth.forshee@canonical.com>
3 years agoUBUNTU: SAUCE: (lockdown) Add efi_status_to_str() and rework efi_status_to_err().
Peter Jones [Mon, 2 Oct 2017 22:22:13 +0000 (18:22 -0400)]
UBUNTU: SAUCE: (lockdown) Add efi_status_to_str() and rework efi_status_to_err().

This adds efi_status_to_str() for use when printing efi_status_t
messages, and reworks efi_status_to_err() so that the two use a common
list of errors.

Signed-off-by: Peter Jones <pjones@redhat.com>
(cherry picked from commit 910a6db8a4b0f38f38a4aa61a0fc473182795151
 git://git.kernel.org/pub/scm/linux/kernel/git/jwboyer/fedora.git)
Signed-off-by: Seth Forshee <seth.forshee@canonical.com>
3 years agoUBUNTU: hio -- Update to use bio_{start,end}_io_acct with 5.8+
Seth Forshee [Tue, 11 Aug 2020 19:52:12 +0000 (14:52 -0500)]
UBUNTU: hio -- Update to use bio_{start,end}_io_acct with 5.8+

Since e722fff238bb "block: remove generic_{start,end}_io_acct"
the generic io accounting interaces are no longer available.
Switch to using the replacements.

Signed-off-by: Seth Forshee <seth.forshee@canonical.com>
3 years agoUBUNTU: SAUCE: Documentation: import error c_funcptr_sig_re, c_sig_re (sphinx-doc...
Markus Heiser [Sun, 26 Apr 2020 11:54:00 +0000 (13:54 +0200)]
UBUNTU: SAUCE: Documentation: import error c_funcptr_sig_re, c_sig_re (sphinx-doc/sphinx@0f49e30c)

Extension error:
   Could not import extension linuxdoc.cdomain  .. \
   (exception: cannot import name 'c_funcptr_sig_re' from ..

Issue: `sphinx-doc/sphinx#7421`_

.. _0f49e30c:
   https://github.com/sphinx-doc/sphinx/commit/0f49e30c51b5cc5055cda5b4b294c2dd9d1df573#r38750737

.. _sphinx-doc/sphinx#7421:
   https://github.com/sphinx-doc/sphinx/issues/7421

Signed-off-by: Markus Heiser <markus.heiser@darmarit.de>
Link: https://github.com/return42/linuxdoc/commit/48f09de2aff80169b7b9be5b0f2431ad8954e5cc
Signed-off-by: Seth Forshee <seth.forshee@canonical.com>
3 years agoUBUNTU: SAUCE: apply a workaround to re-enable CONFIG_CRYPTO_AEGIS128_SIMD
Andrea Righi [Thu, 30 Jul 2020 15:31:37 +0000 (17:31 +0200)]
UBUNTU: SAUCE: apply a workaround to re-enable CONFIG_CRYPTO_AEGIS128_SIMD

After the update to gcc 10 we started to experience the following build
errors on ARM:

  crypto/aegis128-neon-inner.c: In function 'crypto_aegis128_init_neon':
  crypto/aegis128-neon-inner.c:151:3: error: incompatible types when initializing type 'unsigned char' using type 'uint8x16_t'
    151 |   k ^ vld1q_u8(const0),
|   ^
  crypto/aegis128-neon-inner.c:152:3: error: incompatible types when initializing type 'unsigned char' using type 'uint8x16_t'
    152 |   k ^ vld1q_u8(const1),
|   ^

This seems to be a gcc bug:
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=96377

The workaround (suggested in the bug report) is to enforce a cast to
uint8x16_t.

Apply the workaround so that we can re-enable the driver disabled by
7c950e057db6 ("UBUNTU: [Config] disable CONFIG_CRYPTO_AEGIS128_SIMD").

Signed-off-by: Andrea Righi <andrea.righi@canonical.com>
3 years agoUBUNTU: SAUCE: Revert "radix-tree: Use local_lock for protection"
Seth Forshee [Mon, 20 Jul 2020 15:04:14 +0000 (10:04 -0500)]
UBUNTU: SAUCE: Revert "radix-tree: Use local_lock for protection"

This reverts commit cfa6705d89b6562f79c40c249f8d94073c4276e4. It
adds a gpl-only export which is leaking into nvidia module
builds. This is being discussed upstream, but revert the change
in the mean time. This is harmless, as the change is really for
RT builds and was not intended to have any functional change
outside of that context.

Signed-off-by: Seth Forshee <seth.forshee@canonical.com>
3 years agoUBUNTU: SAUCE: Revert "netprio_cgroup: Fix unlimited memory leak of v2 cgroups"
Thadeu Lima de Souza Cascardo [Thu, 9 Jul 2020 19:54:01 +0000 (16:54 -0300)]
UBUNTU: SAUCE: Revert "netprio_cgroup: Fix unlimited memory leak of v2 cgroups"

BugLink: https://bugs.launchpad.net/bugs/1886668
This reverts commit 5eebba2159d707ae9533a52839e1ba71754c4426, which is
commit 090e28b229af92dc5b40786ca673999d59e73056 upstream.

There is a crash related to a possible use-after-free of cgroups when
cgroup BPF is user with INET_INGRESS or INET_EGRESS.

[ 696.396993] RIP: 0010:__cgroup_bpf_run_filter_skb+0xbb/0x1e0
[ 696.397005] RSP: 0018:ffff893fdcb83a70 EFLAGS: 00010292
[ 696.397015] RAX: 6d69546e6f697469 RBX: 0000000000000000 RCX: 0000000000000014
[ 696.397028] RDX: 0000000000000000 RSI: ffff893fd0360000 RDI: ffff893fb5154800
[ 696.397041] RBP: ffff893fdcb83ad0 R08: 0000000000000001 R09: 0000000000000000
[ 696.397058] R10: 0000000000000000 R11: 0000000000000003 R12: 0000000000000014
[ 696.397075] R13: ffff893fb5154800 R14: 0000000000000020 R15: ffff893fc6ba4d00
[ 696.397091] FS: 0000000000000000(0000) GS:ffff893fdcb80000(0000) knlGS:0000000000000000
[ 696.397107] CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033
[ 696.397119] CR2: 000000c0001b4000 CR3: 00000006dce0a004 CR4: 00000000003606e0
[ 696.397135] DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000
[ 696.397152] DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400
[ 696.397169] Call Trace:
[ 696.397175] <IRQ>
[ 696.397183] sk_filter_trim_cap+0xd0/0x1b0
[ 696.397191] tcp_v4_rcv+0x8b7/0xa80
[ 696.397199] ip_local_deliver_finish+0x66/0x210
[ 696.397208] ip_local_deliver+0x7e/0xe0
[ 696.397215] ? ip_rcv_finish+0x430/0x430
[ 696.397223] ip_rcv_finish+0x129/0x430
[ 696.397230] ip_rcv+0x296/0x360
[ 696.397238] ? inet_del_offload+0x40/0x40
[ 696.397249] __netif_receive_skb_core+0x432/0xb80
[ 696.397261] ? skb_send_sock+0x50/0x50
[ 696.397271] ? tcp4_gro_receive+0x137/0x1a0
[ 696.397280] __netif_receive_skb+0x18/0x60
[ 696.397290] ? __netif_receive_skb+0x18/0x60
[ 696.397300] netif_receive_skb_internal+0x45/0xe0
[ 696.397309] napi_gro_receive+0xc5/0xf0
[ 696.397317] xennet_poll+0x9ca/0xbc0
[ 696.397325] net_rx_action+0x140/0x3a0
[ 696.397334] __do_softirq+0xe4/0x2d4
[ 696.397344] irq_exit+0xc5/0xd0
[ 696.397352] xen_evtchn_do_upcall+0x30/0x50
[ 696.397361] xen_hvm_callback_vector+0x90/0xa0
[ 696.397371] </IRQ>
[ 696.397378] RIP: 0010:native_safe_halt+0x12/0x20
[ 696.397390] RSP: 0018:ffff94c4862cbe80 EFLAGS: 00000246 ORIG_RAX: ffffffffffffff0c
[ 696.397405] RAX: ffffffff8efc1800 RBX: 0000000000000006 RCX: 0000000000000000
[ 696.397419] RDX: 0000000000000000 RSI: 0000000000000000 RDI: 0000000000000000
[ 696.397435] RBP: ffff94c4862cbe80 R08: 0000000000000002 R09: 0000000000000001
[ 696.397449] R10: 0000000000100000 R11: 0000000000000397 R12: 0000000000000006
[ 696.397462] R13: 0000000000000000 R14: 0000000000000000 R15: 0000000000000000
[ 696.397479] ? __sched_text_end+0x1/0x1
[ 696.397489] default_idle+0x20/0x100
[ 696.397499] arch_cpu_idle+0x15/0x20
[ 696.397507] default_idle_call+0x23/0x30
[ 696.397515] do_idle+0x172/0x1f0
[ 696.397522] cpu_startup_entry+0x73/0x80
[ 696.397530] start_secondary+0x1ab/0x200
[ 696.397538] secondary_startup_64+0xa5/0xb0
[ 696.397545] Code: 89 5d b0 49 29 cc 45 01 a7 80 00 00 00 44 89 e1 48 29 c8 48 89 4d a8 49 89 87 d8 00 00 00 89 d2 48 8d 84 d6 38 03 00 00 48 8b 00 <4c> 8b 70 10 4c 8d 68 10 4d 85 f6 0f 84 f6 00 00 00 49 8d 47 30
[ 696.397584] RIP: __cgroup_bpf_run_filter_skb+0xbb/0x1e0 RSP: ffff893fdcb83a70
[ 696.397607] ---[ end trace ec5c84424d511a6f ]---
[ 696.397616] Kernel panic - not syncing: Fatal exception in interrupt
[ 696.397876] Kernel Offset: 0xd600000 from 0xffffffff81000000 (relocation range: 0xffffffff80000000-0xffffffffbfffffff)

This is caused by net_cls and net_prio cgroups disabling cgroup BPF and
causing it to stop refcounting when allocating new sockets. Releasing those
sockets will cause the refcount to go negative, leading to the potential
use-after-free.

Though this revert won't prevent the issue from happening as it could still
theoretically be caused by setting net_cls.classid or net_prio.ifpriomap,
this will prevent it from happening on default system configurations. A
combination of systemd use of cgroup BPF and extensive cgroup use including
net_prio will cause this. Reports usually involve using lxd, libvirt,
docker or kubernetes and some systemd service with IPAddressDeny or
IPAddressAllow.

And though this patch has been introduced to avoid some potential memory
leaks, the cure is worse than the disease. We will need to revisit both
issues later on and reapply this patch when we have a real fix for the
crash.

Signed-off-by: Thadeu Lima de Souza Cascardo <cascardo@canonical.com>
Acked-by: Marcelo Henrique Cerri <marcelo.cerri@canonical.com>
Acked-by: Ian May <ian.may@canonical.com>
Signed-off-by: Seth Forshee <seth.forshee@canonical.com>
3 years agoUBUNTU: SAUCE: shiftfs: prevent ESTALE for LOOKUP_JUMP lookups
Christian Brauner [Tue, 23 Jun 2020 17:46:16 +0000 (19:46 +0200)]
UBUNTU: SAUCE: shiftfs: prevent ESTALE for LOOKUP_JUMP lookups

BugLink: https://bugs.launchpad.net/bugs/1872757
Users reported that creating temporary files shiftfs reports ESTALE.
This can be reproduced via:

import tempfile
import os

def test():
    with tempfile.TemporaryFile() as fd:
        fd.write("data".encode('utf-8'))
        # re-open the file to get a read-only file descriptor
        return open(f"/proc/self/fd/{fd.fileno()}", "r")

def main():
   fd = test()
   fd.close()

if __name__ == "__main__":
    main()

a similar issue was reported here:
https://github.com/systemd/systemd/issues/14861

Our revalidate methods were very opinionated about whether or not a
lower dentry was valid especially when it became unlinked we simply
invalidated the lower dentry which caused above bug to surface. This has
led to bugs where a ESTALE was returned for e.g.  temporary files that
were created and directly re-opened afterwards through
/proc/<pid>/fd/<nr-of-deleted-file>. When a file is re-opened through
/proc/<pid>/fd/<nr> LOOKUP_JUMP is set and the vfs will revalidate via
d_weak_revalidate(). Since the file has been unhashed or even already
gone negative we'd fail the open when we should've succeeded.

Reported-by: Christian Kellner <ckellner@redhat.com>
Reported-by: Evgeny Vereshchagin <evvers@ya.ru>
Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
Cc: Seth Forshee <seth.forshee@canonical.com>
Link: https://github.com/systemd/systemd/issues/14861
Signed-off-by: Seth Forshee <seth.forshee@canonical.com>
3 years agoUBUNTU: SAUCE: nbd_genl_status: null check for nla_nest_start
Navid Emamdoost [Tue, 16 Jun 2020 11:08:49 +0000 (08:08 -0300)]
UBUNTU: SAUCE: nbd_genl_status: null check for nla_nest_start

CVE-2019-16089

nla_nest_start may fail and return NULL. The check is inserted, and
errno is selected based on other call sites within the same source code.
Update: removed extra new line.
v3 Update: added release reply, thanks to Michal Kubecek for pointing
out.

Signed-off-by: Navid Emamdoost <navid.emamdoost@gmail.com>
Signed-off-by: Thadeu Lima de Souza Cascardo <cascardo@canonical.com>
Reviewed-by: Michal Kubecek <mkubecek@suse.cz>
Acked-by: Colin Ian King <colin.king@canonical.com>
Acked-by: Marcelo Henrique Cerri <marcelo.cerri@canonical.com
Signed-off-by: Seth Forshee <seth.forshee@canonical.com>
3 years agoUBUNTU: SAUCE: security,perf: Allow further restriction of perf_event_open
Ben Hutchings [Tue, 16 Aug 2016 16:27:00 +0000 (10:27 -0600)]
UBUNTU: SAUCE: security,perf: Allow further restriction of perf_event_open

https://lkml.org/lkml/2016/1/11/587

The GRKERNSEC_PERF_HARDEN feature extracted from grsecurity.  Adds the
option to disable perf_event_open() entirely for unprivileged users.
This standalone version doesn't include making the variable read-only
(or renaming it).

When kernel.perf_event_open is set to 3 (or greater), disallow all
access to performance events by users without CAP_SYS_ADMIN.
Add a Kconfig symbol CONFIG_SECURITY_PERF_EVENTS_RESTRICT that
makes this value the default.

This is based on a similar feature in grsecurity
(CONFIG_GRKERNSEC_PERF_HARDEN).  This version doesn't include making
the variable read-only.  It also allows enabling further restriction
at run-time regardless of whether the default is changed.

Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
Signed-off-by: Tim Gardner <tim.gardner@canonical.com>
[ saf: resolve conflicts with v5.8-rc1 ]
Signed-off-by: Seth Forshee <seth.forshee@canonical.com>
3 years agoUBUNTU: SAUCE: shiftfs -- Fix build errors from missing fiemap definitions
Seth Forshee [Mon, 15 Jun 2020 20:16:11 +0000 (15:16 -0500)]
UBUNTU: SAUCE: shiftfs -- Fix build errors from missing fiemap definitions

shiftfs FTBFS with 5.8-rc1:

 /tmp/kernel-sforshee-6727637082e4-45IQ/build/fs/shiftfs.c: In function 'shiftfs_fiemap':
 /tmp/kernel-sforshee-6727637082e4-45IQ/build/fs/shiftfs.c:731:13: error: dereferencing pointer to incomplete type 'struct fiemap_extent_info'
 /tmp/kernel-sforshee-6727637082e4-45IQ/build/fs/shiftfs.c:731:26: error: 'FIEMAP_FLAG_SYNC' undeclared (first use in this function); did you mean 'FS_XFLAG_SYNC'?

It seems that shiftfs was getting linux/fiemap.h included
indirectly before. Include it directly.

Signed-off-by: Seth Forshee <seth.forshee@canonical.com>
3 years agoUBUNTU: SAUCE: shiftfs: let userns root destroy subvolumes from other users
Christian Brauner [Wed, 20 May 2020 11:44:27 +0000 (13:44 +0200)]
UBUNTU: SAUCE: shiftfs: let userns root destroy subvolumes from other users

BugLink: https://bugs.launchpad.net/bugs/1879688
Stéphane reported a bug found during NorthSec that makes heavy use of
shiftfs. When a subvolume or snapshot is created as userns root in the
container and then chowned to another user a delete as the root user
will fail. The reason for this is that we drop all capabilities as a
safety measure before calling btrfs ioctls. The only workable fix I
could think of is to retain the CAP_DAC_OVERRIDE capability for the
BTRFS_IOC_SNAP_DESTROY ioctl. All other solutions would be way more
invasive.

Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
Cc: Seth Forshee <seth.forshee@canonical.com>
Acked-by: Kleber Sacilotto de Souza <kleber.souza@canonical.com>
Signed-off-by: Seth Forshee <seth.forshee@canonical.com>
3 years agoUBUNTU: SAUCE: tools: hv: Update shebang to use python3 instead of python
Seth Forshee [Wed, 8 Jan 2020 14:45:12 +0000 (08:45 -0600)]
UBUNTU: SAUCE: tools: hv: Update shebang to use python3 instead of python

Focal is removing the unversioned python symlink. Since python2
is unsupported in focal, update the shebang to use python3.

Signed-off-by: Seth Forshee <seth.forshee@canonical.com>
3 years agoUBUNTU: SAUCE: selftests/net -- disable timeout
Seth Forshee [Tue, 3 Mar 2020 17:09:31 +0000 (11:09 -0600)]
UBUNTU: SAUCE: selftests/net -- disable timeout

Some of our net selftests are timing out in autopkgtest. These
tests pass when run in a different (presumably faster)
environment. It appears that we can't disable the timeout for
individual test cases, so disable the timeout for the net
selftests globally.

Signed-off-by: Seth Forshee <seth.forshee@canonical.com>
3 years agoUBUNTU: SAUCE: selftests/net -- disable l2tp.sh test
Seth Forshee [Tue, 3 Mar 2020 17:23:25 +0000 (11:23 -0600)]
UBUNTU: SAUCE: selftests/net -- disable l2tp.sh test

Our autotest infrastructure tries to disable the test by making
it not executable, but the kselftest runner regards this as an
error. Remove the test from the net selftest makefile to avoid
this.

Signed-off-by: Seth Forshee <seth.forshee@canonical.com>
3 years agoUBUNTU: SAUCE: s390: kernel message catalog
Martin Schwidefsky [Tue, 17 Jan 2017 14:44:05 +0000 (15:44 +0100)]
UBUNTU: SAUCE: s390: kernel message catalog

BugLink: http://bugs.launchpad.net/bugs/1628889
Add support for automatic message tags to the printk macro
families dev_xyz and pr_xyz. The message tag consists of a
component name and a 24 bit hash of the message text. For
each message that is documented in the included kernel message
catalog a man page can be created with a script (which is
included in the patch). The generated man pages contain
explanatory text that is intended to help understand the
messages.

Note that only s390 specific messages are prepared
appropriately and included in the generated message catalog.

This patch is optional as it is very unlikely to be accepted
in upstream kernel, but is recommended for all distributions
which are built based on the 'Development stream'

Signed-off-by: Martin Schwidefsky <schwidefsky@de.ibm.com>
Signed-off-by: Tim Gardner <tim.gardner@canonical.com>
[ saf: Adjust context, fixes for errors caused by 663336ee2628
  "device: Add #define dev_fmt similar to #define pr_fmt" ]
[ saf: Adjust context for v5.7-rc, update for move of device
  print definitions to dev_printk.h ]
[ saf: Fix yet more conflicts, this time with pr_* macro changes
  in v5.8-rc1 ]
Signed-off-by: Seth Forshee <seth.forshee@canonical.com>
3 years agoUBUNTU: SAUCE: overlayfs: ensure mounter privileges when reading directories
Andy Whitcroft [Fri, 19 Oct 2018 16:44:53 +0000 (16:44 +0000)]
UBUNTU: SAUCE: overlayfs: ensure mounter privileges when reading directories

BugLink: https://launchpad.net/bugs/1793458
When reading directory contents ensure the mounter has permissions for
the operation over the constituent parts (lower and upper). Where we are
in a namespace this ensures that the mounter (root in that namespace)
has permissions over the files and directories, preventing exposure of
protected files and directory contents.

CVE-2018-6559

Signed-off-by: Andy Whitcroft <apw@canonical.com>
[tyhicks: make use of new upstream check in ovl_permission() for copy-ups]
[tyhicks: make use of creator (mounter) creds hanging off the super block]
Signed-off-by: Tyler Hicks <tyhicks@canonical.com>
Signed-off-by: Seth Forshee <seth.forshee@canonical.com>