From: Greg Kroah-Hartman Date: Mon, 20 Jul 2020 13:40:52 +0000 (+0200) Subject: 5.7-stable patches X-Git-Tag: v4.4.231~3 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=e8b07a43e5e1f6560cf9ab5097e9f59f776ba4f2;p=thirdparty%2Fkernel%2Fstable-queue.git 5.7-stable patches 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 --- 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 index 00000000000..98bbdf3f04e --- /dev/null +++ b/queue-5.7/bpf-sockmap-check-value-of-unused-args-to-bpf_prog_attach.patch @@ -0,0 +1,34 @@ +From 9b2b09717e1812e450782a43ca0c2790651cf380 Mon Sep 17 00:00:00 2001 +From: Lorenz Bauer +Date: Mon, 29 Jun 2020 10:56:27 +0100 +Subject: bpf: sockmap: Check value of unused args to BPF_PROG_ATTACH + +From: Lorenz Bauer + +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 +Signed-off-by: Alexei Starovoitov +Link: https://lore.kernel.org/bpf/20200629095630.7933-4-lmb@cloudflare.com +Signed-off-by: Greg Kroah-Hartman + +--- + 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 index 00000000000..8f9f89a9fac --- /dev/null +++ b/queue-5.7/bpf-sockmap-require-attach_bpf_fd-when-detaching-a-program.patch @@ -0,0 +1,181 @@ +From bb0de3131f4c60a9bf976681e0fe4d1e55c7a821 Mon Sep 17 00:00:00 2001 +From: Lorenz Bauer +Date: Mon, 29 Jun 2020 10:56:28 +0100 +Subject: bpf: sockmap: Require attach_bpf_fd when detaching a program + +From: Lorenz Bauer + +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 +Signed-off-by: Alexei Starovoitov +Link: https://lore.kernel.org/bpf/20200629095630.7933-5-lmb@cloudflare.com +Signed-off-by: Greg Kroah-Hartman + +--- + 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 index 00000000000..aeadb1bb00c --- /dev/null +++ b/queue-5.7/drm-i915-perf-use-gtt-when-saving-restoring-engine-gpr.patch @@ -0,0 +1,39 @@ +From aee62e02c48bd62b9b07f5e297ecfc9aaa964937 Mon Sep 17 00:00:00 2001 +From: Umesh Nerlige Ramappa +Date: Thu, 9 Jul 2020 23:45:03 +0100 +Subject: drm/i915/perf: Use GTT when saving/restoring engine GPR + +From: Umesh Nerlige Ramappa + +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 +Signed-off-by: Umesh Nerlige Ramappa +Reviewed-by: Lionel Landwerlin +Reviewed-by: Chris Wilson +Link: https://patchwork.freedesktop.org/patch/msgid/20200709224504.11345-1-chris@chris-wilson.co.uk +Signed-off-by: Chris Wilson +(cherry picked from commit e43ff99c8deda85234e6233e0f4af6cb09566a37) +Signed-off-by: Jani Nikula +Signed-off-by: Greg Kroah-Hartman + +--- + 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 index 00000000000..d3cd98b0e73 --- /dev/null +++ b/queue-5.7/gpio-pca953x-disable-regmap-locking-for-automatic-address-incrementing.patch @@ -0,0 +1,41 @@ +From ec3decd21380081e3b5de4ba8d85d90a95f201a0 Mon Sep 17 00:00:00 2001 +From: Andy Shevchenko +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 + +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 +Signed-off-by: Andy Shevchenko +Reviewed-by: Uwe Kleine-König +Signed-off-by: Bartosz Golaszewski +Signed-off-by: Greg Kroah-Hartman + +--- + 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, + }; diff --git a/queue-5.7/series b/queue-5.7/series index a0954c8b24c..a6825e1d76c 100644 --- a/queue-5.7/series +++ b/queue-5.7/series @@ -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