Commit Graph

272029 Commits

Author SHA1 Message Date
nros
fe9bbf72d9 Fix manpage due to updated aligned_alloc behavior
Since aligned_alloc does not demand that size is to be multiple of alignment
anymore, don't make that claim in the man page.
2019-12-06 16:19:32 +00:00
tkusumi
592bc73589 dm: Don't ignore dm_target_alloc() argument
dm_target_alloc() is supposed to be copying the name argument to its ->name.
taken-from: DragonFlyBSD
2019-12-06 16:11:59 +00:00
riastradh
c91905c4be Save the entropy seed daily in /etc/security. 2019-12-06 14:43:29 +00:00
riastradh
5af49f98fe Teach `rndctl -L' to update the seed file, not just delete it.
The seed file is updated by entering the old seed into the system and
then hashing the old seed together with data from /dev/urandom, and
writing it atomically with write-to-temporary/rename-to-permanent.

This way, interruption by crash or power loss does not obliterate
your persistent entropy (unless it causes file system corruption).
2019-12-06 14:43:18 +00:00
nonaka
2c4e9c99d2 Clear the allocated memory in hyperv_dma_alloc(). 2019-12-06 12:46:06 +00:00
nonaka
391c7a7362 Added RNDIS RSS and TCP offload related definitions. 2019-12-06 12:41:17 +00:00
nonaka
a82b0f407d Added NDIS ver.6.20 definition. 2019-12-06 12:39:51 +00:00
skrll
61814306da Simplify userret function signature. From ad@ 2019-12-06 08:40:33 +00:00
maxv
48d18df02a Fix a bunch of unimportant "Local variable hides global variable" warnings
from the LGTM bot.
2019-12-06 08:35:21 +00:00
maxv
be264b1266 Minor changes, reported by the LGTM bot. 2019-12-06 07:27:06 +00:00
maxv
8d129e6ebf localify 2019-12-06 07:12:38 +00:00
mrg
9a26e7c0b2 revert this change from early this year. it appears the
changes macallan@ commited to fix FIRMWORKSBUGS issues
in openfirmware() have fixed the hangs seen on PegasosII.

hooray!

---
Log Message:
workaround a problem with the pegasos firmware interface:
attempting to use /dev/openfirm on this machine hangs hard.

this isn't a new problem, and i've been meaning to try to
figure it out for years, but it's become a problem since
the xf86-video-radeon driver gained code to look for the
macppc model using this interface.

this is why xorg-server 1.18 and 1.20 hang recently on the
pegasosII.

this change is fairly ugly but i couldn't think of a less
ugly method to avoid /dev/openfirm working just on this
one platform.  introduce new __OPENFIRMIO_OPEN_CHECK_BROKEN
macro and associated __openfirmio_open_check_broken(), and
use them in the new openfirmopen() to fail opens.

include proplib.h in macppc and ofppc autoconf.h since they
use it.
---
2019-12-06 06:38:39 +00:00
mrg
e563647e37 remove some XXX comments. one isn't relevant, and the other two
have been incorrect for a long while now.
2019-12-06 05:53:20 +00:00
riastradh
b9c5f62033 Restore historical $Hdr$ tag after git cvsexportcommit nixed it. 2019-12-06 04:15:38 +00:00
riastradh
a5e3c2304e Fix reference count leak in cons(4).
Don't forget to vrele after you're done, folks!

XXX pullup-9
XXX pullup-8
XXX pullup-7
XXX pullup-6... 5... 4 might not have had this bug!
2019-12-06 03:45:33 +00:00
mrg
d1b98547c9 more updates for the vnode and mount list iterator changes
that happened a while back.  also, port to 64 bit properly.
now these all appear to work again.
2019-12-06 02:37:53 +00:00
kamil
1b325ed182 Log PID.LWP in t_ptrace_wait* tests for enabled debug
This is useful for multithreaded test scenarios.
2019-12-06 01:09:50 +00:00
mrg
76df07a4cf it's mountlist not mount_list. now 'mountdump' works again. 2019-12-06 01:01:02 +00:00
sevan
eb64249784 Enable pciverbose option to make use of the pcidevs database by default.
ok ad, mrg
2019-12-05 22:05:05 +00:00
sevan
cb3f9ff633 Undo loading pciverbose module by default.
See item 14 in src/doc/TODO.modules.
2019-12-05 22:02:29 +00:00
ad
6ceaa69c54 Need to call userret() from cpu_ast(). 2019-12-05 20:55:24 +00:00
maya
ba059cab86 Use the original linux function rather than my wrong translation.
...Include the header to have it.

Thanks Riastradh!
2019-12-05 20:25:54 +00:00
maya
5ea7e13642 Add what appears to be the fixes to CVE-2019-0154, CVE-2019-0155.
This commit requires review, but I'd also like it to be tested by others
while it is being reviewed.

CVE-2019-0155:
It was discovered that the Intel i915 graphics chipsets allowed userspace
to modify page table entries via writes to MMIO from the Blitter Command
Streamer and expose kernel memory information. A local attacker could use
this to expose sensitive information or possibly elevate privileges.

CVE-2019-0154:
It was discovered that the Intel i915 graphics chipsets could cause
a system hang when userspace performed a read from GT memory mapped
input output (MMIO) when the product is in certain low power states.
A local attacker could use this to cause a denial of service.

From upstream commits to linux-4.4.y:

-------------------
From 6d0cfddc7afc715835f0e17827106f832b14dd2a Mon Sep 17 00:00:00 2001
From: Jon Bloomfield <jon.bloomfield@intel.com>
Date: Thu, 12 Jul 2018 19:53:10 +0100
Subject: [PATCH] drm/i915/gtt: Add read only pages to gen8_pte_encode

We can set a bit inside the ppGTT PTE to indicate a page is read-only;
writes from the GPU will be discarded. We can use this to protect pages
and in particular support read-only userptr mappings (necessary for
importing PROT_READ vma).
-------------------
From 774b68aa2105c70b40c3b1777feb7ab500d716dd Mon Sep 17 00:00:00 2001
From: Jon Bloomfield <jon.bloomfield@intel.com>
Date: Mon, 6 Aug 2018 14:10:48 -0700
Subject: [PATCH] drm/i915/gtt: Read-only pages for insert_entries on bdw+

Hook up the flags to allow read-only ppGTT mappings for gen8+

v2: Include a selftest to check that writes to a readonly PTE are
dropped
v3: Don't duplicate cpu_check() as we can just reuse it, and even worse
don't wholesale copy the theory-of-operation comment from igt_ctx_exec
without changing it to explain the intention behind the new test!
v4: Joonas really likes magic mystery values
-------------------
From 3fd1c2e65c60c1c513155e1d1d74138b141aa8a3 Mon Sep 17 00:00:00 2001
From: Chris Wilson <chris@chris-wilson.co.uk>
Date: Thu, 12 Jul 2018 19:53:12 +0100
Subject: [PATCH] drm/i915/gtt: Disable read-only support under GVT

GVT is not propagating the PTE bits, and is always setting the
read-write bit, thus breaking read-only support.
-------------------
From e5e3c0154c19f2d8213e0af88b7a10d9de7fbafd Mon Sep 17 00:00:00 2001
From: Jon Bloomfield <jon.bloomfield@intel.com>
Date: Fri, 20 Apr 2018 14:26:01 -0700
Subject: [PATCH] drm/i915: Rename gen7 cmdparser tables

We're about to introduce some new tables for later gens, and the
current naming for the gen7 tables will no longer make sense.

v2: rebase
-------------------
From 3122671a5df3ee13f5cf22b7bdacf422b7b4319a Mon Sep 17 00:00:00 2001
From: Jon Bloomfield <jon.bloomfield@intel.com>
Date: Fri, 8 Jun 2018 08:53:46 -0700
Subject: [PATCH] drm/i915: Disable Secure Batches for gen6+

Retroactively stop reporting support for secure batches
through the api for gen6+ so that older binaries trigger
the fallback path instead.

Older binaries use secure batches pre gen6 to access resources
that are not available to normal usermode processes. However,
all known userspace explicitly checks for HAS_SECURE_BATCHES
before relying on the secure batch feature.

Since there are no known binaries relying on this for newer gens
we can kill secure batches from gen6, via I915_PARAM_HAS_SECURE_BATCHES.

v2: rebase (Mika)
v3: rebase (Mika)
-------------------
From 544fd7d9d4cfe32357beab2f1dc543637d42e69f Mon Sep 17 00:00:00 2001
From: Jon Bloomfield <jon.bloomfield@intel.com>
Date: Fri, 8 Jun 2018 10:05:26 -0700
Subject: [PATCH] drm/i915: Remove Master tables from cmdparser

The previous patch has killed support for secure batches
on gen6+, and hence the cmdparsers master tables are
now dead code. Remove them.
-------------------
From 17e89f38212d8b3cba470efca91b997ac03c592c Mon Sep 17 00:00:00 2001
From: Jon Bloomfield <jon.bloomfield@intel.com>
Date: Wed, 1 Aug 2018 09:33:59 -0700
Subject: [PATCH] drm/i915: Add support for mandatory cmdparsing

The existing cmdparser for gen7 can be bypassed by specifying
batch_len=0 in the execbuf call. This is safe because bypassing
simply reduces the cmd-set available.

In a later patch we will introduce cmdparsing for gen9, as a
security measure, which must be strictly enforced since without
it we are vulnerable to DoS attacks.

Introduce the concept of 'required' cmd parsing that cannot be
bypassed by submitting zero-length bb's.

v2: rebase (Mika)
v2: rebase (Mika)
v3: fix conflict on engine flags (Mika)
-------------------
From 77524398bccea3592a25cbe92a9a54fa555013af Mon Sep 17 00:00:00 2001
From: Jon Bloomfield <jon.bloomfield@intel.com>
Date: Tue, 22 May 2018 13:59:06 -0700
Subject: [PATCH] drm/i915: Support ro ppgtt mapped cmdparser shadow buffers

For Gen7, the original cmdparser motive was to permit limited
use of register read/write instructions in unprivileged BB's.
This worked by copying the user supplied bb to a kmd owned
bb, and running it in secure mode, from the ggtt, only if
the scanner finds no unsafe commands or registers.

For Gen8+ we can't use this same technique because running bb's
from the ggtt also disables access to ppgtt space. But we also
do not actually require 'secure' execution since we are only
trying to reduce the available command/register set. Instead we
will copy the user buffer to a kmd owned read-only bb in ppgtt,
and run in the usual non-secure mode.

Note that ro pages are only supported by ppgtt (not ggtt), but
luckily that's exactly what we need.

Add the required paths to map the shadow buffer to ppgtt ro for Gen8+

v2: IS_GEN7/IS_GEN (Mika)
v3: rebase
v4: rebase
v5: rebase
-------------------
From 2ac501479a1325d00aca5012887ebfece8358032 Mon Sep 17 00:00:00 2001
From: Jon Bloomfield <jon.bloomfield@intel.com>
Date: Wed, 1 Aug 2018 09:45:50 -0700
Subject: [PATCH] drm/i915: Allow parsing of unsized batches

In "drm/i915: Add support for mandatory cmdparsing" we introduced the
concept of mandatory parsing. This allows the cmdparser to be invoked
even when user passes batch_len=0 to the execbuf ioctl's.

However, the cmdparser needs to know the extents of the buffer being
scanned. Refactor the code to ensure the cmdparser uses the actual
object size, instead of the incoming length, if user passes 0.
-------------------
From 57c2c8f58ca07e8045f020e4e2548ac3bc3a5aab Mon Sep 17 00:00:00 2001
From: Jon Bloomfield <jon.bloomfield@intel.com>
Date: Mon, 23 Apr 2018 11:12:15 -0700
Subject: [PATCH] drm/i915: Add gen9 BCS cmdparsing

For gen9 we enable cmdparsing on the BCS ring, specifically
to catch inadvertent accesses to sensitive registers

Unlike gen7/hsw, we use the parser only to block certain
registers. We can rely on h/w to block restricted commands,
so the command tables only provide enough info to allow the
parser to delineate each command, and identify commands that
access registers.

Note: This patch deliberately ignores checkpatch issues in
favour of matching the style of the surrounding code. We'll
correct the entire file in one go in a later patch.

v3: rebase (Mika)
v4: Add RING_TIMESTAMP registers to whitelist (Jon)
-------------------
From d88d2d3fc6076760e903e78135f5bef028e6e813 Mon Sep 17 00:00:00 2001
From: Jon Bloomfield <jon.bloomfield@intel.com>
Date: Fri, 21 Sep 2018 13:18:09 -0700
Subject: [PATCH] drm/i915/cmdparser: Add support for backward jumps

To keep things manageable, the pre-gen9 cmdparser does not
attempt to track any form of nested BB_START's. This did not
prevent usermode from using nested starts, or even chained
batches because the cmdparser is not strictly enforced pre gen9.

Instead, the existence of a nested BB_START would cause the batch
to be emitted in insecure mode, and any privileged capabilities
would not be available.

For Gen9, the cmdparser becomes mandatory (for BCS at least), and
so not providing any form of nested BB_START support becomes
overly restrictive. Any such batch will simply not run.

We make heavy use of backward jumps in igt, and it is much easier
to add support for this restricted subset of nested jumps, than to
rewrite the whole of our test suite to avoid them.

Add the required logic to support limited backward jumps, to
instructions that have already been validated by the parser.

Note that it's not sufficient to simply approve any BB_START
that jumps backwards in the buffer because this would allow an
attacker to embed a rogue instruction sequence within the
operand words of a harmless instruction (say LRI) and jump to
that.

We introduce a bit array to track every instr offset successfully
validated, and test the target of BB_START against this. If the
target offset hits, it is re-written to the same offset in the
shadow buffer and the BB_START cmd is allowed.

Note: This patch deliberately ignores checkpatch issues in the
cmdtables, in order to match the style of the surrounding code.
We'll correct the entire file in one go in a later patch.

v2: set dispatch secure late (Mika)
v3: rebase (Mika)
v4: Clear whitelist on each parse
Minor review updates (Chris)
v5: Correct backward jump batching
v6: fix compilation error due to struct eb shuffle (Mika)
-------------------
From 362917ebcfacbd9c2b5172d5a5fe8cbef3ab838f Mon Sep 17 00:00:00 2001
From: Jon Bloomfield <jon.bloomfield@intel.com>
Date: Thu, 20 Sep 2018 09:45:10 -0700
Subject: [PATCH] drm/i915/cmdparser: Ignore Length operands during command
 matching

Some of the gen instruction macros (e.g. MI_DISPLAY_FLIP) have the
length directly encoded in them. Since these are used directly in
the tables, the Length becomes part of the comparison used for
matching during parsing. Thus, if the cmd being parsed has a
different length to that in the table, it is not matched and the
cmd is accepted via the default variable length path.

Fix by masking out everything except the Opcode in the cmd tables
-------------------
From 1433b8d41b1aa346e100b839c19fc033871ac5a6 Mon Sep 17 00:00:00 2001
From: Uma Shankar <uma.shankar@intel.com>
Date: Tue, 7 Aug 2018 21:15:35 +0530
Subject: [PATCH] drm/i915: Lower RM timeout to avoid DSI hard hangs

In BXT/APL, device 2 MMIO reads from MIPI controller requires its PLL
to be turned ON. When MIPI PLL is turned off (MIPI Display is not
active or connected), and someone (host or GT engine) tries to read
MIPI registers, it causes hard hang. This is a hardware restriction
or limitation.

Driver by itself doesn't read MIPI registers when MIPI display is off.
But any userspace application can submit unprivileged batch buffer for
execution. In that batch buffer there can be mmio reads. And these
reads are allowed even for unprivileged applications. If these
register reads are for MIPI DSI controller and MIPI display is not
active during that time, then the MMIO read operation causes system
hard hang and only way to recover is hard reboot. A genuine
process/application won't submit batch buffer like this and doesn't
cause any issue. But on a compromised system, a malign userspace
process/app can generate such batch buffer and can trigger system
hard hang (denial of service attack).

The fix is to lower the internal MMIO timeout value to an optimum
value of 950us as recommended by hardware team. If the timeout is
beyond 1ms (which will hit for any value we choose if MMIO READ on a
DSI specific register is performed without PLL ON), it causes the
system hang. But if the timeout value is lower than it will be below
the threshold (even if timeout happens) and system will not get into
a hung state. This will avoid a system hang without losing any
programming or GT interrupts, taking the worst case of lowest CDCLK
frequency and early DC5 abort into account.
-------------------
From 284d38667f7ed7171fd8f168c42490f9087c824c Mon Sep 17 00:00:00 2001
From: Imre Deak <imre.deak@intel.com>
Date: Mon, 9 Jul 2018 18:24:27 +0300
Subject: [PATCH] drm/i915/gen8+: Add RC6 CTX corruption WA

In some circumstances the RC6 context can get corrupted. We can detect
this and take the required action, that is disable RC6 and runtime PM.
The HW recovers from the corrupted state after a system suspend/resume
cycle, so detect the recovery and re-enable RC6 and runtime PM.

v2: rebase (Mika)
v3:
- Move intel_suspend_gt_powersave() to the end of the GEM suspend
  sequence.
- Add commit message.
v4:
- Rebased on intel_uncore_forcewake_put(i915->uncore, ...) API
  change.
v5: rebased on gem/gt split (Mika)
-------------------
From 6dd52bae8a01af77236b88917e84e84dbcfe06db Mon Sep 17 00:00:00 2001
From: Ben Hutchings <ben@decadent.org.uk>
Date: Mon, 11 Nov 2019 08:13:24 -0800
Subject: [PATCH] drm/i915/cmdparser: Fix jump whitelist clearing

When a jump_whitelist bitmap is reused, it needs to be cleared.
Currently this is done with memset() and the size calculation assumes
bitmaps are made of 32-bit words, not longs.  So on 64-bit
architectures, only the first half of the bitmap is cleared.

If some whitelist bits are carried over between successive batches
submitted on the same context, this will presumably allow embedding
the rogue instructions that we're trying to reject.

Use bitmap_zero() instead, which gets the calculation right.
2019-12-05 20:03:09 +00:00
ad
b8255b9f0e Fix warning that appears when compiling in kernel. 2019-12-05 19:03:39 +00:00
ad
9afd1ce310 Delete the counter from "struct radix_tree_node", and in the one place we
need a non-zero check, substitute with a deterministic bitwise OR of all
values in the node.  The structure then becomes cache line aligned.

For each node we now need only touch 2 cache lines instead of 3, which makes
all the operations faster (measured), amortises the cost of not having a
counter, and will avoid intra-pool-page false sharing on MP.
2019-12-05 18:50:41 +00:00
ad
0558f52127 Merge radixtree changes from yamt-pagecache. 2019-12-05 18:32:25 +00:00
christos
d1546fa78e PR/54740: Izumi Tsutsui: Disable cryptoengine unavailable message when
device is not configured (ENXIO).
2019-12-05 17:52:06 +00:00
tkusumi
61524b9550 dm: Make dm core set config to NULL after destroy
Just let dm core do this instead of having a comment expecting each
target to do the right thing.

taken-from: DragonFlyBSD
2019-12-05 16:59:43 +00:00
scole
958b51a023 Fix date sorting order of previous checkin 2019-12-05 16:51:06 +00:00
tkusumi
625bf0ef00 dm: Remove unneeded dm_get_version_ioctl()
"version" is implemented and handled in userspace,
hence dm ioctl doesn't need to support it.

taken-from: DragonFlyBSD
2019-12-05 15:52:39 +00:00
martin
1a3d08c0dd Copy -current to 9.0, this has diverged (macppc 601 support and others,
but since the macppc release ISOs are still generated by this, it is
important to catch up)
2019-12-05 10:25:41 +00:00
martin
edc893424f Belatedly note changes from scole for macppc powerpc 601 machines. 2019-12-05 09:36:01 +00:00
skrll
56a44a0ba8 Attempt to restore Utah $Hdr$ 2019-12-05 08:00:05 +00:00
msaitoh
7ecad1b497 KNF. No functional change. 2019-12-05 07:03:01 +00:00
msaitoh
c404a31068 Revert if_mc.c rev. 1.25. It's not required to check ifm->ifm_cur->ifm_media
instead of ifm->ifm_media.
2019-12-05 06:28:20 +00:00
mlelstv
df76ad14d5 Revert previous. Indirect matches are not wanted on platforms that
use external configuration data (FDT or OF).
2019-12-05 06:28:09 +00:00
msaitoh
f30d729901 Revert if_admsw.c rev. 1.25. It's not required to check
sc->sc_ifmedia[port].ifm_cur->ifm_media instead of ifm->ifm_media.
2019-12-05 06:25:33 +00:00
ryo
7ad7b38b66 fix build error by my previous commit 2019-12-05 05:45:52 +00:00
msaitoh
835fd7148a Fix previous comment change for ifm_media. It was correct.
The real problem is that some driver misuse ifm_media as the current active
media. struct mii_data has the current active media(mii_media_active). If a
driver use mii(4), it can be use mii->mii_media_active for this purpose.
struct ifmedia has no entry for this purpose. Some drivers have an entry
in their own softc to keep the value, but some other's don't have it and
they mistakenly use ifm_media.

 We might add a new entry to struct ifmedia in future to avoid this confusion
and for simplify.
2019-12-05 05:29:27 +00:00
msaitoh
f1e2747d26 Remove SIOC[SIFMEDIA because ifmedia_ioctl() does the same thing. 2019-12-05 05:28:09 +00:00
ryo
3156d7fc00 MAX_CACHE_LEVEL * struct aarch64_cache_info are required to statically allocate for cpu0.
avoid "cpu0: L2 512KB/64B 16-way write-back read-allocate write-allocate PIPT *UNK* cache" by r1.8
2019-12-05 05:17:55 +00:00
riastradh
957ea672ed #ifdef notyet ---> never 2019-12-05 04:17:13 +00:00
riastradh
9d003b74d5 Only need one ci_onproc member. 2019-12-05 03:59:39 +00:00
riastradh
38e3ff59e6 Missed a spot in the crypto/arc4 deletion. 2019-12-05 03:57:55 +00:00
riastradh
7ba101b07e Nuke crypto/arc4. Has not been used since 2003. Will not be missed. 2019-12-05 03:22:02 +00:00
riastradh
aca9a2fd6e Avoid redefining uint_t &c. if compat_defs.h already defines them. 2019-12-05 03:21:42 +00:00
riastradh
6f17d02bf7 Switch psz_ev_excl to static evcnt. 2019-12-05 03:21:29 +00:00
riastradh
d5dccc2571 Restore psz_lock just for the event count.
Cost of mutex_enter/exit is negligible compared to the xcall we just
did, so this is not going to meaningfully affect performance.
2019-12-05 03:21:17 +00:00
riastradh
de3acc9d56 Allow equality in this assertion.
This can happen if we lose the race mentioned in percpu_cpu_swap.
2019-12-05 03:21:08 +00:00
msaitoh
5132e01e56 Do SIOC[GS]IFMEDIA like others. Not tested. 2019-12-05 03:15:20 +00:00