Patch "netfilter: ipset: fix unaligned atomic access" has been added to the 5.4-stable tree

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



This is a note to let you know that I've just added the patch titled

    netfilter: ipset: fix unaligned atomic access

to the 5.4-stable tree which can be found at:
    http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary

The filename of the patch is:
     netfilter-ipset-fix-unaligned-atomic-access.patch
and it can be found in the queue-5.4 subdirectory.

If you, or anyone else, feels it should not be added to the stable tree,
please let <stable@xxxxxxxxxxxxxxx> know about it.



commit 209fc784db313123165c026c490832bfa68e0b35
Author: Russell King <rmk+kernel@xxxxxxxxxxxxxxx>
Date:   Wed Jun 10 21:51:11 2020 +0100

    netfilter: ipset: fix unaligned atomic access
    
    [ Upstream commit 715028460082d07a7ec6fcd87b14b46784346a72 ]
    
    When using ip_set with counters and comment, traffic causes the kernel
    to panic on 32-bit ARM:
    
    Alignment trap: not handling instruction e1b82f9f at [<bf01b0dc>]
    Unhandled fault: alignment exception (0x221) at 0xea08133c
    PC is at ip_set_match_extensions+0xe0/0x224 [ip_set]
    
    The problem occurs when we try to update the 64-bit counters - the
    faulting address above is not 64-bit aligned.  The problem occurs
    due to the way elements are allocated, for example:
    
            set->dsize = ip_set_elem_len(set, tb, 0, 0);
            map = ip_set_alloc(sizeof(*map) + elements * set->dsize);
    
    If the element has a requirement for a member to be 64-bit aligned,
    and set->dsize is not a multiple of 8, but is a multiple of four,
    then every odd numbered elements will be misaligned - and hitting
    an atomic64_add() on that element will cause the kernel to panic.
    
    ip_set_elem_len() must return a size that is rounded to the maximum
    alignment of any extension field stored in the element.  This change
    ensures that is the case.
    
    Fixes: 95ad1f4a9358 ("netfilter: ipset: Fix extension alignment")
    Signed-off-by: Russell King <rmk+kernel@xxxxxxxxxxxxxxx>
    Acked-by: Jozsef Kadlecsik <kadlec@xxxxxxxxxxxxx>
    Signed-off-by: Pablo Neira Ayuso <pablo@xxxxxxxxxxxxx>
    Signed-off-by: Sasha Levin <sashal@xxxxxxxxxx>

diff --git a/net/netfilter/ipset/ip_set_core.c b/net/netfilter/ipset/ip_set_core.c
index 75da200aa5d87..133a3f1b6f56c 100644
--- a/net/netfilter/ipset/ip_set_core.c
+++ b/net/netfilter/ipset/ip_set_core.c
@@ -382,6 +382,8 @@ ip_set_elem_len(struct ip_set *set, struct nlattr *tb[], size_t len,
 	for (id = 0; id < IPSET_EXT_ID_MAX; id++) {
 		if (!add_extension(id, cadt_flags, tb))
 			continue;
+		if (align < ip_set_extensions[id].align)
+			align = ip_set_extensions[id].align;
 		len = ALIGN(len, ip_set_extensions[id].align);
 		set->offset[id] = len;
 		set->extensions |= ip_set_extensions[id].type;



[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux