]> git.ipfire.org Git - thirdparty/kernel/stable-queue.git/commitdiff
5.7-stable patches
authorGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Mon, 20 Jul 2020 13:40:52 +0000 (15:40 +0200)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Mon, 20 Jul 2020 13:40:52 +0000 (15:40 +0200)
added patches:
bpf-sockmap-check-value-of-unused-args-to-bpf_prog_attach.patch
bpf-sockmap-require-attach_bpf_fd-when-detaching-a-program.patch
drm-i915-perf-use-gtt-when-saving-restoring-engine-gpr.patch
gpio-pca953x-disable-regmap-locking-for-automatic-address-incrementing.patch

queue-5.7/bpf-sockmap-check-value-of-unused-args-to-bpf_prog_attach.patch [new file with mode: 0644]
queue-5.7/bpf-sockmap-require-attach_bpf_fd-when-detaching-a-program.patch [new file with mode: 0644]
queue-5.7/drm-i915-perf-use-gtt-when-saving-restoring-engine-gpr.patch [new file with mode: 0644]
queue-5.7/gpio-pca953x-disable-regmap-locking-for-automatic-address-incrementing.patch [new file with mode: 0644]
queue-5.7/series

diff --git a/queue-5.7/bpf-sockmap-check-value-of-unused-args-to-bpf_prog_attach.patch b/queue-5.7/bpf-sockmap-check-value-of-unused-args-to-bpf_prog_attach.patch
new file mode 100644 (file)
index 0000000..98bbdf3
--- /dev/null
@@ -0,0 +1,34 @@
+From 9b2b09717e1812e450782a43ca0c2790651cf380 Mon Sep 17 00:00:00 2001
+From: Lorenz Bauer <lmb@cloudflare.com>
+Date: Mon, 29 Jun 2020 10:56:27 +0100
+Subject: bpf: sockmap: Check value of unused args to BPF_PROG_ATTACH
+
+From: Lorenz Bauer <lmb@cloudflare.com>
+
+commit 9b2b09717e1812e450782a43ca0c2790651cf380 upstream.
+
+Using BPF_PROG_ATTACH on a sockmap program currently understands no
+flags or replace_bpf_fd, but accepts any value. Return EINVAL instead.
+
+Fixes: 604326b41a6f ("bpf, sockmap: convert to generic sk_msg interface")
+Signed-off-by: Lorenz Bauer <lmb@cloudflare.com>
+Signed-off-by: Alexei Starovoitov <ast@kernel.org>
+Link: https://lore.kernel.org/bpf/20200629095630.7933-4-lmb@cloudflare.com
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+
+---
+ net/core/sock_map.c |    3 +++
+ 1 file changed, 3 insertions(+)
+
+--- a/net/core/sock_map.c
++++ b/net/core/sock_map.c
+@@ -70,6 +70,9 @@ int sock_map_get_from_fd(const union bpf
+       struct fd f;
+       int ret;
++      if (attr->attach_flags || attr->replace_bpf_fd)
++              return -EINVAL;
++
+       f = fdget(ufd);
+       map = __bpf_map_get(f);
+       if (IS_ERR(map))
diff --git a/queue-5.7/bpf-sockmap-require-attach_bpf_fd-when-detaching-a-program.patch b/queue-5.7/bpf-sockmap-require-attach_bpf_fd-when-detaching-a-program.patch
new file mode 100644 (file)
index 0000000..8f9f89a
--- /dev/null
@@ -0,0 +1,181 @@
+From bb0de3131f4c60a9bf976681e0fe4d1e55c7a821 Mon Sep 17 00:00:00 2001
+From: Lorenz Bauer <lmb@cloudflare.com>
+Date: Mon, 29 Jun 2020 10:56:28 +0100
+Subject: bpf: sockmap: Require attach_bpf_fd when detaching a program
+
+From: Lorenz Bauer <lmb@cloudflare.com>
+
+commit bb0de3131f4c60a9bf976681e0fe4d1e55c7a821 upstream.
+
+The sockmap code currently ignores the value of attach_bpf_fd when
+detaching a program. This is contrary to the usual behaviour of
+checking that attach_bpf_fd represents the currently attached
+program.
+
+Ensure that attach_bpf_fd is indeed the currently attached
+program. It turns out that all sockmap selftests already do this,
+which indicates that this is unlikely to cause breakage.
+
+Fixes: 604326b41a6f ("bpf, sockmap: convert to generic sk_msg interface")
+Signed-off-by: Lorenz Bauer <lmb@cloudflare.com>
+Signed-off-by: Alexei Starovoitov <ast@kernel.org>
+Link: https://lore.kernel.org/bpf/20200629095630.7933-5-lmb@cloudflare.com
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+
+---
+ include/linux/bpf.h   |   13 +++++++++++--
+ include/linux/skmsg.h |   13 +++++++++++++
+ kernel/bpf/syscall.c  |    2 +-
+ net/core/sock_map.c   |   50 +++++++++++++++++++++++++++++++++++++++++++++-----
+ 4 files changed, 70 insertions(+), 8 deletions(-)
+
+--- a/include/linux/bpf.h
++++ b/include/linux/bpf.h
+@@ -1444,13 +1444,16 @@ static inline void bpf_map_offload_map_f
+ #endif /* CONFIG_NET && CONFIG_BPF_SYSCALL */
+ #if defined(CONFIG_BPF_STREAM_PARSER)
+-int sock_map_prog_update(struct bpf_map *map, struct bpf_prog *prog, u32 which);
++int sock_map_prog_update(struct bpf_map *map, struct bpf_prog *prog,
++                       struct bpf_prog *old, u32 which);
+ int sock_map_get_from_fd(const union bpf_attr *attr, struct bpf_prog *prog);
++int sock_map_prog_detach(const union bpf_attr *attr, enum bpf_prog_type ptype);
+ void sock_map_unhash(struct sock *sk);
+ void sock_map_close(struct sock *sk, long timeout);
+ #else
+ static inline int sock_map_prog_update(struct bpf_map *map,
+-                                     struct bpf_prog *prog, u32 which)
++                                     struct bpf_prog *prog,
++                                     struct bpf_prog *old, u32 which)
+ {
+       return -EOPNOTSUPP;
+ }
+@@ -1460,6 +1463,12 @@ static inline int sock_map_get_from_fd(c
+ {
+       return -EINVAL;
+ }
++
++static inline int sock_map_prog_detach(const union bpf_attr *attr,
++                                     enum bpf_prog_type ptype)
++{
++      return -EOPNOTSUPP;
++}
+ #endif /* CONFIG_BPF_STREAM_PARSER */
+ #if defined(CONFIG_INET) && defined(CONFIG_BPF_SYSCALL)
+--- a/include/linux/skmsg.h
++++ b/include/linux/skmsg.h
+@@ -430,6 +430,19 @@ static inline void psock_set_prog(struct
+               bpf_prog_put(prog);
+ }
++static inline int psock_replace_prog(struct bpf_prog **pprog,
++                                   struct bpf_prog *prog,
++                                   struct bpf_prog *old)
++{
++      if (cmpxchg(pprog, old, prog) != old)
++              return -ENOENT;
++
++      if (old)
++              bpf_prog_put(old);
++
++      return 0;
++}
++
+ static inline void psock_progs_drop(struct sk_psock_progs *progs)
+ {
+       psock_set_prog(&progs->msg_parser, NULL);
+--- a/kernel/bpf/syscall.c
++++ b/kernel/bpf/syscall.c
+@@ -2695,7 +2695,7 @@ static int bpf_prog_detach(const union b
+       switch (ptype) {
+       case BPF_PROG_TYPE_SK_MSG:
+       case BPF_PROG_TYPE_SK_SKB:
+-              return sock_map_get_from_fd(attr, NULL);
++              return sock_map_prog_detach(attr, ptype);
+       case BPF_PROG_TYPE_LIRC_MODE2:
+               return lirc_prog_detach(attr);
+       case BPF_PROG_TYPE_FLOW_DISSECTOR:
+--- a/net/core/sock_map.c
++++ b/net/core/sock_map.c
+@@ -77,7 +77,42 @@ int sock_map_get_from_fd(const union bpf
+       map = __bpf_map_get(f);
+       if (IS_ERR(map))
+               return PTR_ERR(map);
+-      ret = sock_map_prog_update(map, prog, attr->attach_type);
++      ret = sock_map_prog_update(map, prog, NULL, attr->attach_type);
++      fdput(f);
++      return ret;
++}
++
++int sock_map_prog_detach(const union bpf_attr *attr, enum bpf_prog_type ptype)
++{
++      u32 ufd = attr->target_fd;
++      struct bpf_prog *prog;
++      struct bpf_map *map;
++      struct fd f;
++      int ret;
++
++      if (attr->attach_flags || attr->replace_bpf_fd)
++              return -EINVAL;
++
++      f = fdget(ufd);
++      map = __bpf_map_get(f);
++      if (IS_ERR(map))
++              return PTR_ERR(map);
++
++      prog = bpf_prog_get(attr->attach_bpf_fd);
++      if (IS_ERR(prog)) {
++              ret = PTR_ERR(prog);
++              goto put_map;
++      }
++
++      if (prog->type != ptype) {
++              ret = -EINVAL;
++              goto put_prog;
++      }
++
++      ret = sock_map_prog_update(map, NULL, prog, attr->attach_type);
++put_prog:
++      bpf_prog_put(prog);
++put_map:
+       fdput(f);
+       return ret;
+ }
+@@ -1192,27 +1227,32 @@ static struct sk_psock_progs *sock_map_p
+ }
+ int sock_map_prog_update(struct bpf_map *map, struct bpf_prog *prog,
+-                       u32 which)
++                       struct bpf_prog *old, u32 which)
+ {
+       struct sk_psock_progs *progs = sock_map_progs(map);
++      struct bpf_prog **pprog;
+       if (!progs)
+               return -EOPNOTSUPP;
+       switch (which) {
+       case BPF_SK_MSG_VERDICT:
+-              psock_set_prog(&progs->msg_parser, prog);
++              pprog = &progs->msg_parser;
+               break;
+       case BPF_SK_SKB_STREAM_PARSER:
+-              psock_set_prog(&progs->skb_parser, prog);
++              pprog = &progs->skb_parser;
+               break;
+       case BPF_SK_SKB_STREAM_VERDICT:
+-              psock_set_prog(&progs->skb_verdict, prog);
++              pprog = &progs->skb_verdict;
+               break;
+       default:
+               return -EOPNOTSUPP;
+       }
++      if (old)
++              return psock_replace_prog(pprog, prog, old);
++
++      psock_set_prog(pprog, prog);
+       return 0;
+ }
diff --git a/queue-5.7/drm-i915-perf-use-gtt-when-saving-restoring-engine-gpr.patch b/queue-5.7/drm-i915-perf-use-gtt-when-saving-restoring-engine-gpr.patch
new file mode 100644 (file)
index 0000000..aeadb1b
--- /dev/null
@@ -0,0 +1,39 @@
+From aee62e02c48bd62b9b07f5e297ecfc9aaa964937 Mon Sep 17 00:00:00 2001
+From: Umesh Nerlige Ramappa <umesh.nerlige.ramappa@intel.com>
+Date: Thu, 9 Jul 2020 23:45:03 +0100
+Subject: drm/i915/perf: Use GTT when saving/restoring engine GPR
+
+From: Umesh Nerlige Ramappa <umesh.nerlige.ramappa@intel.com>
+
+commit aee62e02c48bd62b9b07f5e297ecfc9aaa964937 upstream.
+
+MI_STORE_REGISTER_MEM and MI_LOAD_REGISTER_MEM need to know which
+translation to use when saving restoring the engine general purpose
+registers to and from the GT scratch. Since GT scratch is mapped to
+ggtt, we need to set an additional bit in the command to use GTT.
+
+Fixes: daed3e44396d17 ("drm/i915/perf: implement active wait for noa configurations")
+Suggested-by: Prathap Kumar Valsan <prathap.kumar.valsan@intel.com>
+Signed-off-by: Umesh Nerlige Ramappa <umesh.nerlige.ramappa@intel.com>
+Reviewed-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
+Reviewed-by: Chris Wilson <chris@chris-wilson.co.uk>
+Link: https://patchwork.freedesktop.org/patch/msgid/20200709224504.11345-1-chris@chris-wilson.co.uk
+Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
+(cherry picked from commit e43ff99c8deda85234e6233e0f4af6cb09566a37)
+Signed-off-by: Jani Nikula <jani.nikula@intel.com>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+
+---
+ drivers/gpu/drm/i915/i915_perf.c |    1 +
+ 1 file changed, 1 insertion(+)
+
+--- a/drivers/gpu/drm/i915/i915_perf.c
++++ b/drivers/gpu/drm/i915/i915_perf.c
+@@ -1645,6 +1645,7 @@ static u32 *save_restore_register(struct
+       u32 d;
+       cmd = save ? MI_STORE_REGISTER_MEM : MI_LOAD_REGISTER_MEM;
++      cmd |= MI_SRM_LRM_GLOBAL_GTT;
+       if (INTEL_GEN(stream->perf->i915) >= 8)
+               cmd++;
diff --git a/queue-5.7/gpio-pca953x-disable-regmap-locking-for-automatic-address-incrementing.patch b/queue-5.7/gpio-pca953x-disable-regmap-locking-for-automatic-address-incrementing.patch
new file mode 100644 (file)
index 0000000..d3cd98b
--- /dev/null
@@ -0,0 +1,41 @@
+From ec3decd21380081e3b5de4ba8d85d90a95f201a0 Mon Sep 17 00:00:00 2001
+From: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
+Date: Fri, 5 Jun 2020 16:40:36 +0300
+Subject: gpio: pca953x: disable regmap locking for automatic address incrementing
+MIME-Version: 1.0
+Content-Type: text/plain; charset=UTF-8
+Content-Transfer-Encoding: 8bit
+
+From: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
+
+commit ec3decd21380081e3b5de4ba8d85d90a95f201a0 upstream.
+
+It's a repetition of the commit aa58a21ae378
+  ("gpio: pca953x: disable regmap locking")
+which states the following:
+
+  This driver uses its own locking but regmap silently uses
+  a mutex for all operations too. Add the option to disable
+  locking to the regmap config struct.
+
+Fixes: bcf41dc480b1 ("gpio: pca953x: fix handling of automatic address incrementing")
+Cc: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
+Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
+Reviewed-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
+Signed-off-by: Bartosz Golaszewski <bgolaszewski@baylibre.com>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+
+---
+ drivers/gpio/gpio-pca953x.c |    1 +
+ 1 file changed, 1 insertion(+)
+
+--- a/drivers/gpio/gpio-pca953x.c
++++ b/drivers/gpio/gpio-pca953x.c
+@@ -399,6 +399,7 @@ static const struct regmap_config pca953
+       .writeable_reg = pca953x_writeable_register,
+       .volatile_reg = pca953x_volatile_register,
++      .disable_locking = true,
+       .cache_type = REGCACHE_RBTREE,
+       .max_register = 0x7f,
+ };
index a0954c8b24c502c713bcac73ae771e783227200d..a6825e1d76c9c32d1a572dc8ad8fc9cc3006acf1 100644 (file)
@@ -238,3 +238,7 @@ ionic-export-features-for-vlans-to-use.patch
 iommu-vt-d-make-intel-svm-code-64-bit-only.patch
 mm-memory.c-properly-pte_offset_map_lock-unlock-in-vm_insert_pages.patch
 drm-i915-gvt-fix-two-cfl-mmio-handling-caused-by-regression.patch
+gpio-pca953x-disable-regmap-locking-for-automatic-address-incrementing.patch
+bpf-sockmap-check-value-of-unused-args-to-bpf_prog_attach.patch
+bpf-sockmap-require-attach_bpf_fd-when-detaching-a-program.patch
+drm-i915-perf-use-gtt-when-saving-restoring-engine-gpr.patch