On a 32-bit fast syscall that fails to read its arguments from user
memory, the kernel currently does syscall exit work but not
syscall exit work. This would confuse audit and ptrace.
This is a minimal fix intended for ease of backporting. A more
complete cleanup is coming.
Cc: stable(a)vger.kernel.org
Fixes: 0b085e68f407 ("x86/entry: Consolidate 32/64 bit syscall entry")
Signed-off-by: Andy Lutomirski <luto(a)kernel.org>
---
arch/x86/entry/common.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/arch/x86/entry/common.c b/arch/x86/entry/common.c
index 0904f5676e4d..cf4dcf346ca8 100644
--- a/arch/x86/entry/common.c
+++ b/arch/x86/entry/common.c
@@ -128,7 +128,8 @@ static noinstr bool __do_fast_syscall_32(struct pt_regs *regs)
regs->ax = -EFAULT;
instrumentation_end();
- syscall_exit_to_user_mode(regs);
+ local_irq_disable();
+ exit_to_user_mode();
return false;
}
--
2.29.2
On Tue, Feb 23, 2021 at 1:14 AM Muchun Song <songmuchun(a)bytedance.com> wrote:
>
> We use a global percpu int_active_memcg variable to store the remote
> memcg when we are in the interrupt context. But get_active_memcg always
> return the current->active_memcg or root_mem_cgroup. The remote memcg
> (set in the interrupt context) is ignored. This is not what we want.
> So fix it.
>
> Fixes: 37d5985c003d ("mm: kmem: prepare remote memcg charging infra for interrupt contexts")
> Signed-off-by: Muchun Song <songmuchun(a)bytedance.com>
Good catch.
Cc: stable(a)vger.kernel.org
Reviewed-by: Shakeel Butt <shakeelb(a)google.com>
> ---
> mm/memcontrol.c | 10 +++-------
> 1 file changed, 3 insertions(+), 7 deletions(-)
>
> diff --git a/mm/memcontrol.c b/mm/memcontrol.c
> index be6bc5044150..bbe25655f7eb 100644
> --- a/mm/memcontrol.c
> +++ b/mm/memcontrol.c
> @@ -1061,13 +1061,9 @@ static __always_inline struct mem_cgroup *get_active_memcg(void)
>
> rcu_read_lock();
> memcg = active_memcg();
> - if (memcg) {
> - /* current->active_memcg must hold a ref. */
> - if (WARN_ON_ONCE(!css_tryget(&memcg->css)))
> - memcg = root_mem_cgroup;
> - else
> - memcg = current->active_memcg;
> - }
> + /* remote memcg must hold a ref. */
> + if (memcg && WARN_ON_ONCE(!css_tryget(&memcg->css)))
> + memcg = root_mem_cgroup;
> rcu_read_unlock();
>
> return memcg;
> --
> 2.11.0
>
I'm announcing the release of the 5.10.18 kernel.
All users of the 5.10 kernel series must upgrade.
The updated 5.10.y git tree can be found at:
git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable.git linux-5.10.y
and can be browsed at the normal kernel.org git web browser:
https://git.kernel.org/?p=linux/kernel/git/stable/linux-stable.git;a=summary
thanks,
greg k-h
------------
Makefile | 2
arch/arm/xen/p2m.c | 6 +
arch/x86/xen/p2m.c | 15 +---
drivers/block/xen-blkback/blkback.c | 32 ++++----
drivers/bluetooth/btusb.c | 20 +----
drivers/infiniband/ulp/isert/ib_isert.c | 27 +++++++
drivers/infiniband/ulp/isert/ib_isert.h | 6 +
drivers/media/usb/pwc/pwc-if.c | 22 +++--
drivers/net/wireless/mediatek/mt76/mt7615/mcu.c | 89 +++++++++++++++++-------
drivers/net/wireless/mediatek/mt76/mt7915/mcu.c | 87 ++++++++++++++++++-----
drivers/net/xen-netback/netback.c | 4 -
drivers/tty/tty_io.c | 5 +
drivers/vdpa/vdpa_sim/vdpa_sim.c | 83 ++++++++++++++++------
drivers/xen/gntdev.c | 37 +++++----
drivers/xen/xen-scsiback.c | 4 -
fs/btrfs/ctree.h | 6 -
fs/btrfs/inode.c | 6 +
include/xen/grant_table.h | 1
net/bridge/br.c | 5 +
net/core/dev.c | 2
net/mptcp/protocol.c | 5 +
net/openvswitch/actions.c | 15 +---
net/packet/af_packet.c | 2
net/qrtr/qrtr.c | 2
net/sched/Kconfig | 6 -
net/tls/tls_proc.c | 3
26 files changed, 336 insertions(+), 156 deletions(-)
David Sterba (1):
btrfs: fix backport of 2175bf57dc952 in 5.10.13
Eelco Chaudron (1):
net: openvswitch: fix TTL decrement exception action execution
Felix Fietkau (1):
mt76: mt7915: fix endian issues
Filipe Manana (1):
btrfs: fix crash after non-aligned direct IO write with O_DSYNC
Florian Westphal (1):
mptcp: skip to next candidate if subflow has unacked data
Greg Kroah-Hartman (1):
Linux 5.10.18
Jan Beulich (8):
Xen/x86: don't bail early from clear_foreign_p2m_mapping()
Xen/x86: also check kernel mapping in set_foreign_p2m_mapping()
Xen/gntdev: correct dev_bus_addr handling in gntdev_map_grant_pages()
Xen/gntdev: correct error checking in gntdev_map_grant_pages()
xen-blkback: don't "handle" error by BUG()
xen-netback: don't "handle" error by BUG()
xen-scsiback: don't "handle" error by BUG()
xen-blkback: fix error handling in xen_blkbk_map()
Linus Torvalds (1):
tty: protect tty_write from odd low-level tty disciplines
Loic Poulain (1):
net: qrtr: Fix port ID for control messages
Lorenzo Bianconi (1):
mt76: mt7615: fix rdd mcu cmd endianness
Matwey V. Kornilov (1):
media: pwc: Use correct device for DMA
Max Gurtovoy (2):
vdpa_sim: remove hard-coded virtq count
IB/isert: add module param to set sg_tablesize for IO cmd
Pablo Neira Ayuso (1):
net: sched: incorrect Kconfig dependencies on Netfilter modules
Stefano Garzarella (4):
vdpa_sim: add struct vdpasim_dev_attr for device attributes
vdpa_sim: store parsed MAC address in a buffer
vdpa_sim: make 'config' generic and usable for any device type
vdpa_sim: add get_config callback in vdpasim_dev_attr
Stefano Stabellini (1):
xen/arm: don't ignore return errors from set_phys_to_machine
Trent Piepho (1):
Bluetooth: btusb: Always fallback to alt 1 for WBS
Wang Hai (1):
net: bridge: Fix a warning when del bridge sysfs
Yonatan Linik (1):
net: fix proc_fs init handling in af_packet and tls
wenxu (1):
net/sched: fix miss init the mru in qdisc_skb_cb
Older versions of libelf cannot recognize the compressed section.
However, it's only required to fix the compressed section info when
compiling with CONFIG_DEBUG_INFO_COMPRESSED flag is set.
Only compile the compressed_section_fix function when necessary will make
it easier to enable the BTF function. Since the tool resolve_btfids is
compiled with host toolchain. The host toolchain might be older than the
cross compile toolchain.
Cc: stable(a)vger.kernel.org
Signed-off-by: Kun-Chuan Hsieh <jetswayss(a)gmail.com>
---
tools/bpf/resolve_btfids/main.c | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/tools/bpf/resolve_btfids/main.c b/tools/bpf/resolve_btfids/main.c
index 7409d7860aa6..ad40346c6631 100644
--- a/tools/bpf/resolve_btfids/main.c
+++ b/tools/bpf/resolve_btfids/main.c
@@ -260,6 +260,7 @@ static struct btf_id *add_symbol(struct rb_root *root, char *name, size_t size)
return btf_id__add(root, id, false);
}
+#ifdef CONFIG_DEBUG_INFO_COMPRESSED
/*
* The data of compressed section should be aligned to 4
* (for 32bit) or 8 (for 64 bit) bytes. The binutils ld
@@ -292,6 +293,7 @@ static int compressed_section_fix(Elf *elf, Elf_Scn *scn, GElf_Shdr *sh)
}
return 0;
}
+#endif
static int elf_collect(struct object *obj)
{
@@ -370,8 +372,10 @@ static int elf_collect(struct object *obj)
obj->efile.idlist_addr = sh.sh_addr;
}
+#ifdef CONFIG_DEBUG_INFO_COMPRESSED
if (compressed_section_fix(elf, scn, &sh))
return -1;
+#endif
}
return 0;
--
2.25.1