This is an automatic generated email to let you know that the following patch were queued:
Subject: media: em28xx: use a default format if TRY_FMT fails
Author: Mauro Carvalho Chehab <mchehab+samsung(a)kernel.org>
Date: Thu Sep 13 23:22:40 2018 -0400
Follow the V4L2 spec, as warned by v4l2-compliance:
warn: v4l2-test-formats.cpp(732): TRY_FMT cannot handle an invalid pixelformat.
warn: v4l2-test-formats.cpp(733): This may or may not be a problem. For more information see:
warn: v4l2-test-formats.cpp(734): http://www.mail-archive.com/linux-media@vger.kernel.org/msg56550.html
Cc: stable(a)vger.kernel.org
Fixes: bddcf63313c6 ("V4L/DVB (9927): em28xx: use a more standard way to specify video formats")
Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung(a)kernel.org>
drivers/media/usb/em28xx/em28xx-video.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
---
diff --git a/drivers/media/usb/em28xx/em28xx-video.c b/drivers/media/usb/em28xx/em28xx-video.c
index fbdfe6762cb2..4b08da45032d 100644
--- a/drivers/media/usb/em28xx/em28xx-video.c
+++ b/drivers/media/usb/em28xx/em28xx-video.c
@@ -1471,9 +1471,9 @@ static int vidioc_try_fmt_vid_cap(struct file *file, void *priv,
fmt = format_by_fourcc(f->fmt.pix.pixelformat);
if (!fmt) {
- em28xx_videodbg("Fourcc format (%08x) invalid.\n",
- f->fmt.pix.pixelformat);
- return -EINVAL;
+ fmt = &format[0];
+ em28xx_videodbg("Fourcc format (%08x) invalid. Using default (%08x).\n",
+ f->fmt.pix.pixelformat, fmt->fourcc);
}
if (dev->board.is_em2800) {
This is an automatic generated email to let you know that the following patch were queued:
Subject: media: em28xx: fix handler for vidioc_s_input()
Author: Mauro Carvalho Chehab <mchehab+samsung(a)kernel.org>
Date: Fri Sep 14 13:13:15 2018 -0400
The a->index is not the name of the internal amux entry,
but, instead a value from zero to the maximum number
of audio inputs.
As the actual available inputs depend on each board, build
it dynamically.
This is broken for a really long time. On a quick check,
since at least commit 195a4ef627e1 ("V4L/DVB (6585): Convert
em28xx to video_ioctl2") this was not implemented right.
Fixes: 195a4ef627e1 ("V4L/DVB (6585): Convert em28xx to video_ioctl2")
Cc: stable(a)vger.kernel.org
Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung(a)kernel.org>
drivers/media/usb/em28xx/em28xx-cards.c | 29 ++++++++++++
drivers/media/usb/em28xx/em28xx-video.c | 84 +++++++++++++++++++++++++++++----
drivers/media/usb/em28xx/em28xx.h | 8 +++-
3 files changed, 112 insertions(+), 9 deletions(-)
---
diff --git a/drivers/media/usb/em28xx/em28xx-cards.c b/drivers/media/usb/em28xx/em28xx-cards.c
index 71c829f31d3b..06a7e09ded6e 100644
--- a/drivers/media/usb/em28xx/em28xx-cards.c
+++ b/drivers/media/usb/em28xx/em28xx-cards.c
@@ -3039,6 +3039,9 @@ static int em28xx_hint_board(struct em28xx *dev)
static void em28xx_card_setup(struct em28xx *dev)
{
+ int i, j, idx;
+ bool duplicate_entry;
+
/*
* If the device can be a webcam, seek for a sensor.
* If sensor is not found, then it isn't a webcam.
@@ -3195,6 +3198,32 @@ static void em28xx_card_setup(struct em28xx *dev)
/* Allow override tuner type by a module parameter */
if (tuner >= 0)
dev->tuner_type = tuner;
+
+ /*
+ * Dynamically generate a list of valid audio inputs for this
+ * specific board, mapping them via enum em28xx_amux.
+ */
+
+ idx = 0;
+ for (i = 0; i < MAX_EM28XX_INPUT; i++) {
+ if (!INPUT(i)->type)
+ continue;
+
+ /* Skip already mapped audio inputs */
+ duplicate_entry = false;
+ for (j = 0; j < idx; j++) {
+ if (INPUT(i)->amux == dev->amux_map[j]) {
+ duplicate_entry = true;
+ break;
+ }
+ }
+ if (duplicate_entry)
+ continue;
+
+ dev->amux_map[idx++] = INPUT(i)->amux;
+ }
+ for (; idx < MAX_EM28XX_INPUT; idx++)
+ dev->amux_map[idx] = EM28XX_AMUX_UNUSED;
}
void em28xx_setup_xc3028(struct em28xx *dev, struct xc2028_ctrl *ctl)
diff --git a/drivers/media/usb/em28xx/em28xx-video.c b/drivers/media/usb/em28xx/em28xx-video.c
index 917602954bfb..fbdfe6762cb2 100644
--- a/drivers/media/usb/em28xx/em28xx-video.c
+++ b/drivers/media/usb/em28xx/em28xx-video.c
@@ -1666,6 +1666,7 @@ static int vidioc_enum_input(struct file *file, void *priv,
{
struct em28xx *dev = video_drvdata(file);
unsigned int n;
+ int j;
n = i->index;
if (n >= MAX_EM28XX_INPUT)
@@ -1685,6 +1686,12 @@ static int vidioc_enum_input(struct file *file, void *priv,
if (dev->is_webcam)
i->capabilities = 0;
+ /* Dynamically generates an audioset bitmask */
+ i->audioset = 0;
+ for (j = 0; j < MAX_EM28XX_INPUT; j++)
+ if (dev->amux_map[j] != EM28XX_AMUX_UNUSED)
+ i->audioset |= 1 << j;
+
return 0;
}
@@ -1710,11 +1717,24 @@ static int vidioc_s_input(struct file *file, void *priv, unsigned int i)
return 0;
}
-static int vidioc_g_audio(struct file *file, void *priv, struct v4l2_audio *a)
+static int em28xx_fill_audio_input(struct em28xx *dev,
+ const char *s,
+ struct v4l2_audio *a,
+ unsigned int index)
{
- struct em28xx *dev = video_drvdata(file);
+ unsigned int idx = dev->amux_map[index];
- switch (a->index) {
+ /*
+ * With msp3400, almost all mappings use the default (amux = 0).
+ * The only one may use a different value is WinTV USB2, where it
+ * can also be SCART1 input.
+ * As it is very doubtful that we would see new boards with msp3400,
+ * let's just reuse the existing switch.
+ */
+ if (dev->has_msp34xx && idx != EM28XX_AMUX_UNUSED)
+ idx = EM28XX_AMUX_LINE_IN;
+
+ switch (idx) {
case EM28XX_AMUX_VIDEO:
strscpy(a->name, "Television", sizeof(a->name));
break;
@@ -1739,32 +1759,79 @@ static int vidioc_g_audio(struct file *file, void *priv, struct v4l2_audio *a)
case EM28XX_AMUX_PCM_OUT:
strscpy(a->name, "PCM", sizeof(a->name));
break;
+ case EM28XX_AMUX_UNUSED:
default:
return -EINVAL;
}
-
- a->index = dev->ctl_ainput;
+ a->index = index;
a->capability = V4L2_AUDCAP_STEREO;
+ em28xx_videodbg("%s: audio input index %d is '%s'\n",
+ s, a->index, a->name);
+
return 0;
}
+static int vidioc_enumaudio(struct file *file, void *fh, struct v4l2_audio *a)
+{
+ struct em28xx *dev = video_drvdata(file);
+
+ if (a->index >= MAX_EM28XX_INPUT)
+ return -EINVAL;
+
+ return em28xx_fill_audio_input(dev, __func__, a, a->index);
+}
+
+static int vidioc_g_audio(struct file *file, void *priv, struct v4l2_audio *a)
+{
+ struct em28xx *dev = video_drvdata(file);
+ int i;
+
+ for (i = 0; i < MAX_EM28XX_INPUT; i++)
+ if (dev->ctl_ainput == dev->amux_map[i])
+ return em28xx_fill_audio_input(dev, __func__, a, i);
+
+ /* Should never happen! */
+ return -EINVAL;
+}
+
static int vidioc_s_audio(struct file *file, void *priv,
const struct v4l2_audio *a)
{
struct em28xx *dev = video_drvdata(file);
+ int idx, i;
if (a->index >= MAX_EM28XX_INPUT)
return -EINVAL;
- if (!INPUT(a->index)->type)
+
+ idx = dev->amux_map[a->index];
+
+ if (idx == EM28XX_AMUX_UNUSED)
+ return -EINVAL;
+
+ dev->ctl_ainput = idx;
+
+ /*
+ * FIXME: This is wrong, as different inputs at em28xx_cards
+ * may have different audio outputs. So, the right thing
+ * to do is to implement VIDIOC_G_AUDOUT/VIDIOC_S_AUDOUT.
+ * With the current board definitions, this would work fine,
+ * as, currently, all boards fit.
+ */
+ for (i = 0; i < MAX_EM28XX_INPUT; i++)
+ if (idx == dev->amux_map[i])
+ break;
+ if (i == MAX_EM28XX_INPUT)
return -EINVAL;
- dev->ctl_ainput = INPUT(a->index)->amux;
- dev->ctl_aoutput = INPUT(a->index)->aout;
+ dev->ctl_aoutput = INPUT(i)->aout;
if (!dev->ctl_aoutput)
dev->ctl_aoutput = EM28XX_AOUT_MASTER;
+ em28xx_videodbg("%s: set audio input to %d\n", __func__,
+ dev->ctl_ainput);
+
return 0;
}
@@ -2302,6 +2369,7 @@ static const struct v4l2_ioctl_ops video_ioctl_ops = {
.vidioc_try_fmt_vbi_cap = vidioc_g_fmt_vbi_cap,
.vidioc_s_fmt_vbi_cap = vidioc_g_fmt_vbi_cap,
.vidioc_enum_framesizes = vidioc_enum_framesizes,
+ .vidioc_enumaudio = vidioc_enumaudio,
.vidioc_g_audio = vidioc_g_audio,
.vidioc_s_audio = vidioc_s_audio,
diff --git a/drivers/media/usb/em28xx/em28xx.h b/drivers/media/usb/em28xx/em28xx.h
index 953caac025f2..a551072e62ed 100644
--- a/drivers/media/usb/em28xx/em28xx.h
+++ b/drivers/media/usb/em28xx/em28xx.h
@@ -335,6 +335,9 @@ enum em28xx_usb_audio_type {
/**
* em28xx_amux - describes the type of audio input used by em28xx
*
+ * @EM28XX_AMUX_UNUSED:
+ * Used only on em28xx dev->map field, in order to mark an entry
+ * as unused.
* @EM28XX_AMUX_VIDEO:
* On devices without AC97, this is the only value that it is currently
* allowed.
@@ -369,7 +372,8 @@ enum em28xx_usb_audio_type {
* same time, via the alsa mux.
*/
enum em28xx_amux {
- EM28XX_AMUX_VIDEO,
+ EM28XX_AMUX_UNUSED = -1,
+ EM28XX_AMUX_VIDEO = 0,
EM28XX_AMUX_LINE_IN,
/* Some less-common mixer setups */
@@ -692,6 +696,8 @@ struct em28xx {
unsigned int ctl_input; // selected input
unsigned int ctl_ainput;// selected audio input
unsigned int ctl_aoutput;// selected audio output
+ enum em28xx_amux amux_map[MAX_EM28XX_INPUT];
+
int mute;
int volume;
Sync syscall to DAX file needs to flush processor cache, but it
currently does not flush to existing DAX files. This is because
'ext2_da_aops' is set to address_space_operations of existing DAX
files, instead of 'ext2_dax_aops', since S_DAX flag is set after
ext2_set_aops() in the open path.
Similar to ext4, change ext2_iget() to initialize i_flags before
ext2_set_aops().
Fixes: fb094c90748f ("ext2, dax: introduce ext2_dax_aops")
Signed-off-by: Toshi Kani <toshi.kani(a)hpe.com>
Suggested-by: Jan Kara <jack(a)suse.cz>
Cc: Jan Kara <jack(a)suse.cz>
Cc: Dan Williams <dan.j.williams(a)intel.com>
Cc: "Theodore Ts'o" <tytso(a)mit.edu>
Cc: Andreas Dilger <adilger.kernel(a)dilger.ca>
Cc: <stable(a)vger.kernel.org>
---
fs/ext2/inode.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/fs/ext2/inode.c b/fs/ext2/inode.c
index 7f7ee18fe179..e4bb9386c045 100644
--- a/fs/ext2/inode.c
+++ b/fs/ext2/inode.c
@@ -1448,6 +1448,7 @@ struct inode *ext2_iget (struct super_block *sb, unsigned long ino)
}
inode->i_blocks = le32_to_cpu(raw_inode->i_blocks);
ei->i_flags = le32_to_cpu(raw_inode->i_flags);
+ ext2_set_inode_flags(inode);
ei->i_faddr = le32_to_cpu(raw_inode->i_faddr);
ei->i_frag_no = raw_inode->i_frag;
ei->i_frag_size = raw_inode->i_fsize;
@@ -1517,7 +1518,6 @@ struct inode *ext2_iget (struct super_block *sb, unsigned long ino)
new_decode_dev(le32_to_cpu(raw_inode->i_block[1])));
}
brelse (bh);
- ext2_set_inode_flags(inode);
unlock_new_inode(inode);
return inode;
The current code only frees N-1 gpios if an error occurs during
gpiod_set_transitory, gpiod_direction_output or gpiod_direction_input.
Leading to gpios that cannot be used by userspace nor other drivers.
Cc: Timur Tabi <timur(a)codeaurora.org>
Cc: stable(a)vger.kernel.org
Fixes: ab3dbcf78f60f46d ("gpioib: do not free unrequested descriptors)
Signed-off-by: Ricardo Ribalda Delgado <ricardo.ribalda(a)gmail.com>
---
drivers/gpio/gpiolib.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/gpio/gpiolib.c b/drivers/gpio/gpiolib.c
index e8f8a1999393..a57300c1d649 100644
--- a/drivers/gpio/gpiolib.c
+++ b/drivers/gpio/gpiolib.c
@@ -571,7 +571,7 @@ static int linehandle_create(struct gpio_device *gdev, void __user *ip)
if (ret)
goto out_free_descs;
lh->descs[i] = desc;
- count = i;
+ count = i + 1;
if (lflags & GPIOHANDLE_REQUEST_ACTIVE_LOW)
set_bit(FLAG_ACTIVE_LOW, &desc->flags);
--
2.18.0
While at first mtd_part_of_parse() would just call
of_get_chil_by_name(), it has been edited to first try to get the OF
node thanks to mtd_get_of_node() and fallback on
of_get_child_by_name().
A of_node_put() was a bit below in the code, to balance the
of_get_child_by_name(). However, despite its name, mtd_get_of_node()
does not take a reference on the OF node. It is a simple helper hiding
some pointer logic to retrieve the OF node related to an MTD
device. People often used it this way:
of_node_put(mtd_get_of_node(<mtd>)).
The direct effect of such unbalanced reference counting is visible by
rmmod'ing any module that would have added MTD partitions:
OF: ERROR: Bad of_node_put() on <of_path_to_partition>
As it seems normal to get a reference on the OF node during the
of_property_for_each_string() that follows, add a call to
of_node_get() when relevant.
Fixes: 76a832254ab0 ("mtd: partitions: use DT info for parsing partitions with "compatible" prop")
Cc: stable(a)vger.kernel.org
Signed-off-by: Miquel Raynal <miquel.raynal(a)bootlin.com>
---
drivers/mtd/mtdpart.c | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/drivers/mtd/mtdpart.c b/drivers/mtd/mtdpart.c
index 52e2cb35fc79..99c460facd5e 100644
--- a/drivers/mtd/mtdpart.c
+++ b/drivers/mtd/mtdpart.c
@@ -873,8 +873,11 @@ static int mtd_part_of_parse(struct mtd_info *master,
int ret, err = 0;
np = mtd_get_of_node(master);
- if (!mtd_is_partition(master))
+ if (mtd_is_partition(master))
+ of_node_get(np);
+ else
np = of_get_child_by_name(np, "partitions");
+
of_property_for_each_string(np, "compatible", prop, compat) {
parser = mtd_part_get_compatible_parser(compat);
if (!parser)
--
2.17.1
As documented in spi-mem.h, spi_mem_op->data.buf.{in,out} must be
DMA-able, and commit 4120f8d158ef ("mtd: spi-nor: Use the spi_mem_xx()
API") failed to follow this rule as buffers passed to
->{read,write}_reg() are usually placed on the stack.
Fix that by allocating a scratch buffer and copying the data in there
before passing it to the spi-mem layer.
Fixes: 4120f8d158ef ("mtd: spi-nor: Use the spi_mem_xx() API")
Reported-by: Jarkko Nikula <jarkko.nikula(a)linux.intel.com>
Cc: <stable(a)vger.kernel.org>
Signed-off-by: Boris Brezillon <boris.brezillon(a)bootlin.com>
---
Note that the ->{read,write}() path is still buggy since nothing
guarantees that buffers passed by the MTD layer to the SPI NOR layer
are DMA-able, but this is a long-standing issue which we'll have to
address at the spi-nor level (this layer can choose the bounce buffer
size based on nor->page_size).
---
drivers/mtd/devices/m25p80.c | 24 +++++++++++++++++++++---
1 file changed, 21 insertions(+), 3 deletions(-)
diff --git a/drivers/mtd/devices/m25p80.c b/drivers/mtd/devices/m25p80.c
index cbfafc453274..3b7fafa4bbd6 100644
--- a/drivers/mtd/devices/m25p80.c
+++ b/drivers/mtd/devices/m25p80.c
@@ -39,14 +39,22 @@ static int m25p80_read_reg(struct spi_nor *nor, u8 code, u8 *val, int len)
struct spi_mem_op op = SPI_MEM_OP(SPI_MEM_OP_CMD(code, 1),
SPI_MEM_OP_NO_ADDR,
SPI_MEM_OP_NO_DUMMY,
- SPI_MEM_OP_DATA_IN(len, val, 1));
+ SPI_MEM_OP_DATA_IN(len, NULL, 1));
+ void *scratchbuf;
int ret;
+ scratchbuf = kmemdup(val, len, GFP_KERNEL);
+ if (!scratchbuf)
+ return -ENOMEM;
+
+ op.data.buf.in = scratchbuf;
ret = spi_mem_exec_op(flash->spimem, &op);
if (ret < 0)
dev_err(&flash->spimem->spi->dev, "error %d reading %x\n", ret,
code);
+ kfree(scratchbuf);
+
return ret;
}
@@ -56,9 +64,19 @@ static int m25p80_write_reg(struct spi_nor *nor, u8 opcode, u8 *buf, int len)
struct spi_mem_op op = SPI_MEM_OP(SPI_MEM_OP_CMD(opcode, 1),
SPI_MEM_OP_NO_ADDR,
SPI_MEM_OP_NO_DUMMY,
- SPI_MEM_OP_DATA_OUT(len, buf, 1));
+ SPI_MEM_OP_DATA_OUT(len, NULL, 1));
+ void *scratchbuf;
+ int ret;
- return spi_mem_exec_op(flash->spimem, &op);
+ scratchbuf = kmemdup(buf, len, GFP_KERNEL);
+ if (!scratchbuf)
+ return -ENOMEM;
+
+ op.data.buf.out = scratchbuf;
+ ret = spi_mem_exec_op(flash->spimem, &op);
+ kfree(scratchbuf);
+
+ return ret;
}
static ssize_t m25p80_write(struct spi_nor *nor, loff_t to, size_t len,
--
2.14.1
A transparent huge page is represented by a single entry on an LRU list.
Therefore, we can only make unevictable an entire compound page, not
individual subpages.
If a user tries to mlock() part of a huge page, we want the rest of the
page to be reclaimable.
We handle this by keeping PTE-mapped huge pages on normal LRU lists: the
PMD on border of VM_LOCKED VMA will be split into PTE table.
Introduction of THP migration breaks[1] the rules around mlocking THP
pages. If we had a single PMD mapping of the page in mlocked VMA, the
page will get mlocked, regardless of PTE mappings of the page.
For tmpfs/shmem it's easy to fix by checking PageDoubleMap() in
remove_migration_pmd().
Anon THP pages can only be shared between processes via fork(). Mlocked
page can only be shared if parent mlocked it before forking, otherwise
CoW will be triggered on mlock().
For Anon-THP, we can fix the issue by munlocking the page on removing PTE
migration entry for the page. PTEs for the page will always come after
mlocked PMD: rmap walks VMAs from oldest to newest.
Test-case:
#include <unistd.h>
#include <sys/mman.h>
#include <sys/wait.h>
#include <linux/mempolicy.h>
#include <numaif.h>
int main(void)
{
unsigned long nodemask = 4;
void *addr;
addr = mmap((void *)0x20000000UL, 2UL << 20, PROT_READ | PROT_WRITE,
MAP_PRIVATE | MAP_ANONYMOUS | MAP_LOCKED, -1, 0);
if (fork()) {
wait(NULL);
return 0;
}
mlock(addr, 4UL << 10);
mbind(addr, 2UL << 20, MPOL_PREFERRED | MPOL_F_RELATIVE_NODES,
&nodemask, 4, MPOL_MF_MOVE);
return 0;
}
[1] https://lkml.kernel.org/r/CAOMGZ=G52R-30rZvhGxEbkTw7rLLwBGadVYeo--iizcD3upL…
Signed-off-by: Kirill A. Shutemov <kirill.shutemov(a)linux.intel.com>
Reported-by: Vegard Nossum <vegard.nossum(a)oracle.com>
Fixes: 616b8371539a ("mm: thp: enable thp migration in generic path")
Cc: <stable(a)vger.kernel.org> [v4.14+]
Cc: Zi Yan <zi.yan(a)cs.rutgers.edu>
Cc: Naoya Horiguchi <n-horiguchi(a)ah.jp.nec.com>
Cc: Vlastimil Babka <vbabka(a)suse.cz>
Cc: Andrea Arcangeli <aarcange(a)redhat.com>
---
mm/huge_memory.c | 2 +-
mm/migrate.c | 3 +++
2 files changed, 4 insertions(+), 1 deletion(-)
diff --git a/mm/huge_memory.c b/mm/huge_memory.c
index 533f9b00147d..00704060b7f7 100644
--- a/mm/huge_memory.c
+++ b/mm/huge_memory.c
@@ -2931,7 +2931,7 @@ void remove_migration_pmd(struct page_vma_mapped_walk *pvmw, struct page *new)
else
page_add_file_rmap(new, true);
set_pmd_at(mm, mmun_start, pvmw->pmd, pmde);
- if (vma->vm_flags & VM_LOCKED)
+ if ((vma->vm_flags & VM_LOCKED) && !PageDoubleMap(new))
mlock_vma_page(new);
update_mmu_cache_pmd(vma, address, pvmw->pmd);
}
diff --git a/mm/migrate.c b/mm/migrate.c
index d6a2e89b086a..9d374011c244 100644
--- a/mm/migrate.c
+++ b/mm/migrate.c
@@ -275,6 +275,9 @@ static bool remove_migration_pte(struct page *page, struct vm_area_struct *vma,
if (vma->vm_flags & VM_LOCKED && !PageTransCompound(new))
mlock_vma_page(new);
+ if (PageTransHuge(page) && PageMlocked(page))
+ clear_page_mlock(page);
+
/* No need to invalidate - it was non-present before */
update_mmu_cache(vma, pvmw.address, pvmw.pte);
}
--
2.18.0
From: Suren Baghdasaryan <surenb(a)google.com>
According to ETSI TS 102 622 specification chapter 4.4 pipe identifier
is 7 bits long which allows for 128 unique pipe IDs. Because
NFC_HCI_MAX_PIPES is used as the number of pipes supported and not
as the max pipe ID, its value should be 128 instead of 127.
nfc_hci_recv_from_llc extracts pipe ID from packet header using
NFC_HCI_FRAGMENT(0x7F) mask which allows for pipe ID value of 127.
Same happens when NCI_HCP_MSG_GET_PIPE() is being used. With
pipes array having only 127 elements and pipe ID of 127 the OOB memory
access will result.
Cc: Samuel Ortiz <sameo(a)linux.intel.com>
Cc: Allen Pais <allen.pais(a)oracle.com>
Cc: "David S. Miller" <davem(a)davemloft.net>
Suggested-by: Dan Carpenter <dan.carpenter(a)oracle.com>
Signed-off-by: Suren Baghdasaryan <surenb(a)google.com>
Reviewed-by: Kees Cook <keescook(a)chromium.org>
Cc: stable <stable(a)vger.kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh(a)linuxfoundation.org>
---
include/net/nfc/hci.h | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/include/net/nfc/hci.h b/include/net/nfc/hci.h
index 316694dafa5b..008f466d1da7 100644
--- a/include/net/nfc/hci.h
+++ b/include/net/nfc/hci.h
@@ -87,7 +87,7 @@ struct nfc_hci_pipe {
* According to specification 102 622 chapter 4.4 Pipes,
* the pipe identifier is 7 bits long.
*/
-#define NFC_HCI_MAX_PIPES 127
+#define NFC_HCI_MAX_PIPES 128
struct nfc_hci_init_data {
u8 gate_count;
struct nfc_hci_gate gates[NFC_HCI_MAX_CUSTOM_GATES];
--
2.19.0
From: Suren Baghdasaryan <surenb(a)google.com>
When handling SHDLC I-Frame commands "pipe" field used for indexing
into an array should be checked before usage. If left unchecked it
might access memory outside of the array of size NFC_HCI_MAX_PIPES(127).
Malformed NFC HCI frames could be injected by a malicious NFC device
communicating with the device being attacked (remote attack vector),
or even by an attacker with physical access to the I2C bus such that
they could influence the data transfers on that bus (local attack vector).
skb->data is controlled by the attacker and has only been sanitized in
the most trivial ways (CRC check), therefore we can consider the
create_info struct and all of its members to tainted. 'create_info->pipe'
with max value of 255 (uint8) is used to take an offset of the
hdev->pipes array of 127 elements which can lead to OOB write.
Cc: Samuel Ortiz <sameo(a)linux.intel.com>
Cc: Allen Pais <allen.pais(a)oracle.com>
Cc: "David S. Miller" <davem(a)davemloft.net>
Suggested-by: Kevin Deus <kdeus(a)google.com>
Signed-off-by: Suren Baghdasaryan <surenb(a)google.com>
Acked-by: Kees Cook <keescook(a)chromium.org>
Cc: stable <stable(a)vger.kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh(a)linuxfoundation.org>
---
net/nfc/hci/core.c | 10 ++++++++++
1 file changed, 10 insertions(+)
diff --git a/net/nfc/hci/core.c b/net/nfc/hci/core.c
index ac8030c4bcf8..19cb2e473ea6 100644
--- a/net/nfc/hci/core.c
+++ b/net/nfc/hci/core.c
@@ -209,6 +209,11 @@ void nfc_hci_cmd_received(struct nfc_hci_dev *hdev, u8 pipe, u8 cmd,
}
create_info = (struct hci_create_pipe_resp *)skb->data;
+ if (create_info->pipe >= NFC_HCI_MAX_PIPES) {
+ status = NFC_HCI_ANY_E_NOK;
+ goto exit;
+ }
+
/* Save the new created pipe and bind with local gate,
* the description for skb->data[3] is destination gate id
* but since we received this cmd from host controller, we
@@ -232,6 +237,11 @@ void nfc_hci_cmd_received(struct nfc_hci_dev *hdev, u8 pipe, u8 cmd,
}
delete_info = (struct hci_delete_pipe_noti *)skb->data;
+ if (delete_info->pipe >= NFC_HCI_MAX_PIPES) {
+ status = NFC_HCI_ANY_E_NOK;
+ goto exit;
+ }
+
hdev->pipes[delete_info->pipe].gate = NFC_HCI_INVALID_GATE;
hdev->pipes[delete_info->pipe].dest_host = NFC_HCI_INVALID_HOST;
break;
--
2.19.0
Since the addition of WARN_ON() in nand_subop_get_data/addr_len()
helpers, this driver will produce harmless warnings (mostly at probe)
just because it always called the *_data_len() helper in the parsing
function (even on non-data instructions, where this value is
meaningless and unneeded.
Fix these warnings by deriving the length only when it is relevant.
Fixes: 760c435e0f85 ("mtd: rawnand: make subop helpers return unsigned values")
Cc: stable(a)vger.kernel.org
Signed-off-by: Miquel Raynal <miquel.raynal(a)bootlin.com>
---
drivers/mtd/nand/raw/marvell_nand.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/drivers/mtd/nand/raw/marvell_nand.c b/drivers/mtd/nand/raw/marvell_nand.c
index 7af4d6213ee5..bc2ef5209783 100644
--- a/drivers/mtd/nand/raw/marvell_nand.c
+++ b/drivers/mtd/nand/raw/marvell_nand.c
@@ -1547,7 +1547,7 @@ static void marvell_nfc_parse_instructions(struct nand_chip *chip,
for (op_id = 0; op_id < subop->ninstrs; op_id++) {
unsigned int offset, naddrs;
const u8 *addrs;
- int len = nand_subop_get_data_len(subop, op_id);
+ int len;
instr = &subop->instrs[op_id];
@@ -1593,6 +1593,7 @@ static void marvell_nfc_parse_instructions(struct nand_chip *chip,
nfc_op->ndcb[0] |=
NDCB0_CMD_XTYPE(XTYPE_MONOLITHIC_RW) |
NDCB0_LEN_OVRD;
+ len = nand_subop_get_data_len(subop, op_id);
nfc_op->ndcb[3] |= round_up(len, FIFO_DEPTH);
}
nfc_op->data_delay_ns = instr->delay_ns;
@@ -1606,6 +1607,7 @@ static void marvell_nfc_parse_instructions(struct nand_chip *chip,
nfc_op->ndcb[0] |=
NDCB0_CMD_XTYPE(XTYPE_MONOLITHIC_RW) |
NDCB0_LEN_OVRD;
+ len = nand_subop_get_data_len(subop, op_id);
nfc_op->ndcb[3] |= round_up(len, FIFO_DEPTH);
}
nfc_op->data_delay_ns = instr->delay_ns;
--
2.17.1
From: Andi Kleen <ak(a)linux.intel.com>
Patch for stable only to fix boot resets caused by the L1TF patches.
Stable trees reverted the following patch
Revert "x86/mm/pat: Ensure cpa->pfn only contains page frame numbers"
This reverts commit 87e2bd898d3a79a8c609f183180adac47879a2a4 which is
commit edc3b9129cecd0f0857112136f5b8b1bc1d45918 upstream.
but the L1TF patch backported here
x86/mm/pat: Make set_memory_np() L1TF safe
commit 958f79b9ee55dfaf00c8106ed1c22a2919e0028b upstream
set_memory_np() is used to mark kernel mappings not present, but it has
it's own open coded mechanism which does not have the L1TF protection of
inverting the address bits.
assumed that cpa->pfn contains a PFN. With the above patch reverted
it does not, which causes the PMD to be set to an incorrect address
shifted by 12 bits, which can cause early boot reset on some
systems, like an Apollo Lake embedded system.
Convert the address to a PFN before passing it to pmd_pfn()
Thanks to Bernhard for bisecting and testing.
Cc: stable(a)vger.kernel.org # 4.4 and 4.9
Reported-by: Bernhard Kaindl <bernhard.kaindl(a)thalesgroup.com>
Tested-by: Bernhard Kaindl <bernhard.kaindl(a)thalesgroup.com>
Signed-off-by: Andi Kleen <ak(a)linux.intel.com>
---
arch/x86/mm/pageattr.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/arch/x86/mm/pageattr.c b/arch/x86/mm/pageattr.c
index 27610c2d1821..1007fa80f5a6 100644
--- a/arch/x86/mm/pageattr.c
+++ b/arch/x86/mm/pageattr.c
@@ -1006,7 +1006,7 @@ static int populate_pmd(struct cpa_data *cpa,
pmd = pmd_offset(pud, start);
- set_pmd(pmd, pmd_mkhuge(pfn_pmd(cpa->pfn,
+ set_pmd(pmd, pmd_mkhuge(pfn_pmd(cpa->pfn >> PAGE_SHIFT,
canon_pgprot(pmd_pgprot))));
start += PMD_SIZE;
--
2.17.1
From: Andi Kleen <ak(a)linux.intel.com>
[upstream cc51e5428ea54f575d49cfcede1d4cb3a72b4ec4 for 4.4.
Note there might be still a trivial conflict with the backport
for b0a182f875689647b014bc01d36b340217792852, but should
be easy to resolve]
On Nehalem and newer core CPUs the CPU cache internally uses 44 bits
physical address space. The L1TF workaround is limited by this internal
cache address width, and needs to have one bit free there for the
mitigation to work.
Older client systems report only 36bit physical address space so the range
check decides that L1TF is not mitigated for a 36bit phys/32GB system with
some memory holes.
But since these actually have the larger internal cache width this warning
is bogus because it would only really be needed if the system had more than
43bits of memory.
Add a new internal x86_cache_bits field. Normally it is the same as the
physical bits field reported by CPUID, but for Nehalem and newerforce it to
be at least 44bits.
Change the L1TF memory size warning to use the new cache_bits field to
avoid bogus warnings and remove the bogus comment about memory size.
Fixes: 17dbca119312 ("x86/speculation/l1tf: Add sysfs reporting for l1tf")
Reported-by: George Anchev <studio(a)anchev.net>
Reported-by: Christopher Snowhill <kode54(a)gmail.com>
Signed-off-by: Andi Kleen <ak(a)linux.intel.com>
Signed-off-by: Thomas Gleixner <tglx(a)linutronix.de>
Cc: x86(a)kernel.org
Cc: linux-kernel(a)vger.kernel.org
Cc: Michael Hocko <mhocko(a)suse.com>
Cc: vbabka(a)suse.cz
Cc: stable(a)vger.kernel.org
Link: https://lkml.kernel.org/r/20180824170351.34874-1-andi@firstfloor.org
---
arch/x86/include/asm/processor.h | 4 ++-
arch/x86/kernel/cpu/bugs.c | 47 ++++++++++++++++++++++++++++----
arch/x86/kernel/cpu/common.c | 2 ++
3 files changed, 47 insertions(+), 6 deletions(-)
diff --git a/arch/x86/include/asm/processor.h b/arch/x86/include/asm/processor.h
index a3a53955f01c..cb07d3f618ca 100644
--- a/arch/x86/include/asm/processor.h
+++ b/arch/x86/include/asm/processor.h
@@ -104,6 +104,8 @@ struct cpuinfo_x86 {
__u8 x86_phys_bits;
/* CPUID returned core id bits: */
__u8 x86_coreid_bits;
+
+ __u8 x86_cache_bits;
/* Max extended CPUID function supported: */
__u32 extended_cpuid_level;
/* Maximum supported CPUID level, -1=no CPUID: */
@@ -174,7 +176,7 @@ extern void cpu_detect(struct cpuinfo_x86 *c);
static inline unsigned long l1tf_pfn_limit(void)
{
- return BIT(boot_cpu_data.x86_phys_bits - 1 - PAGE_SHIFT) - 1;
+ return BIT_ULL(boot_cpu_data.x86_cache_bits - 1 - PAGE_SHIFT);
}
extern void early_cpu_init(void);
diff --git a/arch/x86/kernel/cpu/bugs.c b/arch/x86/kernel/cpu/bugs.c
index 34e4aaaf03d2..2a41a86aa5c2 100644
--- a/arch/x86/kernel/cpu/bugs.c
+++ b/arch/x86/kernel/cpu/bugs.c
@@ -634,6 +634,46 @@ void x86_spec_ctrl_setup_ap(void)
#undef pr_fmt
#define pr_fmt(fmt) "L1TF: " fmt
+
+/*
+ * These CPUs all support 44bits physical address space internally in the
+ * cache but CPUID can report a smaller number of physical address bits.
+ *
+ * The L1TF mitigation uses the top most address bit for the inversion of
+ * non present PTEs. When the installed memory reaches into the top most
+ * address bit due to memory holes, which has been observed on machines
+ * which report 36bits physical address bits and have 32G RAM installed,
+ * then the mitigation range check in l1tf_select_mitigation() triggers.
+ * This is a false positive because the mitigation is still possible due to
+ * the fact that the cache uses 44bit internally. Use the cache bits
+ * instead of the reported physical bits and adjust them on the affected
+ * machines to 44bit if the reported bits are less than 44.
+ */
+static void override_cache_bits(struct cpuinfo_x86 *c)
+{
+ if (c->x86 != 6)
+ return;
+
+ switch (c->x86_model) {
+ case INTEL_FAM6_NEHALEM:
+ case INTEL_FAM6_WESTMERE:
+ case INTEL_FAM6_SANDYBRIDGE:
+ case INTEL_FAM6_IVYBRIDGE:
+ case INTEL_FAM6_HASWELL_CORE:
+ case INTEL_FAM6_HASWELL_ULT:
+ case INTEL_FAM6_HASWELL_GT3E:
+ case INTEL_FAM6_BROADWELL_CORE:
+ case INTEL_FAM6_BROADWELL_GT3E:
+ case INTEL_FAM6_SKYLAKE_MOBILE:
+ case INTEL_FAM6_SKYLAKE_DESKTOP:
+ case INTEL_FAM6_KABYLAKE_MOBILE:
+ case INTEL_FAM6_KABYLAKE_DESKTOP:
+ if (c->x86_cache_bits < 44)
+ c->x86_cache_bits = 44;
+ break;
+ }
+}
+
static void __init l1tf_select_mitigation(void)
{
u64 half_pa;
@@ -641,16 +681,13 @@ static void __init l1tf_select_mitigation(void)
if (!boot_cpu_has_bug(X86_BUG_L1TF))
return;
+ override_cache_bits(&boot_cpu_data);
+
#if CONFIG_PGTABLE_LEVELS == 2
pr_warn("Kernel not compiled for PAE. No mitigation for L1TF\n");
return;
#endif
- /*
- * This is extremely unlikely to happen because almost all
- * systems have far more MAX_PA/2 than RAM can be fit into
- * DIMM slots.
- */
half_pa = (u64)l1tf_pfn_limit() << PAGE_SHIFT;
if (e820_any_mapped(half_pa, ULLONG_MAX - half_pa, E820_RAM)) {
pr_warn("System has more than MAX_PA/2 memory. L1TF mitigation not effective.\n");
diff --git a/arch/x86/kernel/cpu/common.c b/arch/x86/kernel/cpu/common.c
index 4d3fa79c0f09..b12c0287d6cf 100644
--- a/arch/x86/kernel/cpu/common.c
+++ b/arch/x86/kernel/cpu/common.c
@@ -798,6 +798,8 @@ void get_cpu_cap(struct cpuinfo_x86 *c)
c->x86_phys_bits = 36;
#endif
+ c->x86_cache_bits = c->x86_phys_bits;
+
if (c->extended_cpuid_level >= 0x8000000a)
c->x86_capability[CPUID_8000_000A_EDX] = cpuid_edx(0x8000000a);
--
2.17.1
From: Jason Wang <jasowang(a)redhat.com>
commit b196d88aba8ac72b775137854121097f4c4c6862 upstream.
We used to initialize ptr_ring during TUNSETIFF, this is because its
size depends on the tx_queue_len of netdevice. And we try to clean it
up when socket were detached from netdevice. A race were spotted when
trying to do uninit during a read which will lead a use after free for
pointer ring. Solving this by always initialize a zero size ptr_ring
in open() and do resizing during TUNSETIFF, and then we can safely do
cleanup during close(). With this, there's no need for the workaround
that was introduced by commit 4df0bfc79904 ("tun: fix a memory leak
for tfile->tx_array").
Backport Note :-
Comparison with the upstream patch:
[1] A "semantic revert" of the changes made in
4df0bfc799("tun: fix a memory leak for tfile->tx_array").
4df0bfc799 was applied upstream, and then skb array was changed
to use ptr_ring. The upstream patch then removes the changes introduced
by 4df0bfc799. This backport does the same; "revert" the changes
made by 4df0bfc799.
[2] xdp_rxq_info_unreg() being called in relevant locations
As xdp_rxq_info related patches are not present in 4.14, these
changes are not needed in the backport.
[3] An instance of ptr_ring_init needs to be replaced by skb_array_init
Inside tun_attach()
[4] ptr_ring_cleanup needs to be replaced by skb_array_cleanup
Inside tun_chr_close()
Note that the backport for 7063efd33b ("tuntap: fix use after free during release")
needs to be applied on top of this patch.
Reported-by: syzbot+e8b902c3c3fadf0a9dba(a)syzkaller.appspotmail.com
Cc: Eric Dumazet <eric.dumazet(a)gmail.com>
Cc: Cong Wang <xiyou.wangcong(a)gmail.com>
Cc: Michael S. Tsirkin <mst(a)redhat.com>
Fixes: 1576d9860599 ("tun: switch to use skb array for tx")
Signed-off-by: Jason Wang <jasowang(a)redhat.com>
Acked-by: Michael S. Tsirkin <mst(a)redhat.com>
Signed-off-by: David S. Miller <davem(a)davemloft.net>
Signed-off-by: Zubin Mithra <zsm(a)chromium.org>
---
drivers/net/tun.c | 21 +++++++--------------
1 file changed, 7 insertions(+), 14 deletions(-)
diff --git a/drivers/net/tun.c b/drivers/net/tun.c
index cb17ffadfc30..87a989be1cef 100644
--- a/drivers/net/tun.c
+++ b/drivers/net/tun.c
@@ -534,14 +534,6 @@ static void tun_queue_purge(struct tun_file *tfile)
skb_queue_purge(&tfile->sk.sk_error_queue);
}
-static void tun_cleanup_tx_array(struct tun_file *tfile)
-{
- if (tfile->tx_array.ring.queue) {
- skb_array_cleanup(&tfile->tx_array);
- memset(&tfile->tx_array, 0, sizeof(tfile->tx_array));
- }
-}
-
static void __tun_detach(struct tun_file *tfile, bool clean)
{
struct tun_file *ntfile;
@@ -583,7 +575,6 @@ static void __tun_detach(struct tun_file *tfile, bool clean)
tun->dev->reg_state == NETREG_REGISTERED)
unregister_netdevice(tun->dev);
}
- tun_cleanup_tx_array(tfile);
sock_put(&tfile->sk);
}
}
@@ -623,13 +614,11 @@ static void tun_detach_all(struct net_device *dev)
/* Drop read queue */
tun_queue_purge(tfile);
sock_put(&tfile->sk);
- tun_cleanup_tx_array(tfile);
}
list_for_each_entry_safe(tfile, tmp, &tun->disabled, next) {
tun_enable_queue(tfile);
tun_queue_purge(tfile);
sock_put(&tfile->sk);
- tun_cleanup_tx_array(tfile);
}
BUG_ON(tun->numdisabled != 0);
@@ -675,7 +664,7 @@ static int tun_attach(struct tun_struct *tun, struct file *file, bool skip_filte
}
if (!tfile->detached &&
- skb_array_init(&tfile->tx_array, dev->tx_queue_len, GFP_KERNEL)) {
+ skb_array_resize(&tfile->tx_array, dev->tx_queue_len, GFP_KERNEL)) {
err = -ENOMEM;
goto out;
}
@@ -2624,6 +2613,11 @@ static int tun_chr_open(struct inode *inode, struct file * file)
&tun_proto, 0);
if (!tfile)
return -ENOMEM;
+ if (skb_array_init(&tfile->tx_array, 0, GFP_KERNEL)) {
+ sk_free(&tfile->sk);
+ return -ENOMEM;
+ }
+
RCU_INIT_POINTER(tfile->tun, NULL);
tfile->flags = 0;
tfile->ifindex = 0;
@@ -2644,8 +2638,6 @@ static int tun_chr_open(struct inode *inode, struct file * file)
sock_set_flag(&tfile->sk, SOCK_ZEROCOPY);
- memset(&tfile->tx_array, 0, sizeof(tfile->tx_array));
-
return 0;
}
@@ -2654,6 +2646,7 @@ static int tun_chr_close(struct inode *inode, struct file *file)
struct tun_file *tfile = file->private_data;
tun_detach(tfile, true);
+ skb_array_cleanup(&tfile->tx_array);
return 0;
}
--
2.19.0.rc1.350.ge57e33dbd1-goog
This is the start of the stable review cycle for the 4.4.144 release.
There are 107 patches in this series, all will be posted as a response
to this one. If anyone has any issues with these being applied, please
let me know.
Responses should be made by Wed Jul 25 12:23:53 UTC 2018.
Anything received after that time might be too late.
The whole patch series can be found in one patch at:
https://www.kernel.org/pub/linux/kernel/v4.x/stable-review/patch-4.4.144-rc…
or in the git tree and branch at:
git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable-rc.git linux-4.4.y
and the diffstat can be found below.
thanks,
greg k-h
-------------
Pseudo-Shortlog of commits:
Greg Kroah-Hartman <gregkh(a)linuxfoundation.org>
Linux 4.4.144-rc1
Sascha Hauer <s.hauer(a)pengutronix.de>
ubi: fastmap: Erase outdated anchor PEBs during attach
Richard Weinberger <richard(a)nod.at>
ubi: Fix Fastmap's update_vol()
Richard Weinberger <richard(a)nod.at>
ubi: Fix races around ubi_refill_pools()
Richard Weinberger <richard(a)nod.at>
ubi: Be more paranoid while seaching for the most recent Fastmap
Richard Weinberger <richard(a)nod.at>
ubi: Rework Fastmap attach base code
Richard Weinberger <richard(a)nod.at>
ubi: Introduce vol_ignored()
Lucas Stach <dev(a)lynxeye.de>
clk: tegra: Fix PLL_U post divider and initial rate on Tegra30
Alan Jenkins <alan.christopher.jenkins(a)gmail.com>
block: do not use interruptible wait anywhere
Andy Lutomirski <luto(a)kernel.org>
x86/cpu: Re-apply forced caps every time CPU caps are re-read
Juergen Gross <jgross(a)suse.com>
x86/xen: Add call of speculative_store_bypass_ht_init() to PV paths
Konrad Rzeszutek Wilk <konrad.wilk(a)oracle.com>
x86/bugs: Rename SSBD_NO to SSB_NO
Thomas Gleixner <tglx(a)linutronix.de>
x86/speculation, KVM: Implement support for VIRT_SPEC_CTRL/LS_CFG
Thomas Gleixner <tglx(a)linutronix.de>
x86/bugs: Rework spec_ctrl base and mask logic
Thomas Gleixner <tglx(a)linutronix.de>
x86/bugs: Remove x86_spec_ctrl_set()
Thomas Gleixner <tglx(a)linutronix.de>
x86/bugs: Expose x86_spec_ctrl_base directly
Borislav Petkov <bp(a)suse.de>
x86/bugs: Unify x86_spec_ctrl_{set_guest, restore_host}
Thomas Gleixner <tglx(a)linutronix.de>
x86/speculation: Rework speculative_store_bypass_update()
Tom Lendacky <thomas.lendacky(a)amd.com>
x86/speculation: Add virtualized speculative store bypass disable support
Thomas Gleixner <tglx(a)linutronix.de>
x86/bugs, KVM: Extend speculation control for VIRT_SPEC_CTRL
Thomas Gleixner <tglx(a)linutronix.de>
x86/speculation: Handle HT correctly on AMD
Thomas Gleixner <tglx(a)linutronix.de>
x86/cpufeatures: Add FEATURE_ZEN
Borislav Petkov <bp(a)suse.de>
x86/cpu/AMD: Fix erratum 1076 (CPB bit)
Thomas Gleixner <tglx(a)linutronix.de>
x86/cpufeatures: Disentangle SSBD enumeration
Thomas Gleixner <tglx(a)linutronix.de>
x86/cpufeatures: Disentangle MSR_SPEC_CTRL enumeration from IBRS
Borislav Petkov <bp(a)suse.de>
x86/speculation: Use synthetic bits for IBRS/IBPB/STIBP
Jim Mattson <jmattson(a)google.com>
x86/cpu: Make alternative_msr_write work for 32-bit code
Konrad Rzeszutek Wilk <konrad.wilk(a)oracle.com>
x86/bugs: Fix the parameters alignment and missing void
Jiri Kosina <jkosina(a)suse.cz>
x86/bugs: Make cpu_show_common() static
Jiri Kosina <jkosina(a)suse.cz>
x86/bugs: Fix __ssb_select_mitigation() return type
Borislav Petkov <bp(a)suse.de>
Documentation/spec_ctrl: Do some minor cleanups
Konrad Rzeszutek Wilk <konrad.wilk(a)oracle.com>
proc: Use underscores for SSBD in 'status'
Konrad Rzeszutek Wilk <konrad.wilk(a)oracle.com>
x86/bugs: Rename _RDS to _SSBD
Kees Cook <keescook(a)chromium.org>
x86/speculation: Make "seccomp" the default mode for Speculative Store Bypass
Thomas Gleixner <tglx(a)linutronix.de>
seccomp: Move speculation migitation control to arch code
Kees Cook <keescook(a)chromium.org>
seccomp: Add filter flag to opt-out of SSB mitigation
Thomas Gleixner <tglx(a)linutronix.de>
seccomp: Use PR_SPEC_FORCE_DISABLE
Thomas Gleixner <tglx(a)linutronix.de>
prctl: Add force disable speculation
Kees Cook <keescook(a)chromium.org>
seccomp: Enable speculation flaw mitigations
Kees Cook <keescook(a)chromium.org>
proc: Provide details on speculation flaw mitigations
Kees Cook <keescook(a)chromium.org>
nospec: Allow getting/setting on non-current task
Thomas Gleixner <tglx(a)linutronix.de>
x86/speculation: Add prctl for Speculative Store Bypass mitigation
Thomas Gleixner <tglx(a)linutronix.de>
x86/process: Allow runtime control of Speculative Store Bypass
Thomas Gleixner <tglx(a)linutronix.de>
x86/process: Optimize TIF_NOTSC switch
Kyle Huey <me(a)kylehuey.com>
x86/process: Correct and optimize TIF_BLOCKSTEP switch
Kyle Huey <me(a)kylehuey.com>
x86/process: Optimize TIF checks in __switch_to_xtra()
Thomas Gleixner <tglx(a)linutronix.de>
prctl: Add speculation control prctls
Thomas Gleixner <tglx(a)linutronix.de>
x86/speculation: Create spec-ctrl.h to avoid include hell
David Woodhouse <dwmw(a)amazon.co.uk>
x86/bugs/AMD: Add support to disable RDS on Fam[15, 16, 17]h if requested
Konrad Rzeszutek Wilk <konrad.wilk(a)oracle.com>
x86/bugs: Whitelist allowed SPEC_CTRL MSR values
Konrad Rzeszutek Wilk <konrad.wilk(a)oracle.com>
x86/bugs/intel: Set proper CPU features and setup RDS
Konrad Rzeszutek Wilk <konrad.wilk(a)oracle.com>
x86/bugs: Provide boot parameters for the spec_store_bypass_disable mitigation
Konrad Rzeszutek Wilk <konrad.wilk(a)oracle.com>
x86/cpufeatures: Add X86_FEATURE_RDS
Konrad Rzeszutek Wilk <konrad.wilk(a)oracle.com>
x86/bugs: Expose /sys/../spec_store_bypass
Piotr Luc <piotr.luc(a)intel.com>
x86/cpu/intel: Add Knights Mill to Intel family
Andy Shevchenko <andriy.shevchenko(a)linux.intel.com>
x86/cpu: Rename Merrifield2 to Moorefield
Konrad Rzeszutek Wilk <konrad.wilk(a)oracle.com>
x86/bugs, KVM: Support the combination of guest and host IBRS
Konrad Rzeszutek Wilk <konrad.wilk(a)oracle.com>
x86/bugs: Read SPEC_CTRL MSR during boot and re-use reserved bits
Konrad Rzeszutek Wilk <konrad.wilk(a)oracle.com>
x86/bugs: Concentrate bug reporting into a separate function
Konrad Rzeszutek Wilk <konrad.wilk(a)oracle.com>
x86/bugs: Concentrate bug detection into a separate function
Linus Torvalds <torvalds(a)linux-foundation.org>
x86/nospec: Simplify alternative_msr_write()
David Woodhouse <dwmw(a)amazon.co.uk>
x86/amd: don't set X86_BUG_SYSRET_SS_ATTRS when running under Xen
Juergen Gross <jgross(a)suse.com>
xen: set cpu capabilities from xen_start_kernel()
Mickaël Salaün <mic(a)digikod.net>
selftest/seccomp: Fix the seccomp(2) signature
Mickaël Salaün <mic(a)digikod.net>
selftest/seccomp: Fix the flag name SECCOMP_FILTER_FLAG_TSYNC
Alexander Sergeyev <sergeev917(a)gmail.com>
x86/speculation: Remove Skylake C2 from Speculation Control microcode blacklist
Ingo Molnar <mingo(a)kernel.org>
x86/speculation: Move firmware_restrict_branch_speculation_*() from C to CPP
David Woodhouse <dwmw(a)amazon.co.uk>
x86/speculation: Use IBRS if available before calling into firmware
Konrad Rzeszutek Wilk <konrad.wilk(a)oracle.com>
x86/spectre_v2: Don't check microcode versions when running under hypervisors
Tim Chen <tim.c.chen(a)linux.intel.com>
x86/speculation: Use Indirect Branch Prediction Barrier in context switch
Andy Lutomirski <luto(a)kernel.org>
x86/mm: Give each mm TLB flush generation a unique ID
Dave Hansen <dave.hansen(a)linux.intel.com>
x86/mm: Factor out LDT init from context init
Juergen Gross <jgross(a)suse.com>
x86/xen: Zero MSR_IA32_SPEC_CTRL before suspend
Peter Zijlstra <peterz(a)infradead.org>
x86/speculation: Add <asm/msr-index.h> dependency
Dan Williams <dan.j.williams(a)intel.com>
x86/speculation: Fix up array_index_nospec_mask() asm constraint
Ingo Molnar <mingo(a)kernel.org>
x86/speculation: Clean up various Spectre related details
David Woodhouse <dwmw(a)amazon.co.uk>
x86/speculation: Correct Speculation Control microcode blacklist again
David Woodhouse <dwmw(a)amazon.co.uk>
x86/speculation: Update Speculation Control microcode blacklist
Dan Williams <dan.j.williams(a)intel.com>
x86/entry/64/compat: Clear registers for compat syscalls, to reduce speculation attack surface
Denys Vlasenko <dvlasenk(a)redhat.com>
x86/asm/entry/32: Simplify pushes of zeroed pt_regs->REGs
Arnd Bergmann <arnd(a)arndb.de>
x86/pti: Mark constant arrays as __initconst
David Woodhouse <dwmw(a)amazon.co.uk>
x86/cpuid: Fix up "virtual" IBRS/IBPB/STIBP feature bits on Intel
David Woodhouse <dwmw(a)amazon.co.uk>
x86/cpufeatures: Clean up Spectre v2 related CPUID flags
David Woodhouse <dwmw(a)amazon.co.uk>
x86/speculation: Add basic IBPB (Indirect Branch Prediction Barrier) support
David Woodhouse <dwmw(a)amazon.co.uk>
x86/cpufeature: Blacklist SPEC_CTRL/PRED_CMD on early Spectre v2 microcodes
David Woodhouse <dwmw(a)amazon.co.uk>
x86/pti: Do not enable PTI on CPUs which are not vulnerable to Meltdown
David Woodhouse <dwmw(a)amazon.co.uk>
x86/msr: Add definitions for new speculation control MSRs
David Woodhouse <dwmw(a)amazon.co.uk>
x86/cpufeatures: Add AMD feature bits for Speculation Control
David Woodhouse <dwmw(a)amazon.co.uk>
x86/cpufeatures: Add Intel feature bits for Speculation Control
David Woodhouse <dwmw(a)amazon.co.uk>
x86/cpufeatures: Add CPUID_7_EDX CPUID leaf
Nick Desaulniers <ndesaulniers(a)google.com>
x86/paravirt: Make native_save_fl() extern inline
Mathias Nyman <mathias.nyman(a)linux.intel.com>
xhci: Fix perceived dead host due to runtime suspend race with event handler
Stefano Brivio <sbrivio(a)redhat.com>
skbuff: Unconditionally copy pfmemalloc in __skb_clone()
Stefano Brivio <sbrivio(a)redhat.com>
net: Don't copy pfmemalloc flag in __copy_skb_header()
Sanjeev Bansal <sanjeevb.bansal(a)broadcom.com>
tg3: Add higher cpu clock for 5762.
Gustavo A. R. Silva <gustavo(a)embeddedor.com>
ptp: fix missing break in switch
Heiner Kallweit <hkallweit1(a)gmail.com>
net: phy: fix flag masking in __set_phy_supported
David Ahern <dsahern(a)gmail.com>
net/ipv4: Set oif in fib_compute_spec_dst
Davidlohr Bueso <dave(a)stgolabs.net>
lib/rhashtable: consider param->min_size when setting initial table size
Colin Ian King <colin.king(a)canonical.com>
ipv6: fix useless rol32 call on hash
Tyler Hicks <tyhicks(a)canonical.com>
ipv4: Return EINVAL when ping_group_range sysctl doesn't map to user ns
Jing Xia <jing.xia.mail(a)gmail.com>
mm: memcg: fix use after free in mem_cgroup_iter()
Vineet Gupta <vgupta(a)synopsys.com>
ARC: mm: allow mprotect to make stack mappings executable
Alexey Brodkin <abrodkin(a)synopsys.com>
ARC: Fix CONFIG_SWAP
Takashi Iwai <tiwai(a)suse.de>
ALSA: rawmidi: Change resized buffers atomically
OGAWA Hirofumi <hirofumi(a)mail.parknet.co.jp>
fat: fix memory allocation failure handling of match_strdup()
Dewet Thibaut <thibaut.dewet(a)nokia.com>
x86/MCE: Remove min interval polling limitation
Lan Tianyu <tianyu.lan(a)intel.com>
KVM/Eventfd: Avoid crash when assign and deassign specific eventfd in parallel.
-------------
Diffstat:
Documentation/ABI/testing/sysfs-devices-system-cpu | 1 +
Documentation/kernel-parameters.txt | 45 +++
Documentation/spec_ctrl.txt | 94 +++++
Makefile | 4 +-
arch/arc/include/asm/page.h | 2 +-
arch/arc/include/asm/pgtable.h | 2 +-
arch/x86/entry/entry_64_compat.S | 75 ++--
arch/x86/include/asm/apm.h | 6 +
arch/x86/include/asm/barrier.h | 2 +-
arch/x86/include/asm/cpufeature.h | 7 +-
arch/x86/include/asm/cpufeatures.h | 37 +-
arch/x86/include/asm/disabled-features.h | 3 +-
arch/x86/include/asm/efi.h | 7 +
arch/x86/include/asm/intel-family.h | 10 +-
arch/x86/include/asm/irqflags.h | 2 +-
arch/x86/include/asm/mmu.h | 15 +-
arch/x86/include/asm/mmu_context.h | 25 +-
arch/x86/include/asm/msr-index.h | 22 ++
arch/x86/include/asm/nospec-branch.h | 54 +++
arch/x86/include/asm/required-features.h | 3 +-
arch/x86/include/asm/spec-ctrl.h | 80 ++++
arch/x86/include/asm/thread_info.h | 6 +-
arch/x86/include/asm/tlbflush.h | 12 +
arch/x86/kernel/Makefile | 1 +
arch/x86/kernel/cpu/amd.c | 38 +-
arch/x86/kernel/cpu/bugs.c | 427 +++++++++++++++++++--
arch/x86/kernel/cpu/common.c | 121 +++++-
arch/x86/kernel/cpu/cpu.h | 3 +
arch/x86/kernel/cpu/intel.c | 73 ++++
arch/x86/kernel/cpu/mcheck/mce.c | 3 -
arch/x86/kernel/irqflags.S | 26 ++
arch/x86/kernel/ldt.c | 4 +-
arch/x86/kernel/process.c | 224 +++++++++--
arch/x86/kernel/smpboot.c | 5 +
arch/x86/kvm/svm.c | 2 +-
arch/x86/kvm/vmx.c | 2 +-
arch/x86/mm/tlb.c | 33 ++
arch/x86/platform/efi/efi_64.c | 3 +
arch/x86/xen/enlighten.c | 16 +-
arch/x86/xen/smp.c | 5 +
arch/x86/xen/suspend.c | 16 +
block/blk-core.c | 10 +-
drivers/base/cpu.c | 8 +
drivers/clk/tegra/clk-tegra30.c | 11 +-
drivers/mtd/ubi/attach.c | 139 +++++--
drivers/mtd/ubi/eba.c | 4 +-
drivers/mtd/ubi/fastmap-wl.c | 6 +-
drivers/mtd/ubi/fastmap.c | 51 ++-
drivers/mtd/ubi/ubi.h | 46 ++-
drivers/mtd/ubi/wl.c | 114 ++++--
drivers/net/ethernet/broadcom/tg3.c | 9 +
drivers/net/phy/phy_device.c | 7 +-
drivers/ptp/ptp_chardev.c | 1 +
drivers/usb/host/xhci.c | 40 +-
drivers/usb/host/xhci.h | 4 +
fs/fat/inode.c | 20 +-
fs/proc/array.c | 26 ++
include/linux/cpu.h | 2 +
include/linux/nospec.h | 10 +
include/linux/sched.h | 9 +
include/linux/seccomp.h | 3 +-
include/linux/skbuff.h | 12 +-
include/net/ipv6.h | 2 +-
include/uapi/linux/prctl.h | 12 +
include/uapi/linux/seccomp.h | 4 +-
kernel/seccomp.c | 21 +-
kernel/sys.c | 21 +
lib/rhashtable.c | 17 +-
mm/memcontrol.c | 2 +-
net/core/skbuff.c | 1 +
net/ipv4/fib_frontend.c | 1 +
net/ipv4/sysctl_net_ipv4.c | 5 +-
sound/core/rawmidi.c | 20 +-
tools/testing/selftests/seccomp/seccomp_bpf.c | 98 ++++-
virt/kvm/eventfd.c | 6 +-
75 files changed, 1982 insertions(+), 276 deletions(-)
Hello Greg,
Can you please consider including the following two patches
in the stable linux-4.14.y branch?
This is to avoid page faults in do_swap_page() on PV guests,
usually seen on __radix_tree_lookup() [1].
f7c90c2aa400 ("x86/xen: don't write ptes directly in 32-bit PV guests")
b2d7a075a1cc ("x86/pae: use 64 bit atomic xchg function in native_ptep_get_and_clear")
Thanks,
[1] - more details on https://bugzilla.kernel.org/show_bug.cgi?id=198497
--
All the best,
Eduardo Valentin
Hi Greg,
This patch is not marked for 4.4-stable, but it's already in 4.9 and 4.14 stable.
Please apply to 4.4-stable.
This patch adds necessary function when removing driver.
--
SZ Lin (林上智)
Hi Greg,
This patch is not marked for 4.4-stable, but it's already in 4.9 and 4.14 stable.
Please apply to 4.4-stable.
This patch fixed leak of mdio device reference.
--
SZ Lin (林上智)
Hi,
This patch is not marked for 4.4-stable, but it's already in 4.9 and 4.14 stable.
Please apply to 4.4-stable.
This patch fixed parsing of phy-handle DT property in dual_emac config.
--
SZ Lin (林上智)
e466af75c074 ("netfilter: x_tables: avoid stack-out-of-bounds read in
xt_copy_counters_from_user") fixes an out-of-bounds read that happens
when a userspace-controlled value is not NULL terminated. It looks like
the fix was taken into 3.16.y but not kernels after it.
From: Mathias Nyman <mathias.nyman(a)linux.intel.com>
commit 44a182b9d17765514fa2b1cc911e4e65134eef93 upstream.
KASAN found a use-after-free in xhci_free_virt_device+0x33b/0x38e
where xhci_free_virt_device() sets slot id to 0 if udev exists:
if (dev->udev && dev->udev->slot_id)
dev->udev->slot_id = 0;
dev->udev will be true even if udev is freed because dev->udev is
not set to NULL.
set dev->udev pointer to NULL in xhci_free_dev()
The original patch went to stable so this fix needs to be applied
there as well.
Fixes: a400efe455f7 ("xhci: zero usb device slot_id member when disabling and freeing a xhci slot")
Cc: <stable(a)vger.kernel.org>
Reported-by: Guenter Roeck <linux(a)roeck-us.net>
Reviewed-by: Guenter Roeck <linux(a)roeck-us.net>
Tested-by: Guenter Roeck <linux(a)roeck-us.net>
Signed-off-by: Mathias Nyman <mathias.nyman(a)linux.intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh(a)linuxfoundation.org>
Signed-off-by: Matthias Kaehlcke <mka(a)chromium.org>
---
The original fix has been integrated into some recent -stable versions,
but wasn't backported to older LTS kernel like v4.9 or v4.4. The context
in xhci_free_dev() changed a bit because upstream added
xhci_disable_slot().
drivers/usb/host/xhci.c | 3 +++
1 file changed, 3 insertions(+)
diff --git a/drivers/usb/host/xhci.c b/drivers/usb/host/xhci.c
index c190fabd1875..e9f5f9c32b49 100644
--- a/drivers/usb/host/xhci.c
+++ b/drivers/usb/host/xhci.c
@@ -3656,6 +3656,9 @@ void xhci_free_dev(struct usb_hcd *hcd, struct usb_device *udev)
}
spin_lock_irqsave(&xhci->lock, flags);
+
+ virt_dev->udev = NULL;
+
/* Don't disable the slot if the host controller is dead. */
state = readl(&xhci->op_regs->status);
if (state == 0xffffffff || (xhci->xhc_state & XHCI_STATE_DYING) ||
--
2.19.0.397.gdd90340f6a-goog
Hi stable-maintainers,
Hi Greg,
it seems that the patch to fix early boot stalling with Intel Core 2
processors, which Linus' already applied to his tree and could be
found in >=4.19-rc3, somehow missed the CC: line for linux-stable to
pick it up. As of now 4.18.8-rc1 does not include it.
The latest kernel version unaffected by this issues is 4.17.19, so a
backport to 4.18.y should be enough.
Thank you for all your hard work,
Siegfried
commit 6209c285e7a5e68dbcdf8fd2456c6dd68433806b upstream.
Since Haswell we have no color range indication either in the pipe or
port registers for DP. Instead, there's a separate register for setting
the DP Main Stream Attributes (MSA) directly. The MSA register
definition makes no references to colorimetry, just a vague reference to
the DP spec. The connection to the color range was lost.
Apparently we've failed to set the proper MSA bit for limited, or CEA,
range ever since the first DDI platforms. We've started setting other
MSA parameters since commit dae847991a43 ("drm/i915: add
intel_ddi_set_pipe_settings").
Without the crucial bit of information, the DP sink has no way of
knowing the source is actually transmitting limited range RGB, leading
to "washed out" colors. With the colorimetry information, compliant
sinks should be able to handle the limited range properly. Native
(i.e. non-LSPCON) HDMI was not affected because we do pass the color
range via AVI infoframes.
Though not the root cause, the problem was made worse for DDI platforms
with commit 55bc60db5988 ("drm/i915: Add "Automatic" mode for the
"Broadcast RGB" property"), which selects limited range RGB
automatically based on the mode, as per the DP, HDMI and CEA specs.
After all these years, the fix boils down to flipping one bit.
[Per testing reports, this fixes DP sinks, but not the LSPCON. My
educated guess is that the LSPCON fails to turn the CEA range MSA into
AVI infoframes for HDMI.]
Reported-by: Michał Kopeć <mkopec12(a)gmail.com>
Reported-by: N. W. <nw9165-3201(a)yahoo.com>
Reported-by: Nicholas Stommel <nicholas.stommel(a)gmail.com>
Reported-by: Tom Yan <tom.ty89(a)gmail.com>
Tested-by: Nicholas Stommel <nicholas.stommel(a)gmail.com>
References: https://bugs.freedesktop.org/show_bug.cgi?id=100023
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=107476
Bugzilla: https://bugzilla.kernel.org/show_bug.cgi?id=94921
Cc: Paulo Zanoni <paulo.r.zanoni(a)intel.com>
Cc: Rodrigo Vivi <rodrigo.vivi(a)intel.com>
Cc: Ville Syrjälä <ville.syrjala(a)linux.intel.com>
Cc: <stable(a)vger.kernel.org> # v3.9+
Reviewed-by: Rodrigo Vivi <rodrigo.vivi(a)intel.com>
Signed-off-by: Jani Nikula <jani.nikula(a)intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20180814060001.18224-1-jani.n…
(cherry picked from commit dc5977da99ea28094b8fa4e9bacbd29bedc41de5)
Signed-off-by: Rodrigo Vivi <rodrigo.vivi(a)intel.com>
---
drivers/gpu/drm/i915/i915_reg.h | 1 +
drivers/gpu/drm/i915/intel_ddi.c | 4 ++++
2 files changed, 5 insertions(+)
diff --git a/drivers/gpu/drm/i915/i915_reg.h b/drivers/gpu/drm/i915/i915_reg.h
index c9bcc6c45012..b3f7ba3b11c5 100644
--- a/drivers/gpu/drm/i915/i915_reg.h
+++ b/drivers/gpu/drm/i915/i915_reg.h
@@ -8441,6 +8441,7 @@ enum skl_power_gate {
#define TRANS_MSA_10_BPC (2<<5)
#define TRANS_MSA_12_BPC (3<<5)
#define TRANS_MSA_16_BPC (4<<5)
+#define TRANS_MSA_CEA_RANGE (1<<3)
/* LCPLL Control */
#define LCPLL_CTL _MMIO(0x130040)
diff --git a/drivers/gpu/drm/i915/intel_ddi.c b/drivers/gpu/drm/i915/intel_ddi.c
index 5e5fe03b638c..3a4a581345c4 100644
--- a/drivers/gpu/drm/i915/intel_ddi.c
+++ b/drivers/gpu/drm/i915/intel_ddi.c
@@ -1396,6 +1396,10 @@ void intel_ddi_set_pipe_settings(const struct intel_crtc_state *crtc_state)
WARN_ON(transcoder_is_dsi(cpu_transcoder));
temp = TRANS_MSA_SYNC_CLK;
+
+ if (crtc_state->limited_color_range)
+ temp |= TRANS_MSA_CEA_RANGE;
+
switch (crtc_state->pipe_bpp) {
case 18:
temp |= TRANS_MSA_6_BPC;
--
2.11.0
adding stable@ for stable kernel issues...
On Thu, Sep 13, 2018 at 09:58:35AM +0200, Koen Vandeputte wrote:
> Hi all,
>
> I'm currently in the process of updating the kernel version within OpenWrt.
> (4.14.68 to 4.14.69)
>
> Testing shows some issues on devices using specifically UBIFS.
> Altering a perfect valid writable file shows weird errors:
>
>
> [ Node 2 | node-2 ] ls -l /root/custom/scripts/banner.sh
> -rwxr-xr-x 1 root root 283 Sep 11 09:52
> /root/custom/scripts/banner.sh
>
> [ Node 2 | node-2 ] cat /root/custom/scripts/banner.sh
> #!/bin/sh
>
> if [ ! -f /root/.banner_ok ]
> then
> RELEASE=$(cat /root/build_date)
> VERSION=$(cat /root/version)
>
> echo "Generating banner: $VERSION $RELEASE"
> sed s/VERSION/$VERSION/g /root/custom/banner > /etc/banner
> sed -i s/RELEASE/$RELEASE/g /etc/banner
>
> touch /root/.banner_ok
> fi
>
> [ Node 2 | node-2 ] echo "test" > /root/custom/scripts/banner.sh
> -ash: can't create /root/custom/scripts/banner.sh: nonexistent directory
>
>
>
> I'm also noticing other apps fail because /etc doesn't exists yet after
> UBIFS boot loading.
> these 2 issues were not seen on 4.14.68.
>
> The bootlog doesn't show any error:
> https://pastebin.com/raw/dJx47uBp
>
>
> I'm only seeing these issues on UBIFS enabled volumes.
> Reverting ("ubifs: xattr: Don't operate on deleted inodes") fixes these
> weird issues.
Do you also have the same problem on Linus's latest tree, or 4.18, with
this change in the tree?
thanks,
greg k-h
The patch below does not apply to the 4.18-stable tree.
If someone wants it applied there, or to any other stable or longterm
tree, then please email the backport, including the original git commit
id to <stable(a)vger.kernel.org>.
thanks,
greg k-h
------------------ original commit in Linus's tree ------------------
>From c83532fb0fe053d2e43e9387354cb1b52ba26427 Mon Sep 17 00:00:00 2001
From: Alexey Brodkin <abrodkin(a)synopsys.com>
Date: Thu, 2 Aug 2018 11:50:16 +0300
Subject: [PATCH] ARC: [plat-axs*]: Enable SWAP
SWAP support on ARC was fixed earlier by
commit 6e3761145a9b ("ARC: Fix CONFIG_SWAP")
so now we may safely enable it on platforms that
have external media like USB and SD-card.
Note: it was already allowed for HSDK
Signed-off-by: Alexey Brodkin <abrodkin(a)synopsys.com>
Cc: stable(a)vger.kernel.org # 6e3761145a9b: ARC: Fix CONFIG_SWAP
Signed-off-by: Vineet Gupta <vgupta(a)synopsys.com>
diff --git a/arch/arc/configs/axs101_defconfig b/arch/arc/configs/axs101_defconfig
index 41a97eb7598d..41bc08be6a3b 100644
--- a/arch/arc/configs/axs101_defconfig
+++ b/arch/arc/configs/axs101_defconfig
@@ -1,4 +1,3 @@
-# CONFIG_SWAP is not set
CONFIG_SYSVIPC=y
CONFIG_POSIX_MQUEUE=y
# CONFIG_CROSS_MEMORY_ATTACH is not set
diff --git a/arch/arc/configs/axs103_defconfig b/arch/arc/configs/axs103_defconfig
index d8e2ca2385cc..1e1c4a8011b5 100644
--- a/arch/arc/configs/axs103_defconfig
+++ b/arch/arc/configs/axs103_defconfig
@@ -1,4 +1,3 @@
-# CONFIG_SWAP is not set
CONFIG_SYSVIPC=y
CONFIG_POSIX_MQUEUE=y
# CONFIG_CROSS_MEMORY_ATTACH is not set
diff --git a/arch/arc/configs/axs103_smp_defconfig b/arch/arc/configs/axs103_smp_defconfig
index 1e729b9726cd..6b0c0cfd5c30 100644
--- a/arch/arc/configs/axs103_smp_defconfig
+++ b/arch/arc/configs/axs103_smp_defconfig
@@ -1,4 +1,3 @@
-# CONFIG_SWAP is not set
CONFIG_SYSVIPC=y
CONFIG_POSIX_MQUEUE=y
# CONFIG_CROSS_MEMORY_ATTACH is not set
On 1/20/2018 2:44 AM, Herbert Xu wrote:
> On Mon, Jan 15, 2018 at 05:07:22PM +0100, Arnd Bergmann wrote:
>> My last bugfix added -Os on the command line, which unfortunately caused
>> a build regression on powerpc in some configurations.
>>
>> I've done some more analysis of the original problem and found slightly
>> different workaround that avoids this regression and also results in
>> better performance on gcc-7.0: -fcode-hoisting is an optimization step
>> that got added in gcc-7 and that for all gcc-7 versions causes worse
>> performance.
>>
>> This disables -fcode-hoisting on all compilers that understand the option.
>> For gcc-7.1 and 7.2 I found the same performance as my previous patch
>> (using -Os), in gcc-7.0 it was even better. On gcc-8 I could see no
>> change in performance from this patch. In theory, code hoisting should
>> not be able make things better for the AES cipher, so leaving it
>> disabled for gcc-8 only serves to simplify the Makefile change.
>>
>> Reported-by: kbuild test robot <fengguang.wu(a)intel.com>
>> Link: https://www.mail-archive.com/linux-crypto@vger.kernel.org/msg30418.html
>> Link: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=83356
>> Link: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=83651
>> Fixes: 148b974deea9 ("crypto: aes-generic - build with -Os on gcc-7+")
>> Signed-off-by: Arnd Bergmann <arnd(a)arndb.de>
>
> Patch applied. Thanks.
>
This fix ("commit 6e36719fbe90213fbba9f50093fa2d4d69b0e93c upstream") is needed
also in 4.14.y stable tree, since it contains commit
7cae67e31292 ("crypto: aes-generic - build with -Os on gcc-7+")
Compilation fails without it:
crypto/aes_generic.o: In function `crypto_aes_set_key':
crypto/aes_generic.c:1300: undefined reference to `_restgpr_31_x'
Thanks,
Horia
This is the start of the stable review cycle for the 4.18.8 release.
There are 197 patches in this series, all will be posted as a response
to this one. If anyone has any issues with these being applied, please
let me know.
Responses should be made by Sat Sep 15 13:17:57 UTC 2018.
Anything received after that time might be too late.
The whole patch series can be found in one patch at:
https://www.kernel.org/pub/linux/kernel/v4.x/stable-review/patch-4.18.8-rc1…
or in the git tree and branch at:
git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable-rc.git linux-4.18.y
and the diffstat can be found below.
thanks,
greg k-h
-------------
Pseudo-Shortlog of commits:
Greg Kroah-Hartman <gregkh(a)linuxfoundation.org>
Linux 4.18.8-rc1
Gustavo A. R. Silva <gustavo(a)embeddedor.com>
ASoC: wm8994: Fix missing break in switch
Robert Munteanu <rombert(a)apache.org>
HID: redragon: fix num lock and caps lock LEDs
Arnd Bergmann <arnd(a)arndb.de>
x86: kvm: avoid unused variable warning
Junaid Shahid <junaids(a)google.com>
kvm: x86: Set highest physical address bits in non-present/reserved SPTEs
Randy Dunlap <rdunlap(a)infradead.org>
kbuild: make missing $DEPMOD a Warning instead of an Error
Juergen Gross <jgross(a)suse.com>
x86/xen: don't write ptes directly in 32-bit PV guests
Juergen Gross <jgross(a)suse.com>
x86/pae: use 64 bit atomic xchg function in native_ptep_get_and_clear
Joel Fernandes (Google) <joel(a)joelfernandes.org>
debugobjects: Make stack check warning more informative
Michel Dänzer <michel.daenzer(a)amd.com>
drm/amdgpu: Don't warn on destroying a pinned BO
Michel Dänzer <michel.daenzer(a)amd.com>
drm/amdgpu: Warn and update pin_size values when destroying a pinned BO
Michel Dänzer <michel.daenzer(a)amd.com>
drm/amdgpu: Make pin_size values atomic
Michel Dänzer <michel.daenzer(a)amd.com>
drm/amdgpu: Keep track of amount of pinned CPU visible VRAM
Chuanhua Lei <chuanhua.lei(a)linux.intel.com>
x86/tsc: Prevent result truncation on 32bit
Jani Nikula <jani.nikula(a)intel.com>
drm/i915: set DP Main Stream Attribute for color range on DDI platforms
Nadav Amit <namit(a)vmware.com>
mm: respect arch_dup_mmap() return value
Randy Dunlap <rdunlap(a)infradead.org>
uapi/linux/keyctl.h: don't use C++ reserved keyword as a struct member name
Jan-Marek Glogowski <glogow(a)fbihome.de>
drm/i915: Re-apply "Perform link quality check, unconditionally during long pulse"
Christian König <christian.koenig(a)amd.com>
drm/amdgpu: fix incorrect use of drm_file->pid
Christian König <christian.koenig(a)amd.com>
drm/amdgpu: fix incorrect use of fcheck
Likun Gao <Likun.Gao(a)amd.com>
drm/amdgpu:add VCN booting with firmware loaded by PSP
Likun Gao <Likun.Gao(a)amd.com>
drm/amdgpu:add VCN support in PSP driver
Likun Gao <Likun.Gao(a)amd.com>
drm/amdgpu:add new firmware id for VCN
James Zhu <jzhums(a)gmail.com>
drm/amdgpu:add tmr mc address into amdgpu_firmware_info
James Zhu <jzhums(a)gmail.com>
drm/amdgpu: update tmr mc address
Mikita Lipski <mikita.lipski(a)amd.com>
drm/amd/display: Check if clock source in use before disabling
Mikita Lipski <mikita.lipski(a)amd.com>
drm/amd/display: Pass connector id when executing VBIOS CT
Sandy Huang <hjc(a)rock-chips.com>
drm/rockchip: vop: fix irq disabled after vop driver probed
Heiko Stuebner <heiko(a)sntech.de>
drm/rockchip: vop: split out core clock enablement into separate functions
Julia Lawall <Julia.Lawall(a)lip6.fr>
drm/rockchip: lvds: add missing of_node_put
Harry Wentland <harry.wentland(a)amd.com>
drm/amd/display: Report non-DP display as disconnected without EDID
Leo (Sunpeng) Li <sunpeng.li(a)amd.com>
drm/amd/display: Use requested HDMI aspect ratio
Mikita Lipski <mikita.lipski(a)amd.com>
drm/amd/display: update clk for various HDMI color depths
Mikita Lipski <mikita.lipski(a)amd.com>
drm/amd/display: Don't share clk source between DP and HDMI
Gustavo A. R. Silva <gustavo(a)embeddedor.com>
drm/amd/display: fix type of variable
Kai-Heng Feng <kai.heng.feng(a)canonical.com>
drm/edid: Add 6 bpc quirk for SDC panel in Lenovo B50-80
Lubosz Sarnecki <lubosz.sarnecki(a)collabora.com>
drm/edid: Quirk Vive Pro VR headset non-desktop.
Rex Zhu <rex.zhu(a)amd.com>
drm/amd/pp/Polaris12: Fix a chunk of registers missed to program
Evan Quan <evan.quan(a)amd.com>
drm/amd/powerplay: fixed uninitialized value
Rex Zhu <rex.zhu(a)amd.com>
drm/amd/pp: Convert voltage unit in mV*4 to mV on CZ/ST
Michel Dänzer <michel.daenzer(a)amd.com>
drm/amdgpu: Fix RLC safe mode test in gfx_v9_0_enter_rlc_safe_mode
Rex Zhu <rex.zhu(a)amd.com>
drm/amdgpu: fix a reversed condition
Alex Deucher <alexander.deucher(a)amd.com>
drm/amdgpu: update uvd_v6_0_ring_vm_funcs to use new nop packet
Rodrigo Vivi <rodrigo.vivi(a)intel.com>
drm/i915: Free write_buf that we allocated with kzalloc.
Fredrik Schön <fredrikschon(a)gmail.com>
drm/i915: Increase LSPCON timeout
Ville Syrjälä <ville.syrjala(a)linux.intel.com>
drm/i915: Nuke the LVDS lid notifier
Chris Wilson <chris(a)chris-wilson.co.uk>
drm/i915/lpe: Mark LPE audio runtime pm as "no callbacks"
David Sterba <dsterba(a)suse.com>
btrfs: fix mount and ioctl device scan ioctl race
David Sterba <dsterba(a)suse.com>
btrfs: reorder initialization before the mount locks uuid_mutex
David Sterba <dsterba(a)suse.com>
btrfs: lift uuid_mutex to callers of btrfs_parse_early_options
David Sterba <dsterba(a)suse.com>
btrfs: lift uuid_mutex to callers of btrfs_scan_one_device
Anand Jain <anand.jain(a)oracle.com>
btrfs: use device_list_mutex when removing stale devices
Anand Jain <anand.jain(a)oracle.com>
btrfs: rename local devices for fs_devices in btrfs_free_stale_devices(
Anand Jain <anand.jain(a)oracle.com>
btrfs: extend locked section when adding a new device in device_list_add
Anand Jain <anand.jain(a)oracle.com>
btrfs: do btrfs_free_stale_devices outside of device_list_add
Marc Zyngier <marc.zyngier(a)arm.com>
ARM: rockchip: Force CONFIG_PM on Rockchip systems
Marc Zyngier <marc.zyngier(a)arm.com>
arm64: rockchip: Force CONFIG_PM on Rockchip systems
Bart Van Assche <bart.vanassche(a)wdc.com>
btrfs: Fix a C compliance issue
Qu Wenruo <wqu(a)suse.com>
btrfs: Don't remove block group that still has pinned down bytes
David Sterba <dsterba(a)suse.com>
btrfs: lift uuid_mutex to callers of btrfs_open_devices
Qu Wenruo <wqu(a)suse.com>
btrfs: check-integrity: Fix NULL pointer dereference for degraded mount
Qu Wenruo <wqu(a)suse.com>
btrfs: tree-checker: Detect invalid and empty essential trees
Qu Wenruo <wqu(a)suse.com>
btrfs: relocation: Only remove reloc rb_trees if reloc control has been initialized
Anand Jain <anand.jain(a)oracle.com>
btrfs: fix in-memory value of total_devices after seed device deletion
Misono Tomohiro <misono.tomohiro(a)jp.fujitsu.com>
btrfs: replace: Reset on-disk dev stats value after replace
Qu Wenruo <wqu(a)suse.com>
btrfs: Exit gracefully when chunk map cannot be inserted to the tree
Lucas Stach <l.stach(a)pengutronix.de>
drm/etnaviv: fix crash in GPU suspend when init failed due to buffer placement
Jim Mattson <jmattson(a)google.com>
kvm: nVMX: Fix fault vector for VMX operation at CPL > 0
Sean Christopherson <sean.j.christopherson(a)intel.com>
KVM: vmx: track host_state.loaded using a loaded_vmcs pointer
David Francis <David.Francis(a)amd.com>
drm/amd/display: Read back max backlight value at boot
Levin Du <djw(a)t-chip.com.cn>
clk: rockchip: Add pclk_rkpwm_pmu to PMU critical clocks in rk3399
Mahesh Salgaonkar <mahesh(a)linux.vnet.ibm.com>
powerpc/pseries: Avoid using the size greater than RTAS_ERROR_LOG_MAX.
Masahiro Yamada <yamada.masahiro(a)socionext.com>
um: fix parallel building with O= option
Michael Ellerman <mpe(a)ellerman.id.au>
powerpc/64s: Make rfi_flush_fallback a little more robust
Randy Dunlap <rdunlap(a)infradead.org>
powerpc/platforms/85xx: fix t1042rdb_diu.c build errors & warning
Steve French <stfrench(a)microsoft.com>
smb3: if server does not support posix do not allow posix mount option
Steve French <stfrench(a)microsoft.com>
SMB3: Number of requests sent should be displayed for SMB3 not just CIFS
Aurelien Aptel <aaptel(a)suse.com>
CIFS: fix memory leak and remove dead code
Steve French <stfrench(a)microsoft.com>
smb3: fix reset of bytes read and written stats
Bart Van Assche <bart.vanassche(a)wdc.com>
cfq: Suppress compiler warnings about comparisons
YueHaibing <yuehaibing(a)huawei.com>
RDS: IB: fix 'passing zero to ERR_PTR()' warning
nixiaoming <nixiaoming(a)huawei.com>
selinux: cleanup dentry and inodes on error in selinuxfs
Breno Leitao <leitao(a)debian.org>
selftests/powerpc: Kill child processes on SIGINT
Ralf Goebel <ralf.goebel(a)imago-technologies.com>
iommu/omap: Fix cache flushes on L2 table entries
Matthias Kaehlcke <mka(a)chromium.org>
ASoC: rt5677: Fix initialization of rt5677_of_match.data
Ian Abbott <abbotti(a)mev.co.uk>
staging: comedi: ni_mio_common: fix subdevice flags for PFI subdevice
John Pittman <jpittman(a)redhat.com>
dm kcopyd: avoid softlockup in run_complete_job
Thomas Petazzoni <thomas.petazzoni(a)bootlin.com>
PCI: mvebu: Fix I/O space end address calculation
Roger Pau Monne <roger.pau(a)citrix.com>
xen/balloon: fix balloon initialization for PVH Dom0
Dmitry Torokhov <dmitry.torokhov(a)gmail.com>
Input: do not use WARN() in input_alloc_absinfo()
Wei Yongjun <weiyongjun1(a)huawei.com>
NFSv4: Fix error handling in nfs4_sp4_select_mode()
Dan Carpenter <dan.carpenter(a)oracle.com>
scsi: aic94xx: fix an error code in aic94xx_init()
Jianchao Wang <jianchao.w.wang(a)oracle.com>
blk-mq: count the hctx as active before allocating tag
Hans de Goede <hdegoede(a)redhat.com>
ACPI / scan: Initialize status to ACPI_STA_DEFAULT
Stefan Haberland <sth(a)linux.ibm.com>
s390/dasd: fix panic for failed online processing
Stefan Haberland <sth(a)linux.ibm.com>
s390/dasd: fix hanging offline processing due to canceled worker
Winnie Chang <winnie.chang(a)cypress.com>
brcmfmac: fix brcmf_wiphy_wowl_params() NULL pointer dereference
Greg Edwards <gedwards(a)ddn.com>
block: bvec_nr_vecs() returns value for wrong slab
Sandipan Das <sandipan(a)linux.ibm.com>
perf probe powerpc: Fix trace event post-processing
Dan Carpenter <dan.carpenter(a)oracle.com>
powerpc: Fix size calculation using resource_size()
Michael Ellerman <mpe(a)ellerman.id.au>
powerpc/uaccess: Enable get_user(u64, *p) on 32-bit
Yonghong Song <yhs(a)fb.com>
bpf: fix bpffs non-array map seq_show issue
Anton Vasilyev <vasilyev(a)ispras.ru>
pinctrl: axp209: Fix NULL pointer dereference after allocation
Chao Yu <yuchao0(a)huawei.com>
f2fs: fix to clear PG_checked flag in set_page_dirty()
Jean-Philippe Brucker <jean-philippe.brucker(a)arm.com>
net/9p: fix error path of p9_virtio_probe
Tomas Bortoli <tomasbortoli(a)gmail.com>
net/9p/trans_fd.c: fix race by holding the lock
Jonas Gorski <jonas.gorski(a)gmail.com>
irqchip/bcm7038-l1: Hide cpu offline callback when building for !SMP
Dan Carpenter <dan.carpenter(a)oracle.com>
irqchip/stm32: Fix init error handling
Palmer Dabbelt <palmer(a)sifive.com>
RISC-V: Use KBUILD_CFLAGS instead of KCFLAGS when building the vDSO
Chao Yu <yuchao0(a)huawei.com>
f2fs: fix avoid race between truncate and background GC
Chao Yu <yuchao0(a)huawei.com>
f2fs: avoid race between zero_range and background GC
Benno Evers <bevers(a)mesosphere.com>
perf tools: Check for null when copying nsinfo.
Denis Efremov <efremov(a)linux.com>
coccicheck: return proper error code on fail
Nicholas Kazlauskas <nicholas.kazlauskas(a)amd.com>
drm/amd/display: Guard against null crtc in CRC IRQ
Myron Stowe <myron.stowe(a)redhat.com>
PCI: Match Root Port's MPS to endpoint's MPSS as necessary
Jian Shen <shenjian15(a)huawei.com>
net: hns3: Fix for phy link issue when using marvell phy driver
Jens Axboe <axboe(a)kernel.dk>
block: don't warn for flush on read-only device
Xi Wang <wangxi11(a)huawei.com>
net: hns3: Fix for command format parsing error in hclge_is_all_function_id_zero
Kim Phillips <kim.phillips(a)arm.com>
perf arm spe: Fix uninitialized record error variable
Erik Schmauss <erik.schmauss(a)intel.com>
ACPICA: ACPICA: add status check for acpi_hw_read before assigning return value
Gal Pressman <pressmangal(a)gmail.com>
RDMA/hns: Fix usage of bitmap allocation functions return values
Richard Weinberger <richard(a)nod.at>
ubi: Initialize Fastmap checkmapping correctly
Daniel Borkmann <daniel(a)iogearbox.net>
tcp, ulp: add alias for all ulp modules
Florian Westphal <fw(a)strlen.de>
netfilter: fix memory leaks on netlink_dump_start error
Aleh Filipovich <aleh(a)vaolix.com>
platform/x86: asus-nb-wmi: Add keymap entry for lid flip action on UX360
Michal Hocko <mhocko(a)suse.com>
netfilter: x_tables: do not fail xt_alloc_table_info too easilly
Guenter Roeck <linux(a)roeck-us.net>
mfd: sm501: Set coherent_dma_mask when creating subdevices
Tan Hu <tan.hu(a)zte.com.cn>
ipvs: fix race between ip_vs_conn_new() and ip_vs_del_dest()
Philipp Rudo <prudo(a)linux.ibm.com>
s390/kdump: Fix memleak in nt_vmcoreinfo
Florian Westphal <fw(a)strlen.de>
netfilter: ip6t_rpfilter: set F_IFACE for linklocal addresses
Jesper Dangaard Brouer <brouer(a)redhat.com>
samples/bpf: all XDP samples should unload xdp/bpf prog on SIGTERM
Daniel Borkmann <daniel(a)iogearbox.net>
bpf, sockmap: fix leakage of smap_psock_map_entry
Tariq Toukan <tariqt(a)mellanox.com>
net/xdp: Fix suspicious RCU usage warning
Daniel Borkmann <daniel(a)iogearbox.net>
bpf, sockmap: fix sock_map_ctx_update_elem race with exist/noexist
Daniel Borkmann <daniel(a)iogearbox.net>
tcp, ulp: fix leftover icsk_ulp_ops preventing sock from reattach
Daniel Borkmann <daniel(a)iogearbox.net>
bpf, sockmap: fix map elem deletion race with smap_stop_sock
Randy Dunlap <rdunlap(a)infradead.org>
platform/x86: intel_punit_ipc: fix build errors
Tetsuo Handa <penguin-kernel(a)I-love.SAKURA.ne.jp>
fs/dcache.c: fix kmemcheck splat at take_dentry_name_snapshot()
Mike Rapoport <rppt(a)linux.vnet.ibm.com>
mm: make DEFERRED_STRUCT_PAGE_INIT explicitly depend on SPARSEMEM
Andrey Ryabinin <aryabinin(a)virtuozzo.com>
mm/fadvise.c: fix signed overflow UBSAN complaint
Srikar Dronamraju <srikar(a)linux.vnet.ibm.com>
powerpc/topology: Get topology for shared processors at boot
Jerome Brunet <jbrunet(a)baylibre.com>
pwm: meson: Fix mux clock names
Michael J. Ruhl <michael.j.ruhl(a)intel.com>
IB/hfi1: Invalid NUMA node information can cause a divide by zero
Hans de Goede <hdegoede(a)redhat.com>
i2c: core: ACPI: Make acpi_gsb_i2c_read_bytes() check i2c_transfer return value
Arnd Bergmann <arnd(a)arndb.de>
x86/mce: Add notifier_block forward declaration
Suzuki K Poulose <suzuki.poulose(a)arm.com>
virtio: pci-legacy: Validate queue pfn
Dan Carpenter <dan.carpenter(a)oracle.com>
apparmor: fix an error code in __aa_create_ns()
Randy Dunlap <rdunlap(a)infradead.org>
scripts: modpost: check memory allocation results
Johannes Berg <johannes.berg(a)intel.com>
workqueue: re-add lockdep dependencies for flushing
Johannes Berg <johannes.berg(a)intel.com>
workqueue: skip lockdep wq dependency in cancel_work_sync()
OGAWA Hirofumi <hirofumi(a)mail.parknet.co.jp>
fat: validate ->i_start before using
James Morse <james.morse(a)arm.com>
fs/proc/kcore.c: use __pa_symbol() for KCORE_TEXT list entries
Marc Zyngier <marc.zyngier(a)arm.com>
iommu/rockchip: Move irq request past pm_runtime_enable
Ernesto A. Fernández <ernesto.mnd.fernandez(a)gmail.com>
hfsplus: fix NULL dereference in hfsplus_lookup()
Marc Zyngier <marc.zyngier(a)arm.com>
iommu/rockchip: Handle errors returned from PM framework
Arnd Bergmann <arnd(a)arndb.de>
reiserfs: change j_timestamp type to time64_t
Arnd Bergmann <arnd(a)arndb.de>
fs/proc/vmcore.c: hide vmcoredd_mmap_dumps() for nommu builds
Jann Horn <jannh(a)google.com>
fork: don't copy inconsistent signal handler state to child
Laura Abbott <labbott(a)redhat.com>
sunrpc: Don't use stack buffer with scatterlist
Ernesto A. Fernández <ernesto.mnd.fernandez(a)gmail.com>
hfs: prevent crash on exit from failed search
Tetsuo Handa <penguin-kernel(a)I-love.SAKURA.ne.jp>
hfsplus: don't return 0 when fill_super() failed
Ronnie Sahlberg <lsahlber(a)redhat.com>
cifs: check if SMB2 PDU size has been padded and suppress the warning
Stephen Hemminger <stephen(a)networkplumber.org>
hv_netvsc: ignore devices that are not PCI
Jason Wang <jasowang(a)redhat.com>
vhost: correctly check the iova range when waking virtqueue
Ido Schimmel <idosch(a)mellanox.com>
mlxsw: spectrum_switchdev: Do not leak RIFs when removing bridge
Xin Long <lucien.xin(a)gmail.com>
sctp: hold transport before accessing its asoc in sctp_transport_get_next
Jakub Kicinski <jakub.kicinski(a)netronome.com>
nfp: wait for posted reconfigs when disabling the device
Haishuang Yan <yanhaishuang(a)cmss.chinamobile.com>
ip6_vti: fix a null pointer deference when destroy vti6 tunnel
Haishuang Yan <yanhaishuang(a)cmss.chinamobile.com>
ip6_vti: fix creating fallback tunnel device for vti6
Jerome Brunet <jbrunet(a)baylibre.com>
Revert "net: stmmac: Do not keep rearming the coalesce timer in stmmac_xmit"
Azat Khuzhin <a3at.mail(a)gmail.com>
r8169: set RxConfig after tx/rx is enabled for RTL8169sb/8110sb devices
Tariq Toukan <tariqt(a)mellanox.com>
net/mlx5: Fix SQ offset in QPs with small RQ
David Ahern <dsahern(a)gmail.com>
net/ipv6: Put lwtstate when destroying fib6_info
David Ahern <dsahern(a)gmail.com>
net/ipv6: Only update MTU metric if it set
Hangbin Liu <liuhangbin(a)gmail.com>
net/ipv6: init ip6 anycast rt->dst.input as ip6_input
Alexey Kodanev <alexey.kodanev(a)oracle.com>
ipv6: don't get lwtstate twice in ip6_rt_copy_init()
Ahmad Fatoum <a.fatoum(a)pengutronix.de>
net: macb: Fix regression breaking non-MDIO fixed-link PHYs
Xin Long <lucien.xin(a)gmail.com>
erspan: set erspan_ver to 1 by default when adding an erspan dev
Xin Long <lucien.xin(a)gmail.com>
sctp: remove useless start_fail from sctp_ht_iter in proc
Haiqing Bai <Haiqing.Bai(a)windriver.com>
tipc: fix the big/little endian issue in tipc_dest
Dexuan Cui <decui(a)microsoft.com>
hv_netvsc: Fix a deadlock by getting rtnl lock earlier in netvsc_probe()
Cong Wang <xiyou.wangcong(a)gmail.com>
tipc: fix a missing rhashtable_walk_exit()
Davide Caratti <dcaratti(a)redhat.com>
net/sched: act_pedit: fix dump of extended layered op
Michael Chan <michael.chan(a)broadcom.com>
bnxt_en: Do not adjust max_cp_rings by the ones used by RDMA.
Michael Chan <michael.chan(a)broadcom.com>
bnxt_en: Clean up unused functions.
Vlad Buslov <vladbu(a)mellanox.com>
net: sched: action_ife: take reference to meta module
Cong Wang <xiyou.wangcong(a)gmail.com>
act_ife: fix a potential deadlock
Cong Wang <xiyou.wangcong(a)gmail.com>
act_ife: move tcfa_lock down to where necessary
Alexey Kodanev <alexey.kodanev(a)oracle.com>
vti6: remove !skb->ignore_df check from vti6_xmit()
Florian Westphal <fw(a)strlen.de>
tcp: do not restart timewait timer on rst reception
Anthony Wong <anthony.wong(a)ubuntu.com>
r8169: add support for NCube 8168 network card
Kai-Heng Feng <kai.heng.feng(a)canonical.com>
r8152: disable RX aggregation on new Dell TB16 dock
Manish Chopra <manish.chopra(a)cavium.com>
qlge: Fix netdev features configuration.
Kees Cook <keescook(a)chromium.org>
net: sched: Fix memory exposure from short TCA_U32_SEL
Anssi Hannula <anssi.hannula(a)bitwise.fi>
net: macb: do not disable MDIO bus at open/close time
Doug Berger <opendmb(a)gmail.com>
net: bcmgenet: use MAC link status for fixed phy
Eric Dumazet <edumazet(a)google.com>
ipv4: tcp: send zero IPID for RST and ACK sent in SYN-RECV and TIME-WAIT state
Cong Wang <xiyou.wangcong(a)gmail.com>
act_ife: fix a potential use-after-free
-------------
Diffstat:
Makefile | 4 +-
arch/arm/mach-rockchip/Kconfig | 1 +
arch/arm64/Kconfig.platforms | 1 +
arch/powerpc/include/asm/topology.h | 5 +
arch/powerpc/include/asm/uaccess.h | 13 +-
arch/powerpc/kernel/exceptions-64s.S | 6 +
arch/powerpc/kernel/smp.c | 5 +
arch/powerpc/mm/numa.c | 20 +--
arch/powerpc/platforms/85xx/t1042rdb_diu.c | 4 +
arch/powerpc/platforms/pseries/ras.c | 2 +-
arch/powerpc/sysdev/mpic_msgr.c | 2 +-
arch/riscv/kernel/vdso/Makefile | 4 +-
arch/s390/kernel/crash_dump.c | 17 ++-
arch/um/Makefile | 3 +-
arch/x86/include/asm/mce.h | 1 +
arch/x86/include/asm/pgtable-3level.h | 7 +-
arch/x86/kernel/tsc.c | 4 +-
arch/x86/kvm/mmu.c | 43 ++++++-
arch/x86/kvm/vmx.c | 26 ++--
arch/x86/kvm/x86.c | 12 +-
arch/x86/xen/mmu_pv.c | 7 +-
block/bio.c | 2 +-
block/blk-core.c | 4 +-
block/blk-mq-tag.c | 3 +
block/blk-mq.c | 8 +-
block/cfq-iosched.c | 22 ++--
drivers/acpi/acpica/hwregs.c | 9 +-
drivers/acpi/scan.c | 5 +-
drivers/clk/rockchip/clk-rk3399.c | 1 +
drivers/gpu/drm/amd/amdgpu/amdgpu.h | 6 +-
drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c | 2 +-
drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c | 23 ++--
drivers/gpu/drm/amd/amdgpu/amdgpu_object.c | 38 ++++--
drivers/gpu/drm/amd/amdgpu/amdgpu_pm.c | 2 +-
drivers/gpu/drm/amd/amdgpu/amdgpu_psp.c | 5 +
drivers/gpu/drm/amd/amdgpu/amdgpu_sched.c | 21 +---
drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.h | 2 +-
drivers/gpu/drm/amd/amdgpu/amdgpu_ucode.h | 4 +
drivers/gpu/drm/amd/amdgpu/amdgpu_vcn.c | 17 +--
drivers/gpu/drm/amd/amdgpu/amdgpu_vram_mgr.c | 20 ++-
drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c | 2 +-
drivers/gpu/drm/amd/amdgpu/psp_v10_0.c | 3 +
drivers/gpu/drm/amd/amdgpu/uvd_v6_0.c | 3 +-
drivers/gpu/drm/amd/amdgpu/vcn_v1_0.c | 40 ++++--
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c | 10 +-
.../gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_crc.c | 10 +-
.../gpu/drm/amd/display/dc/bios/command_table.c | 18 +++
drivers/gpu/drm/amd/display/dc/core/dc_link.c | 11 ++
drivers/gpu/drm/amd/display/dc/core/dc_resource.c | 68 ++++++++---
drivers/gpu/drm/amd/display/dc/dc.h | 1 +
.../gpu/drm/amd/display/dc/dce/dce_link_encoder.c | 4 +-
.../drm/amd/display/dc/dce100/dce100_resource.c | 2 +-
.../drm/amd/display/dc/dce110/dce110_compressor.c | 2 +-
.../amd/display/dc/dce110/dce110_hw_sequencer.c | 4 +-
.../gpu/drm/amd/display/dc/dce80/dce80_resource.c | 3 +
drivers/gpu/drm/amd/display/dc/inc/resource.h | 5 +
.../gpu/drm/amd/powerplay/hwmgr/smu7_powertune.c | 43 +++++++
drivers/gpu/drm/amd/powerplay/hwmgr/smu8_hwmgr.c | 5 +-
drivers/gpu/drm/amd/powerplay/hwmgr/vega12_hwmgr.c | 2 +-
drivers/gpu/drm/drm_edid.c | 6 +-
drivers/gpu/drm/etnaviv/etnaviv_gpu.c | 1 +
drivers/gpu/drm/i915/i915_drv.c | 10 --
drivers/gpu/drm/i915/i915_drv.h | 8 --
drivers/gpu/drm/i915/i915_reg.h | 1 +
drivers/gpu/drm/i915/intel_ddi.c | 4 +
drivers/gpu/drm/i915/intel_dp.c | 33 ++---
drivers/gpu/drm/i915/intel_hdmi.c | 8 +-
drivers/gpu/drm/i915/intel_lpe_audio.c | 4 +-
drivers/gpu/drm/i915/intel_lspcon.c | 2 +-
drivers/gpu/drm/i915/intel_lvds.c | 136 +--------------------
drivers/gpu/drm/rockchip/rockchip_drm_vop.c | 69 +++++++----
drivers/gpu/drm/rockchip/rockchip_lvds.c | 4 +-
drivers/hid/hid-redragon.c | 26 +---
drivers/i2c/i2c-core-acpi.c | 8 +-
drivers/infiniband/hw/hfi1/affinity.c | 24 +++-
drivers/infiniband/hw/hns/hns_roce_pd.c | 2 +-
drivers/infiniband/hw/hns/hns_roce_qp.c | 5 +-
drivers/input/input.c | 16 ++-
drivers/iommu/omap-iommu.c | 4 +-
drivers/iommu/rockchip-iommu.c | 45 ++++---
drivers/irqchip/irq-bcm7038-l1.c | 4 +
drivers/irqchip/irq-stm32-exti.c | 25 ++--
drivers/md/dm-kcopyd.c | 2 +
drivers/mfd/sm501.c | 1 +
drivers/mtd/ubi/vtbl.c | 20 +--
drivers/net/ethernet/broadcom/bnxt/bnxt.c | 9 +-
drivers/net/ethernet/broadcom/bnxt/bnxt.h | 3 +-
drivers/net/ethernet/broadcom/bnxt/bnxt_sriov.c | 7 +-
drivers/net/ethernet/broadcom/bnxt/bnxt_ulp.c | 20 ---
drivers/net/ethernet/broadcom/bnxt/bnxt_ulp.h | 1 -
drivers/net/ethernet/broadcom/genet/bcmgenet.h | 3 +
drivers/net/ethernet/broadcom/genet/bcmmii.c | 10 +-
drivers/net/ethernet/cadence/macb_main.c | 36 ++++--
.../ethernet/hisilicon/hns3/hns3pf/hclge_main.c | 2 +-
.../ethernet/hisilicon/hns3/hns3pf/hclge_mdio.c | 2 +
drivers/net/ethernet/mellanox/mlx5/core/wq.c | 5 +-
drivers/net/ethernet/mellanox/mlxsw/spectrum.h | 2 +
.../net/ethernet/mellanox/mlxsw/spectrum_router.c | 11 ++
.../ethernet/mellanox/mlxsw/spectrum_switchdev.c | 20 +++
.../net/ethernet/netronome/nfp/nfp_net_common.c | 48 +++++---
drivers/net/ethernet/qlogic/qlge/qlge_main.c | 23 ++--
drivers/net/ethernet/realtek/r8169.c | 7 +-
drivers/net/ethernet/stmicro/stmmac/stmmac.h | 1 -
drivers/net/ethernet/stmicro/stmmac/stmmac_main.c | 5 +-
drivers/net/hyperv/netvsc_drv.c | 16 ++-
drivers/net/usb/r8152.c | 4 +-
.../broadcom/brcm80211/brcmfmac/cfg80211.c | 8 +-
drivers/pci/controller/pci-mvebu.c | 2 +-
drivers/pci/probe.c | 12 +-
drivers/pinctrl/pinctrl-axp209.c | 26 +++-
drivers/platform/x86/asus-nb-wmi.c | 1 +
drivers/platform/x86/intel_punit_ipc.c | 1 +
drivers/pwm/pwm-meson.c | 3 +-
drivers/s390/block/dasd_eckd.c | 10 +-
drivers/scsi/aic94xx/aic94xx_init.c | 4 +-
drivers/staging/comedi/drivers/ni_mio_common.c | 3 +-
drivers/vhost/vhost.c | 2 +-
drivers/virtio/virtio_pci_legacy.c | 14 ++-
drivers/xen/xen-balloon.c | 2 +-
fs/btrfs/check-integrity.c | 7 +-
fs/btrfs/dev-replace.c | 6 +
fs/btrfs/extent-tree.c | 2 +-
fs/btrfs/relocation.c | 23 ++--
fs/btrfs/super.c | 44 ++++---
fs/btrfs/tree-checker.c | 15 ++-
fs/btrfs/volumes.c | 94 ++++++++------
fs/cifs/cifs_debug.c | 8 ++
fs/cifs/connect.c | 8 +-
fs/cifs/smb2misc.c | 7 ++
fs/cifs/smb2pdu.c | 103 ++++++++--------
fs/dcache.c | 3 +-
fs/f2fs/data.c | 8 ++
fs/f2fs/file.c | 48 +++++---
fs/fat/cache.c | 19 +--
fs/fat/fat.h | 5 +
fs/fat/fatent.c | 6 +-
fs/hfs/brec.c | 7 +-
fs/hfsplus/dir.c | 4 +-
fs/hfsplus/super.c | 4 +-
fs/nfs/nfs4proc.c | 2 +-
fs/proc/kcore.c | 4 +-
fs/proc/vmcore.c | 2 +
fs/reiserfs/reiserfs.h | 2 +-
include/linux/pci_ids.h | 2 +
include/net/tcp.h | 4 +
include/uapi/linux/keyctl.h | 2 +-
kernel/bpf/inode.c | 8 +-
kernel/bpf/sockmap.c | 120 ++++++++++--------
kernel/fork.c | 5 +-
kernel/workqueue.c | 45 ++++---
lib/debugobjects.c | 7 +-
mm/Kconfig | 2 +-
mm/fadvise.c | 8 +-
net/9p/trans_fd.c | 10 +-
net/9p/trans_virtio.c | 3 +-
net/core/xdp.c | 14 +--
net/ipv4/ip_gre.c | 3 +
net/ipv4/tcp_ipv4.c | 6 +
net/ipv4/tcp_minisocks.c | 3 +-
net/ipv4/tcp_ulp.c | 4 +-
net/ipv6/ip6_fib.c | 7 +-
net/ipv6/ip6_gre.c | 1 +
net/ipv6/ip6_vti.c | 7 +-
net/ipv6/netfilter/ip6t_rpfilter.c | 12 +-
net/ipv6/route.c | 3 +-
net/netfilter/ipvs/ip_vs_core.c | 15 ++-
net/netfilter/nf_conntrack_netlink.c | 26 ++--
net/netfilter/nfnetlink_acct.c | 29 ++---
net/netfilter/x_tables.c | 7 +-
net/rds/ib_frmr.c | 1 +
net/sched/act_ife.c | 78 +++++++-----
net/sched/act_pedit.c | 18 ++-
net/sched/cls_u32.c | 10 +-
net/sctp/proc.c | 8 --
net/sctp/socket.c | 22 ++--
net/sunrpc/auth_gss/gss_krb5_crypto.c | 12 +-
net/tipc/name_table.c | 10 +-
net/tipc/name_table.h | 9 +-
net/tipc/socket.c | 2 +
net/tls/tls_main.c | 1 +
samples/bpf/xdp_redirect_cpu_user.c | 3 +-
samples/bpf/xdp_rxq_info_user.c | 3 +-
scripts/coccicheck | 5 +-
scripts/depmod.sh | 4 +-
scripts/mod/modpost.c | 8 +-
security/apparmor/policy_ns.c | 2 +-
security/keys/dh.c | 2 +-
security/selinux/selinuxfs.c | 33 +++--
sound/soc/codecs/rt5677.c | 2 +-
sound/soc/codecs/wm8994.c | 1 +
tools/perf/arch/arm64/util/arm-spe.c | 1 +
tools/perf/arch/powerpc/util/sym-handling.c | 4 +-
tools/perf/util/namespaces.c | 3 +
tools/testing/selftests/powerpc/harness.c | 18 ++-
194 files changed, 1498 insertions(+), 954 deletions(-)
From: Dexuan Cui <decui(a)microsoft.com>
With CONFIG_DEBUG_PREEMPT=y, I always see this warning:
BUG: using smp_processor_id() in preemptible [00000000]
Fix the false warning by using get/put_cpu().
Here vmbus_connect() sends a message to the host and waits for the
host's response. The host will deliver the response message and an
interrupt on CPU msg->target_vcpu, and later the interrupt handler
will wake up vmbus_connect(). vmbus_connect() doesn't really have
to run on the same cpu as CPU msg->target_vcpu, so it's safe to
call put_cpu() just here.
Signed-off-by: Dexuan Cui <decui(a)microsoft.com>
Cc: stable(a)vger.kernel.org
Cc: K. Y. Srinivasan <kys(a)microsoft.com>
Cc: Haiyang Zhang <haiyangz(a)microsoft.com>
Cc: Stephen Hemminger <sthemmin(a)microsoft.com>
Signed-off-by: K. Y. Srinivasan <kys(a)microsoft.com>
---
drivers/hv/connection.c | 8 +++++---
1 file changed, 5 insertions(+), 3 deletions(-)
diff --git a/drivers/hv/connection.c b/drivers/hv/connection.c
index ced041899456..f4d08c8ac7f8 100644
--- a/drivers/hv/connection.c
+++ b/drivers/hv/connection.c
@@ -76,6 +76,7 @@ static int vmbus_negotiate_version(struct vmbus_channel_msginfo *msginfo,
__u32 version)
{
int ret = 0;
+ unsigned int cur_cpu;
struct vmbus_channel_initiate_contact *msg;
unsigned long flags;
@@ -118,9 +119,10 @@ static int vmbus_negotiate_version(struct vmbus_channel_msginfo *msginfo,
* the CPU attempting to connect may not be CPU 0.
*/
if (version >= VERSION_WIN8_1) {
- msg->target_vcpu =
- hv_cpu_number_to_vp_number(smp_processor_id());
- vmbus_connection.connect_cpu = smp_processor_id();
+ cur_cpu = get_cpu();
+ msg->target_vcpu = hv_cpu_number_to_vp_number(cur_cpu);
+ vmbus_connection.connect_cpu = cur_cpu;
+ put_cpu();
} else {
msg->target_vcpu = 0;
vmbus_connection.connect_cpu = 0;
--
2.18.0
From: "Dr. Greg Wettstein" <greg(a)wind.enjellic.com>
Functionality of the xen-tpmfront driver was lost secondary to
the introduction of xenbus multi-page support in commit ccc9d90a9a8b
("xenbus_client: Extend interface to support multi-page ring").
In this commit a pointer to the shared page address was being
passed to the xenbus_grant_ring() function rather then the
address of the shared page itself. This resulted in a situation
where the driver would attach to the vtpm-stubdom but any attempt
to send a command to the stub domain would timeout.
A diagnostic finding for this regression is the following error
message being generated when the xen-tpmfront driver probes for a
device:
<3>vtpm vtpm-0: tpm_transmit: tpm_send: error -62
<3>vtpm vtpm-0: A TPM error (-62) occurred attempting to determine
the timeouts
This fix is relevant to all kernels from 4.1 forward which is the
release in which multi-page xenbus support was introduced.
Daniel De Graaf formulated the fix by code inspection after the
regression point was located.
Signed-off-by: Dr. Greg Wettstein <greg(a)enjellic.com>
[boris: fixed commit message formatting]
Signed-off-by: Boris Ostrovsky <boris.ostrovsky(a)oracle.com>
Cc: stable(a)vger.kernel.org # v4.1+
---
We've lost this patch a couple of years ago, re-submitting.
drivers/char/tpm/xen-tpmfront.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/char/tpm/xen-tpmfront.c b/drivers/char/tpm/xen-tpmfront.c
index 911475d36800..b150f87f38f5 100644
--- a/drivers/char/tpm/xen-tpmfront.c
+++ b/drivers/char/tpm/xen-tpmfront.c
@@ -264,7 +264,7 @@ static int setup_ring(struct xenbus_device *dev, struct tpm_private *priv)
return -ENOMEM;
}
- rv = xenbus_grant_ring(dev, &priv->shr, 1, &gref);
+ rv = xenbus_grant_ring(dev, priv->shr, 1, &gref);
if (rv < 0)
return rv;
--
2.17.1
Hi Greg,
For your consideration, few upstream fixes picked up from
Qcom's android-4.9 BSP tree for OnePlus 6 device.
Cherry-picked and build tested for ARCH=x86_64/mips on v4.9.124.
Few patches are applicable for 4.4.y and 3.18.y as well and
explicitly marked so respectively.
Regards,
Amit Pundir
Daniel Micay (1):
staging/rts5208: Fix read overflow in memcpy
Jason A. Donenfeld (1):
random: convert get_random_int/long into get_random_u32/u64
Jia-Ju Bai (1):
staging: rt5208: Fix a sleep-in-atomic bug in xd_copy_page
Johannes Berg (1):
nl80211: fix null-ptr dereference on invalid mesh configuration
Johannes Weiner (1):
mm: remove seemingly spurious reclaimability check from laptop_mode
gating
Kees Cook (1):
IB/rxe: do not copy extra stack memory to skb
Mel Gorman (1):
mm, vmscan: clear PGDAT_WRITEBACK when zone is balanced
Michal Hocko (1):
selinux: use GFP_NOWAIT in the AVC kmem_caches
Prateek Sood (2):
locking/rwsem-xadd: Fix missed wakeup due to reordering of load
locking/osq_lock: Fix osq_lock queue corruption
Ritesh Harjani (1):
cfq: Give a chance for arming slice idle timer in case of group_idle
Tejun Heo (1):
block,blkcg: use __GFP_NOWARN for best-effort allocations in blkcg
Vegard Nossum (2):
kthread: Fix use-after-free if kthread fork fails
kthread: fix boot hang (regression) on MIPS/OpenRISC
arch/mips/kernel/process.c | 1 -
arch/openrisc/kernel/process.c | 2 --
block/blk-cgroup.c | 9 +++---
block/cfq-iosched.c | 6 ++--
drivers/char/random.c | 55 ++++++++++++++++++------------------
drivers/infiniband/sw/rxe/rxe_resp.c | 4 ++-
drivers/staging/rts5208/rtsx_scsi.c | 2 +-
drivers/staging/rts5208/xd.c | 2 +-
include/linux/random.h | 17 +++++++++--
kernel/fork.c | 17 +++++++----
kernel/locking/osq_lock.c | 13 +++++++++
kernel/locking/rwsem-xadd.c | 27 ++++++++++++++++++
mm/vmscan.c | 3 +-
net/wireless/nl80211.c | 3 ++
security/selinux/avc.c | 14 ++++-----
15 files changed, 119 insertions(+), 56 deletions(-)
--
2.7.4
The patch below does not apply to the 4.9-stable tree.
If someone wants it applied there, or to any other stable or longterm
tree, then please email the backport, including the original git commit
id to <stable(a)vger.kernel.org>.
thanks,
greg k-h
------------------ original commit in Linus's tree ------------------
>From 9bc4f28af75a91aea0ae383f50b0a430c4509303 Mon Sep 17 00:00:00 2001
From: Nadav Amit <namit(a)vmware.com>
Date: Sun, 2 Sep 2018 11:14:50 -0700
Subject: [PATCH] x86/mm: Use WRITE_ONCE() when setting PTEs
When page-table entries are set, the compiler might optimize their
assignment by using multiple instructions to set the PTE. This might
turn into a security hazard if the user somehow manages to use the
interim PTE. L1TF does not make our lives easier, making even an interim
non-present PTE a security hazard.
Using WRITE_ONCE() to set PTEs and friends should prevent this potential
security hazard.
I skimmed the differences in the binary with and without this patch. The
differences are (obviously) greater when CONFIG_PARAVIRT=n as more
code optimizations are possible. For better and worse, the impact on the
binary with this patch is pretty small. Skimming the code did not cause
anything to jump out as a security hazard, but it seems that at least
move_soft_dirty_pte() caused set_pte_at() to use multiple writes.
Signed-off-by: Nadav Amit <namit(a)vmware.com>
Signed-off-by: Thomas Gleixner <tglx(a)linutronix.de>
Acked-by: Peter Zijlstra (Intel) <peterz(a)infradead.org>
Cc: Dave Hansen <dave.hansen(a)linux.intel.com>
Cc: Andi Kleen <ak(a)linux.intel.com>
Cc: Josh Poimboeuf <jpoimboe(a)redhat.com>
Cc: Michal Hocko <mhocko(a)suse.com>
Cc: Vlastimil Babka <vbabka(a)suse.cz>
Cc: Sean Christopherson <sean.j.christopherson(a)intel.com>
Cc: Andy Lutomirski <luto(a)kernel.org>
Cc: stable(a)vger.kernel.org
Link: https://lkml.kernel.org/r/20180902181451.80520-1-namit@vmware.com
diff --git a/arch/x86/include/asm/pgtable.h b/arch/x86/include/asm/pgtable.h
index e4ffa565a69f..690c0307afed 100644
--- a/arch/x86/include/asm/pgtable.h
+++ b/arch/x86/include/asm/pgtable.h
@@ -1195,7 +1195,7 @@ static inline pmd_t pmdp_establish(struct vm_area_struct *vma,
return xchg(pmdp, pmd);
} else {
pmd_t old = *pmdp;
- *pmdp = pmd;
+ WRITE_ONCE(*pmdp, pmd);
return old;
}
}
diff --git a/arch/x86/include/asm/pgtable_64.h b/arch/x86/include/asm/pgtable_64.h
index f773d5e6c8cc..ce2b59047cb8 100644
--- a/arch/x86/include/asm/pgtable_64.h
+++ b/arch/x86/include/asm/pgtable_64.h
@@ -55,15 +55,15 @@ struct mm_struct;
void set_pte_vaddr_p4d(p4d_t *p4d_page, unsigned long vaddr, pte_t new_pte);
void set_pte_vaddr_pud(pud_t *pud_page, unsigned long vaddr, pte_t new_pte);
-static inline void native_pte_clear(struct mm_struct *mm, unsigned long addr,
- pte_t *ptep)
+static inline void native_set_pte(pte_t *ptep, pte_t pte)
{
- *ptep = native_make_pte(0);
+ WRITE_ONCE(*ptep, pte);
}
-static inline void native_set_pte(pte_t *ptep, pte_t pte)
+static inline void native_pte_clear(struct mm_struct *mm, unsigned long addr,
+ pte_t *ptep)
{
- *ptep = pte;
+ native_set_pte(ptep, native_make_pte(0));
}
static inline void native_set_pte_atomic(pte_t *ptep, pte_t pte)
@@ -73,7 +73,7 @@ static inline void native_set_pte_atomic(pte_t *ptep, pte_t pte)
static inline void native_set_pmd(pmd_t *pmdp, pmd_t pmd)
{
- *pmdp = pmd;
+ WRITE_ONCE(*pmdp, pmd);
}
static inline void native_pmd_clear(pmd_t *pmd)
@@ -109,7 +109,7 @@ static inline pmd_t native_pmdp_get_and_clear(pmd_t *xp)
static inline void native_set_pud(pud_t *pudp, pud_t pud)
{
- *pudp = pud;
+ WRITE_ONCE(*pudp, pud);
}
static inline void native_pud_clear(pud_t *pud)
@@ -137,13 +137,13 @@ static inline void native_set_p4d(p4d_t *p4dp, p4d_t p4d)
pgd_t pgd;
if (pgtable_l5_enabled() || !IS_ENABLED(CONFIG_PAGE_TABLE_ISOLATION)) {
- *p4dp = p4d;
+ WRITE_ONCE(*p4dp, p4d);
return;
}
pgd = native_make_pgd(native_p4d_val(p4d));
pgd = pti_set_user_pgtbl((pgd_t *)p4dp, pgd);
- *p4dp = native_make_p4d(native_pgd_val(pgd));
+ WRITE_ONCE(*p4dp, native_make_p4d(native_pgd_val(pgd)));
}
static inline void native_p4d_clear(p4d_t *p4d)
@@ -153,7 +153,7 @@ static inline void native_p4d_clear(p4d_t *p4d)
static inline void native_set_pgd(pgd_t *pgdp, pgd_t pgd)
{
- *pgdp = pti_set_user_pgtbl(pgdp, pgd);
+ WRITE_ONCE(*pgdp, pti_set_user_pgtbl(pgdp, pgd));
}
static inline void native_pgd_clear(pgd_t *pgd)
diff --git a/arch/x86/mm/pgtable.c b/arch/x86/mm/pgtable.c
index e848a4811785..ae394552fb94 100644
--- a/arch/x86/mm/pgtable.c
+++ b/arch/x86/mm/pgtable.c
@@ -269,7 +269,7 @@ static void mop_up_one_pmd(struct mm_struct *mm, pgd_t *pgdp)
if (pgd_val(pgd) != 0) {
pmd_t *pmd = (pmd_t *)pgd_page_vaddr(pgd);
- *pgdp = native_make_pgd(0);
+ pgd_clear(pgdp);
paravirt_release_pmd(pgd_val(pgd) >> PAGE_SHIFT);
pmd_free(mm, pmd);
@@ -494,7 +494,7 @@ int ptep_set_access_flags(struct vm_area_struct *vma,
int changed = !pte_same(*ptep, entry);
if (changed && dirty)
- *ptep = entry;
+ set_pte(ptep, entry);
return changed;
}
@@ -509,7 +509,7 @@ int pmdp_set_access_flags(struct vm_area_struct *vma,
VM_BUG_ON(address & ~HPAGE_PMD_MASK);
if (changed && dirty) {
- *pmdp = entry;
+ set_pmd(pmdp, entry);
/*
* We had a write-protection fault here and changed the pmd
* to to more permissive. No need to flush the TLB for that,
@@ -529,7 +529,7 @@ int pudp_set_access_flags(struct vm_area_struct *vma, unsigned long address,
VM_BUG_ON(address & ~HPAGE_PUD_MASK);
if (changed && dirty) {
- *pudp = entry;
+ set_pud(pudp, entry);
/*
* We had a write-protection fault here and changed the pud
* to to more permissive. No need to flush the TLB for that,
The patch below does not apply to the 4.14-stable tree.
If someone wants it applied there, or to any other stable or longterm
tree, then please email the backport, including the original git commit
id to <stable(a)vger.kernel.org>.
thanks,
greg k-h
------------------ original commit in Linus's tree ------------------
>From 9bc4f28af75a91aea0ae383f50b0a430c4509303 Mon Sep 17 00:00:00 2001
From: Nadav Amit <namit(a)vmware.com>
Date: Sun, 2 Sep 2018 11:14:50 -0700
Subject: [PATCH] x86/mm: Use WRITE_ONCE() when setting PTEs
When page-table entries are set, the compiler might optimize their
assignment by using multiple instructions to set the PTE. This might
turn into a security hazard if the user somehow manages to use the
interim PTE. L1TF does not make our lives easier, making even an interim
non-present PTE a security hazard.
Using WRITE_ONCE() to set PTEs and friends should prevent this potential
security hazard.
I skimmed the differences in the binary with and without this patch. The
differences are (obviously) greater when CONFIG_PARAVIRT=n as more
code optimizations are possible. For better and worse, the impact on the
binary with this patch is pretty small. Skimming the code did not cause
anything to jump out as a security hazard, but it seems that at least
move_soft_dirty_pte() caused set_pte_at() to use multiple writes.
Signed-off-by: Nadav Amit <namit(a)vmware.com>
Signed-off-by: Thomas Gleixner <tglx(a)linutronix.de>
Acked-by: Peter Zijlstra (Intel) <peterz(a)infradead.org>
Cc: Dave Hansen <dave.hansen(a)linux.intel.com>
Cc: Andi Kleen <ak(a)linux.intel.com>
Cc: Josh Poimboeuf <jpoimboe(a)redhat.com>
Cc: Michal Hocko <mhocko(a)suse.com>
Cc: Vlastimil Babka <vbabka(a)suse.cz>
Cc: Sean Christopherson <sean.j.christopherson(a)intel.com>
Cc: Andy Lutomirski <luto(a)kernel.org>
Cc: stable(a)vger.kernel.org
Link: https://lkml.kernel.org/r/20180902181451.80520-1-namit@vmware.com
diff --git a/arch/x86/include/asm/pgtable.h b/arch/x86/include/asm/pgtable.h
index e4ffa565a69f..690c0307afed 100644
--- a/arch/x86/include/asm/pgtable.h
+++ b/arch/x86/include/asm/pgtable.h
@@ -1195,7 +1195,7 @@ static inline pmd_t pmdp_establish(struct vm_area_struct *vma,
return xchg(pmdp, pmd);
} else {
pmd_t old = *pmdp;
- *pmdp = pmd;
+ WRITE_ONCE(*pmdp, pmd);
return old;
}
}
diff --git a/arch/x86/include/asm/pgtable_64.h b/arch/x86/include/asm/pgtable_64.h
index f773d5e6c8cc..ce2b59047cb8 100644
--- a/arch/x86/include/asm/pgtable_64.h
+++ b/arch/x86/include/asm/pgtable_64.h
@@ -55,15 +55,15 @@ struct mm_struct;
void set_pte_vaddr_p4d(p4d_t *p4d_page, unsigned long vaddr, pte_t new_pte);
void set_pte_vaddr_pud(pud_t *pud_page, unsigned long vaddr, pte_t new_pte);
-static inline void native_pte_clear(struct mm_struct *mm, unsigned long addr,
- pte_t *ptep)
+static inline void native_set_pte(pte_t *ptep, pte_t pte)
{
- *ptep = native_make_pte(0);
+ WRITE_ONCE(*ptep, pte);
}
-static inline void native_set_pte(pte_t *ptep, pte_t pte)
+static inline void native_pte_clear(struct mm_struct *mm, unsigned long addr,
+ pte_t *ptep)
{
- *ptep = pte;
+ native_set_pte(ptep, native_make_pte(0));
}
static inline void native_set_pte_atomic(pte_t *ptep, pte_t pte)
@@ -73,7 +73,7 @@ static inline void native_set_pte_atomic(pte_t *ptep, pte_t pte)
static inline void native_set_pmd(pmd_t *pmdp, pmd_t pmd)
{
- *pmdp = pmd;
+ WRITE_ONCE(*pmdp, pmd);
}
static inline void native_pmd_clear(pmd_t *pmd)
@@ -109,7 +109,7 @@ static inline pmd_t native_pmdp_get_and_clear(pmd_t *xp)
static inline void native_set_pud(pud_t *pudp, pud_t pud)
{
- *pudp = pud;
+ WRITE_ONCE(*pudp, pud);
}
static inline void native_pud_clear(pud_t *pud)
@@ -137,13 +137,13 @@ static inline void native_set_p4d(p4d_t *p4dp, p4d_t p4d)
pgd_t pgd;
if (pgtable_l5_enabled() || !IS_ENABLED(CONFIG_PAGE_TABLE_ISOLATION)) {
- *p4dp = p4d;
+ WRITE_ONCE(*p4dp, p4d);
return;
}
pgd = native_make_pgd(native_p4d_val(p4d));
pgd = pti_set_user_pgtbl((pgd_t *)p4dp, pgd);
- *p4dp = native_make_p4d(native_pgd_val(pgd));
+ WRITE_ONCE(*p4dp, native_make_p4d(native_pgd_val(pgd)));
}
static inline void native_p4d_clear(p4d_t *p4d)
@@ -153,7 +153,7 @@ static inline void native_p4d_clear(p4d_t *p4d)
static inline void native_set_pgd(pgd_t *pgdp, pgd_t pgd)
{
- *pgdp = pti_set_user_pgtbl(pgdp, pgd);
+ WRITE_ONCE(*pgdp, pti_set_user_pgtbl(pgdp, pgd));
}
static inline void native_pgd_clear(pgd_t *pgd)
diff --git a/arch/x86/mm/pgtable.c b/arch/x86/mm/pgtable.c
index e848a4811785..ae394552fb94 100644
--- a/arch/x86/mm/pgtable.c
+++ b/arch/x86/mm/pgtable.c
@@ -269,7 +269,7 @@ static void mop_up_one_pmd(struct mm_struct *mm, pgd_t *pgdp)
if (pgd_val(pgd) != 0) {
pmd_t *pmd = (pmd_t *)pgd_page_vaddr(pgd);
- *pgdp = native_make_pgd(0);
+ pgd_clear(pgdp);
paravirt_release_pmd(pgd_val(pgd) >> PAGE_SHIFT);
pmd_free(mm, pmd);
@@ -494,7 +494,7 @@ int ptep_set_access_flags(struct vm_area_struct *vma,
int changed = !pte_same(*ptep, entry);
if (changed && dirty)
- *ptep = entry;
+ set_pte(ptep, entry);
return changed;
}
@@ -509,7 +509,7 @@ int pmdp_set_access_flags(struct vm_area_struct *vma,
VM_BUG_ON(address & ~HPAGE_PMD_MASK);
if (changed && dirty) {
- *pmdp = entry;
+ set_pmd(pmdp, entry);
/*
* We had a write-protection fault here and changed the pmd
* to to more permissive. No need to flush the TLB for that,
@@ -529,7 +529,7 @@ int pudp_set_access_flags(struct vm_area_struct *vma, unsigned long address,
VM_BUG_ON(address & ~HPAGE_PUD_MASK);
if (changed && dirty) {
- *pudp = entry;
+ set_pud(pudp, entry);
/*
* We had a write-protection fault here and changed the pud
* to to more permissive. No need to flush the TLB for that,
The patch below does not apply to the 4.9-stable tree.
If someone wants it applied there, or to any other stable or longterm
tree, then please email the backport, including the original git commit
id to <stable(a)vger.kernel.org>.
thanks,
greg k-h
------------------ original commit in Linus's tree ------------------
>From c83532fb0fe053d2e43e9387354cb1b52ba26427 Mon Sep 17 00:00:00 2001
From: Alexey Brodkin <abrodkin(a)synopsys.com>
Date: Thu, 2 Aug 2018 11:50:16 +0300
Subject: [PATCH] ARC: [plat-axs*]: Enable SWAP
SWAP support on ARC was fixed earlier by
commit 6e3761145a9b ("ARC: Fix CONFIG_SWAP")
so now we may safely enable it on platforms that
have external media like USB and SD-card.
Note: it was already allowed for HSDK
Signed-off-by: Alexey Brodkin <abrodkin(a)synopsys.com>
Cc: stable(a)vger.kernel.org # 6e3761145a9b: ARC: Fix CONFIG_SWAP
Signed-off-by: Vineet Gupta <vgupta(a)synopsys.com>
diff --git a/arch/arc/configs/axs101_defconfig b/arch/arc/configs/axs101_defconfig
index 41a97eb7598d..41bc08be6a3b 100644
--- a/arch/arc/configs/axs101_defconfig
+++ b/arch/arc/configs/axs101_defconfig
@@ -1,4 +1,3 @@
-# CONFIG_SWAP is not set
CONFIG_SYSVIPC=y
CONFIG_POSIX_MQUEUE=y
# CONFIG_CROSS_MEMORY_ATTACH is not set
diff --git a/arch/arc/configs/axs103_defconfig b/arch/arc/configs/axs103_defconfig
index d8e2ca2385cc..1e1c4a8011b5 100644
--- a/arch/arc/configs/axs103_defconfig
+++ b/arch/arc/configs/axs103_defconfig
@@ -1,4 +1,3 @@
-# CONFIG_SWAP is not set
CONFIG_SYSVIPC=y
CONFIG_POSIX_MQUEUE=y
# CONFIG_CROSS_MEMORY_ATTACH is not set
diff --git a/arch/arc/configs/axs103_smp_defconfig b/arch/arc/configs/axs103_smp_defconfig
index 1e729b9726cd..6b0c0cfd5c30 100644
--- a/arch/arc/configs/axs103_smp_defconfig
+++ b/arch/arc/configs/axs103_smp_defconfig
@@ -1,4 +1,3 @@
-# CONFIG_SWAP is not set
CONFIG_SYSVIPC=y
CONFIG_POSIX_MQUEUE=y
# CONFIG_CROSS_MEMORY_ATTACH is not set
The patch below does not apply to the 4.14-stable tree.
If someone wants it applied there, or to any other stable or longterm
tree, then please email the backport, including the original git commit
id to <stable(a)vger.kernel.org>.
thanks,
greg k-h
------------------ original commit in Linus's tree ------------------
>From c83532fb0fe053d2e43e9387354cb1b52ba26427 Mon Sep 17 00:00:00 2001
From: Alexey Brodkin <abrodkin(a)synopsys.com>
Date: Thu, 2 Aug 2018 11:50:16 +0300
Subject: [PATCH] ARC: [plat-axs*]: Enable SWAP
SWAP support on ARC was fixed earlier by
commit 6e3761145a9b ("ARC: Fix CONFIG_SWAP")
so now we may safely enable it on platforms that
have external media like USB and SD-card.
Note: it was already allowed for HSDK
Signed-off-by: Alexey Brodkin <abrodkin(a)synopsys.com>
Cc: stable(a)vger.kernel.org # 6e3761145a9b: ARC: Fix CONFIG_SWAP
Signed-off-by: Vineet Gupta <vgupta(a)synopsys.com>
diff --git a/arch/arc/configs/axs101_defconfig b/arch/arc/configs/axs101_defconfig
index 41a97eb7598d..41bc08be6a3b 100644
--- a/arch/arc/configs/axs101_defconfig
+++ b/arch/arc/configs/axs101_defconfig
@@ -1,4 +1,3 @@
-# CONFIG_SWAP is not set
CONFIG_SYSVIPC=y
CONFIG_POSIX_MQUEUE=y
# CONFIG_CROSS_MEMORY_ATTACH is not set
diff --git a/arch/arc/configs/axs103_defconfig b/arch/arc/configs/axs103_defconfig
index d8e2ca2385cc..1e1c4a8011b5 100644
--- a/arch/arc/configs/axs103_defconfig
+++ b/arch/arc/configs/axs103_defconfig
@@ -1,4 +1,3 @@
-# CONFIG_SWAP is not set
CONFIG_SYSVIPC=y
CONFIG_POSIX_MQUEUE=y
# CONFIG_CROSS_MEMORY_ATTACH is not set
diff --git a/arch/arc/configs/axs103_smp_defconfig b/arch/arc/configs/axs103_smp_defconfig
index 1e729b9726cd..6b0c0cfd5c30 100644
--- a/arch/arc/configs/axs103_smp_defconfig
+++ b/arch/arc/configs/axs103_smp_defconfig
@@ -1,4 +1,3 @@
-# CONFIG_SWAP is not set
CONFIG_SYSVIPC=y
CONFIG_POSIX_MQUEUE=y
# CONFIG_CROSS_MEMORY_ATTACH is not set
The patch below does not apply to the 4.4-stable tree.
If someone wants it applied there, or to any other stable or longterm
tree, then please email the backport, including the original git commit
id to <stable(a)vger.kernel.org>.
thanks,
greg k-h
------------------ original commit in Linus's tree ------------------
>From 6c3dfeb6a48b1562bd5b8ec5f3317ef34d0134ef Mon Sep 17 00:00:00 2001
From: Sean Christopherson <sean.j.christopherson(a)intel.com>
Date: Thu, 23 Aug 2018 13:56:51 -0700
Subject: [PATCH] KVM: x86: Do not re-{try,execute} after failed emulation in
L2
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Commit a6f177efaa58 ("KVM: Reenter guest after emulation failure if
due to access to non-mmio address") added reexecute_instruction() to
handle the scenario where two (or more) vCPUS race to write a shadowed
page, i.e. reexecute_instruction() is intended to return true if and
only if the instruction being emulated was accessing a shadowed page.
As L0 is only explicitly shadowing L1 tables, an emulation failure of
a nested VM instruction cannot be due to a race to write a shadowed
page and so should never be re-executed.
This fixes an issue where an "MMIO" emulation failure[1] in L2 is all
but guaranteed to result in an infinite loop when TDP is enabled.
Because "cr2" is actually an L2 GPA when TDP is enabled, calling
kvm_mmu_gva_to_gpa_write() to translate cr2 in the non-direct mapped
case (L2 is never direct mapped) will almost always yield UNMAPPED_GVA
and cause reexecute_instruction() to immediately return true. The
!mmio_info_in_cache() check in kvm_mmu_page_fault() doesn't catch this
case because mmio_info_in_cache() returns false for a nested MMU (the
MMIO caching currently handles L1 only, e.g. to cache nested guests'
GPAs we'd have to manually flush the cache when switching between
VMs and when L1 updated its page tables controlling the nested guest).
Way back when, commit 68be0803456b ("KVM: x86: never re-execute
instruction with enabled tdp") changed reexecute_instruction() to
always return false when using TDP under the assumption that KVM would
only get into the emulator for MMIO. Commit 95b3cf69bdf8 ("KVM: x86:
let reexecute_instruction work for tdp") effectively reverted that
behavior in order to handle the scenario where emulation failed due to
an access from L1 to the shadow page tables for L2, but it didn't
account for the case where emulation failed in L2 with TDP enabled.
All of the above logic also applies to retry_instruction(), added by
commit 1cb3f3ae5a38 ("KVM: x86: retry non-page-table writing
instructions"). An indefinite loop in retry_instruction() should be
impossible as it protects against retrying the same instruction over
and over, but it's still correct to not retry an L2 instruction in
the first place.
Fix the immediate issue by adding a check for a nested guest when
determining whether or not to allow retry in kvm_mmu_page_fault().
In addition to fixing the immediate bug, add WARN_ON_ONCE in the
retry functions since they are not designed to handle nested cases,
i.e. they need to be modified even if there is some scenario in the
future where we want to allow retrying a nested guest.
[1] This issue was encountered after commit 3a2936dedd20 ("kvm: mmu:
Don't expose private memslots to L2") changed the page fault path
to return KVM_PFN_NOSLOT when translating an L2 access to a
prive memslot. Returning KVM_PFN_NOSLOT is semantically correct
when we want to hide a memslot from L2, i.e. there effectively is
no defined memory region for L2, but it has the unfortunate side
effect of making KVM think the GFN is a MMIO page, thus triggering
emulation. The failure occurred with in-development code that
deliberately exposed a private memslot to L2, which L2 accessed
with an instruction that is not emulated by KVM.
Fixes: 95b3cf69bdf8 ("KVM: x86: let reexecute_instruction work for tdp")
Fixes: 1cb3f3ae5a38 ("KVM: x86: retry non-page-table writing instructions")
Signed-off-by: Sean Christopherson <sean.j.christopherson(a)intel.com>
Cc: Jim Mattson <jmattson(a)google.com>
Cc: Krish Sadhukhan <krish.sadhukhan(a)oracle.com>
Cc: Xiao Guangrong <xiaoguangrong(a)tencent.com>
Cc: stable(a)vger.kernel.org
Signed-off-by: Radim Krčmář <rkrcmar(a)redhat.com>
diff --git a/arch/x86/kvm/mmu.c b/arch/x86/kvm/mmu.c
index 01fb8701ccd0..f7e83b1e0eb2 100644
--- a/arch/x86/kvm/mmu.c
+++ b/arch/x86/kvm/mmu.c
@@ -5264,9 +5264,12 @@ int kvm_mmu_page_fault(struct kvm_vcpu *vcpu, gva_t cr2, u64 error_code,
* re-execute the instruction that caused the page fault. Do not allow
* retrying MMIO emulation, as it's not only pointless but could also
* cause us to enter an infinite loop because the processor will keep
- * faulting on the non-existent MMIO address.
+ * faulting on the non-existent MMIO address. Retrying an instruction
+ * from a nested guest is also pointless and dangerous as we are only
+ * explicitly shadowing L1's page tables, i.e. unprotecting something
+ * for L1 isn't going to magically fix whatever issue cause L2 to fail.
*/
- if (!mmio_info_in_cache(vcpu, cr2, direct))
+ if (!mmio_info_in_cache(vcpu, cr2, direct) && !is_guest_mode(vcpu))
emulation_type = EMULTYPE_ALLOW_RETRY;
emulate:
/*
diff --git a/arch/x86/kvm/x86.c b/arch/x86/kvm/x86.c
index 924ce28723c4..cbe2921e972b 100644
--- a/arch/x86/kvm/x86.c
+++ b/arch/x86/kvm/x86.c
@@ -5873,6 +5873,9 @@ static bool reexecute_instruction(struct kvm_vcpu *vcpu, gva_t cr2,
if (!(emulation_type & EMULTYPE_ALLOW_RETRY))
return false;
+ if (WARN_ON_ONCE(is_guest_mode(vcpu)))
+ return false;
+
if (!vcpu->arch.mmu.direct_map) {
/*
* Write permission should be allowed since only
@@ -5961,6 +5964,9 @@ static bool retry_instruction(struct x86_emulate_ctxt *ctxt,
if (!(emulation_type & EMULTYPE_ALLOW_RETRY))
return false;
+ if (WARN_ON_ONCE(is_guest_mode(vcpu)))
+ return false;
+
if (x86_page_table_writing_insn(ctxt))
return false;
The patch below does not apply to the 4.9-stable tree.
If someone wants it applied there, or to any other stable or longterm
tree, then please email the backport, including the original git commit
id to <stable(a)vger.kernel.org>.
thanks,
greg k-h
------------------ original commit in Linus's tree ------------------
>From 6c3dfeb6a48b1562bd5b8ec5f3317ef34d0134ef Mon Sep 17 00:00:00 2001
From: Sean Christopherson <sean.j.christopherson(a)intel.com>
Date: Thu, 23 Aug 2018 13:56:51 -0700
Subject: [PATCH] KVM: x86: Do not re-{try,execute} after failed emulation in
L2
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Commit a6f177efaa58 ("KVM: Reenter guest after emulation failure if
due to access to non-mmio address") added reexecute_instruction() to
handle the scenario where two (or more) vCPUS race to write a shadowed
page, i.e. reexecute_instruction() is intended to return true if and
only if the instruction being emulated was accessing a shadowed page.
As L0 is only explicitly shadowing L1 tables, an emulation failure of
a nested VM instruction cannot be due to a race to write a shadowed
page and so should never be re-executed.
This fixes an issue where an "MMIO" emulation failure[1] in L2 is all
but guaranteed to result in an infinite loop when TDP is enabled.
Because "cr2" is actually an L2 GPA when TDP is enabled, calling
kvm_mmu_gva_to_gpa_write() to translate cr2 in the non-direct mapped
case (L2 is never direct mapped) will almost always yield UNMAPPED_GVA
and cause reexecute_instruction() to immediately return true. The
!mmio_info_in_cache() check in kvm_mmu_page_fault() doesn't catch this
case because mmio_info_in_cache() returns false for a nested MMU (the
MMIO caching currently handles L1 only, e.g. to cache nested guests'
GPAs we'd have to manually flush the cache when switching between
VMs and when L1 updated its page tables controlling the nested guest).
Way back when, commit 68be0803456b ("KVM: x86: never re-execute
instruction with enabled tdp") changed reexecute_instruction() to
always return false when using TDP under the assumption that KVM would
only get into the emulator for MMIO. Commit 95b3cf69bdf8 ("KVM: x86:
let reexecute_instruction work for tdp") effectively reverted that
behavior in order to handle the scenario where emulation failed due to
an access from L1 to the shadow page tables for L2, but it didn't
account for the case where emulation failed in L2 with TDP enabled.
All of the above logic also applies to retry_instruction(), added by
commit 1cb3f3ae5a38 ("KVM: x86: retry non-page-table writing
instructions"). An indefinite loop in retry_instruction() should be
impossible as it protects against retrying the same instruction over
and over, but it's still correct to not retry an L2 instruction in
the first place.
Fix the immediate issue by adding a check for a nested guest when
determining whether or not to allow retry in kvm_mmu_page_fault().
In addition to fixing the immediate bug, add WARN_ON_ONCE in the
retry functions since they are not designed to handle nested cases,
i.e. they need to be modified even if there is some scenario in the
future where we want to allow retrying a nested guest.
[1] This issue was encountered after commit 3a2936dedd20 ("kvm: mmu:
Don't expose private memslots to L2") changed the page fault path
to return KVM_PFN_NOSLOT when translating an L2 access to a
prive memslot. Returning KVM_PFN_NOSLOT is semantically correct
when we want to hide a memslot from L2, i.e. there effectively is
no defined memory region for L2, but it has the unfortunate side
effect of making KVM think the GFN is a MMIO page, thus triggering
emulation. The failure occurred with in-development code that
deliberately exposed a private memslot to L2, which L2 accessed
with an instruction that is not emulated by KVM.
Fixes: 95b3cf69bdf8 ("KVM: x86: let reexecute_instruction work for tdp")
Fixes: 1cb3f3ae5a38 ("KVM: x86: retry non-page-table writing instructions")
Signed-off-by: Sean Christopherson <sean.j.christopherson(a)intel.com>
Cc: Jim Mattson <jmattson(a)google.com>
Cc: Krish Sadhukhan <krish.sadhukhan(a)oracle.com>
Cc: Xiao Guangrong <xiaoguangrong(a)tencent.com>
Cc: stable(a)vger.kernel.org
Signed-off-by: Radim Krčmář <rkrcmar(a)redhat.com>
diff --git a/arch/x86/kvm/mmu.c b/arch/x86/kvm/mmu.c
index 01fb8701ccd0..f7e83b1e0eb2 100644
--- a/arch/x86/kvm/mmu.c
+++ b/arch/x86/kvm/mmu.c
@@ -5264,9 +5264,12 @@ int kvm_mmu_page_fault(struct kvm_vcpu *vcpu, gva_t cr2, u64 error_code,
* re-execute the instruction that caused the page fault. Do not allow
* retrying MMIO emulation, as it's not only pointless but could also
* cause us to enter an infinite loop because the processor will keep
- * faulting on the non-existent MMIO address.
+ * faulting on the non-existent MMIO address. Retrying an instruction
+ * from a nested guest is also pointless and dangerous as we are only
+ * explicitly shadowing L1's page tables, i.e. unprotecting something
+ * for L1 isn't going to magically fix whatever issue cause L2 to fail.
*/
- if (!mmio_info_in_cache(vcpu, cr2, direct))
+ if (!mmio_info_in_cache(vcpu, cr2, direct) && !is_guest_mode(vcpu))
emulation_type = EMULTYPE_ALLOW_RETRY;
emulate:
/*
diff --git a/arch/x86/kvm/x86.c b/arch/x86/kvm/x86.c
index 924ce28723c4..cbe2921e972b 100644
--- a/arch/x86/kvm/x86.c
+++ b/arch/x86/kvm/x86.c
@@ -5873,6 +5873,9 @@ static bool reexecute_instruction(struct kvm_vcpu *vcpu, gva_t cr2,
if (!(emulation_type & EMULTYPE_ALLOW_RETRY))
return false;
+ if (WARN_ON_ONCE(is_guest_mode(vcpu)))
+ return false;
+
if (!vcpu->arch.mmu.direct_map) {
/*
* Write permission should be allowed since only
@@ -5961,6 +5964,9 @@ static bool retry_instruction(struct x86_emulate_ctxt *ctxt,
if (!(emulation_type & EMULTYPE_ALLOW_RETRY))
return false;
+ if (WARN_ON_ONCE(is_guest_mode(vcpu)))
+ return false;
+
if (x86_page_table_writing_insn(ctxt))
return false;
The patch below does not apply to the 4.14-stable tree.
If someone wants it applied there, or to any other stable or longterm
tree, then please email the backport, including the original git commit
id to <stable(a)vger.kernel.org>.
thanks,
greg k-h
------------------ original commit in Linus's tree ------------------
>From 6c3dfeb6a48b1562bd5b8ec5f3317ef34d0134ef Mon Sep 17 00:00:00 2001
From: Sean Christopherson <sean.j.christopherson(a)intel.com>
Date: Thu, 23 Aug 2018 13:56:51 -0700
Subject: [PATCH] KVM: x86: Do not re-{try,execute} after failed emulation in
L2
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Commit a6f177efaa58 ("KVM: Reenter guest after emulation failure if
due to access to non-mmio address") added reexecute_instruction() to
handle the scenario where two (or more) vCPUS race to write a shadowed
page, i.e. reexecute_instruction() is intended to return true if and
only if the instruction being emulated was accessing a shadowed page.
As L0 is only explicitly shadowing L1 tables, an emulation failure of
a nested VM instruction cannot be due to a race to write a shadowed
page and so should never be re-executed.
This fixes an issue where an "MMIO" emulation failure[1] in L2 is all
but guaranteed to result in an infinite loop when TDP is enabled.
Because "cr2" is actually an L2 GPA when TDP is enabled, calling
kvm_mmu_gva_to_gpa_write() to translate cr2 in the non-direct mapped
case (L2 is never direct mapped) will almost always yield UNMAPPED_GVA
and cause reexecute_instruction() to immediately return true. The
!mmio_info_in_cache() check in kvm_mmu_page_fault() doesn't catch this
case because mmio_info_in_cache() returns false for a nested MMU (the
MMIO caching currently handles L1 only, e.g. to cache nested guests'
GPAs we'd have to manually flush the cache when switching between
VMs and when L1 updated its page tables controlling the nested guest).
Way back when, commit 68be0803456b ("KVM: x86: never re-execute
instruction with enabled tdp") changed reexecute_instruction() to
always return false when using TDP under the assumption that KVM would
only get into the emulator for MMIO. Commit 95b3cf69bdf8 ("KVM: x86:
let reexecute_instruction work for tdp") effectively reverted that
behavior in order to handle the scenario where emulation failed due to
an access from L1 to the shadow page tables for L2, but it didn't
account for the case where emulation failed in L2 with TDP enabled.
All of the above logic also applies to retry_instruction(), added by
commit 1cb3f3ae5a38 ("KVM: x86: retry non-page-table writing
instructions"). An indefinite loop in retry_instruction() should be
impossible as it protects against retrying the same instruction over
and over, but it's still correct to not retry an L2 instruction in
the first place.
Fix the immediate issue by adding a check for a nested guest when
determining whether or not to allow retry in kvm_mmu_page_fault().
In addition to fixing the immediate bug, add WARN_ON_ONCE in the
retry functions since they are not designed to handle nested cases,
i.e. they need to be modified even if there is some scenario in the
future where we want to allow retrying a nested guest.
[1] This issue was encountered after commit 3a2936dedd20 ("kvm: mmu:
Don't expose private memslots to L2") changed the page fault path
to return KVM_PFN_NOSLOT when translating an L2 access to a
prive memslot. Returning KVM_PFN_NOSLOT is semantically correct
when we want to hide a memslot from L2, i.e. there effectively is
no defined memory region for L2, but it has the unfortunate side
effect of making KVM think the GFN is a MMIO page, thus triggering
emulation. The failure occurred with in-development code that
deliberately exposed a private memslot to L2, which L2 accessed
with an instruction that is not emulated by KVM.
Fixes: 95b3cf69bdf8 ("KVM: x86: let reexecute_instruction work for tdp")
Fixes: 1cb3f3ae5a38 ("KVM: x86: retry non-page-table writing instructions")
Signed-off-by: Sean Christopherson <sean.j.christopherson(a)intel.com>
Cc: Jim Mattson <jmattson(a)google.com>
Cc: Krish Sadhukhan <krish.sadhukhan(a)oracle.com>
Cc: Xiao Guangrong <xiaoguangrong(a)tencent.com>
Cc: stable(a)vger.kernel.org
Signed-off-by: Radim Krčmář <rkrcmar(a)redhat.com>
diff --git a/arch/x86/kvm/mmu.c b/arch/x86/kvm/mmu.c
index 01fb8701ccd0..f7e83b1e0eb2 100644
--- a/arch/x86/kvm/mmu.c
+++ b/arch/x86/kvm/mmu.c
@@ -5264,9 +5264,12 @@ int kvm_mmu_page_fault(struct kvm_vcpu *vcpu, gva_t cr2, u64 error_code,
* re-execute the instruction that caused the page fault. Do not allow
* retrying MMIO emulation, as it's not only pointless but could also
* cause us to enter an infinite loop because the processor will keep
- * faulting on the non-existent MMIO address.
+ * faulting on the non-existent MMIO address. Retrying an instruction
+ * from a nested guest is also pointless and dangerous as we are only
+ * explicitly shadowing L1's page tables, i.e. unprotecting something
+ * for L1 isn't going to magically fix whatever issue cause L2 to fail.
*/
- if (!mmio_info_in_cache(vcpu, cr2, direct))
+ if (!mmio_info_in_cache(vcpu, cr2, direct) && !is_guest_mode(vcpu))
emulation_type = EMULTYPE_ALLOW_RETRY;
emulate:
/*
diff --git a/arch/x86/kvm/x86.c b/arch/x86/kvm/x86.c
index 924ce28723c4..cbe2921e972b 100644
--- a/arch/x86/kvm/x86.c
+++ b/arch/x86/kvm/x86.c
@@ -5873,6 +5873,9 @@ static bool reexecute_instruction(struct kvm_vcpu *vcpu, gva_t cr2,
if (!(emulation_type & EMULTYPE_ALLOW_RETRY))
return false;
+ if (WARN_ON_ONCE(is_guest_mode(vcpu)))
+ return false;
+
if (!vcpu->arch.mmu.direct_map) {
/*
* Write permission should be allowed since only
@@ -5961,6 +5964,9 @@ static bool retry_instruction(struct x86_emulate_ctxt *ctxt,
if (!(emulation_type & EMULTYPE_ALLOW_RETRY))
return false;
+ if (WARN_ON_ONCE(is_guest_mode(vcpu)))
+ return false;
+
if (x86_page_table_writing_insn(ctxt))
return false;