aboutsummaryrefslogtreecommitdiffstats
path: root/main/linux-grsec
diff options
context:
space:
mode:
authorNatanael Copa <ncopa@alpinelinux.org>2014-08-15 08:03:55 +0000
committerNatanael Copa <ncopa@alpinelinux.org>2014-08-15 09:37:31 +0000
commitda624881eca8923f22af9c3ecec13e348c588695 (patch)
treece99fe1e1d748d203b32fb43bc075aeef152e564 /main/linux-grsec
parentdab79f88b138f231c0b30510823917ed0a2d1f97 (diff)
downloadaports-da624881eca8923f22af9c3ecec13e348c588695.tar.bz2
aports-da624881eca8923f22af9c3ecec13e348c588695.tar.xz
main/linux-grsec: upgrade to 3.14.16
Diffstat (limited to 'main/linux-grsec')
-rw-r--r--main/linux-grsec/APKBUILD16
-rw-r--r--main/linux-grsec/grsecurity-3.0-3.14.17-201408140021.patch (renamed from main/linux-grsec/grsecurity-3.0-3.14.16-201408110024.patch)986
2 files changed, 73 insertions, 929 deletions
diff --git a/main/linux-grsec/APKBUILD b/main/linux-grsec/APKBUILD
index 4e3286136a..9d8082ce70 100644
--- a/main/linux-grsec/APKBUILD
+++ b/main/linux-grsec/APKBUILD
@@ -2,7 +2,7 @@
_flavor=grsec
pkgname=linux-${_flavor}
-pkgver=3.14.16
+pkgver=3.14.17
case $pkgver in
*.*.*) _kernver=${pkgver%.*};;
*.*) _kernver=${pkgver};;
@@ -17,7 +17,7 @@ _config=${config:-kernelconfig.${CARCH}}
install=
source="http://ftp.kernel.org/pub/linux/kernel/v3.x/linux-$_kernver.tar.xz
http://ftp.kernel.org/pub/linux/kernel/v3.x/patch-$pkgver.xz
- grsecurity-3.0-3.14.16-201408110024.patch
+ grsecurity-3.0-3.14.17-201408140021.patch
fix-memory-map-for-PIE-applications.patch
imx6q-no-unclocked-sleep.patch
@@ -165,24 +165,24 @@ dev() {
}
md5sums="b621207b3f6ecbb67db18b13258f8ea8 linux-3.14.tar.xz
-0c17d6e79e240062a36d4a71a2f7d1f2 patch-3.14.16.xz
-cba8b3e01874c01f982a360cc3aad33f grsecurity-3.0-3.14.16-201408110024.patch
+a9a6539c8df7245c2ab9bfca56f2ef04 patch-3.14.17.xz
+bcd6ccef7af2981f9b7b08e31953d765 grsecurity-3.0-3.14.17-201408140021.patch
c6a4ae7e8ca6159e1631545515805216 fix-memory-map-for-PIE-applications.patch
1a307fc1d63231bf01d22493a4f14378 imx6q-no-unclocked-sleep.patch
dc5e04d422b807e740fd15b141b89a62 kernelconfig.x86
1aea3d3de4013c10712a582c8d738bf7 kernelconfig.x86_64
0d71b1663f7cbfffc6e403deca4bbe86 kernelconfig.armhf"
sha256sums="61558aa490855f42b6340d1a1596be47454909629327c49a5e4e10268065dffa linux-3.14.tar.xz
-3d3e79fd9795812f293aa38799c056aaea0f14da8294b31067f7768e9f38db2d patch-3.14.16.xz
-e27fc08381e4937347b426e5f68149a0917dce79ef4f962b106ae158cdb4a619 grsecurity-3.0-3.14.16-201408110024.patch
+50b0e2a6812597b401a417bd1269b5388fdd980b6009d564fff09605100f0df8 patch-3.14.17.xz
+ee21a2886acb87d01e14ab14e92d1235fe3d2dcc1f474fecba68d712b59a7394 grsecurity-3.0-3.14.17-201408140021.patch
500f3577310be52e87b9fecdc2e9c4ca43210fd97d69089f9005d484563f74c7 fix-memory-map-for-PIE-applications.patch
21179fbb22a5b74af0a609350ae1a170e232908572b201d02e791d2ce0a685d3 imx6q-no-unclocked-sleep.patch
148fe2f06c98716744139f0c92aa702665bb9da96ecc163ef56c8ba3084d534a kernelconfig.x86
1b26e8c006dccce38520b9b42a6ae43230d032307ec847ab77ea97d4616164f6 kernelconfig.x86_64
3cddaac02211dd0f5eb4531aecc3a1427f29dcec7b31d9fe0042192d591bcdc8 kernelconfig.armhf"
sha512sums="5730d83a7a81134c1e77c0bf89e42dee4f8251ad56c1ac2be20c59e26fdfaa7bea55f277e7af156b637f22e1584914a46089af85039177cb43485089c74ac26e linux-3.14.tar.xz
-3004ce119ee9d6a13c8d1af6c3e1bd96794c89a98e914c0a0d80ff96c2a6f41ed3d2108aa86312d4b08646a38c9b47478c136252418a4964476b624e5e1fae70 patch-3.14.16.xz
-f4a1dec548fb2bb2791d3b4a3e53a4f5f52fef95cd81e4d2dac0749474ff646b51b7f06eb9d83b27c9882e803164f7e60139d9781b144a7eba0819d565cf23b3 grsecurity-3.0-3.14.16-201408110024.patch
+03638215934a08a67e3d92d051b6a341e1874872388de910870021934f11f8ed20502a1afbff89a24f0e14053a02f4e40441e2f9878b099ddd1504159ff19872 patch-3.14.17.xz
+c02cf98ab7adae82574240dee155670b60b774cdae8c0b58620e4c9d689b36f998625e536878dbf7ef671317bafaa22d6c81497d17ffba320b0395932ba27b09 grsecurity-3.0-3.14.17-201408140021.patch
4665c56ae1bbac311f9205d64918e84ee8b01d47d6e2396ff6b8adfb10aada7f7254531ce62e31edbb65c2a54a830f09ad05d314dfcd75d6272f4068945ad7c7 fix-memory-map-for-PIE-applications.patch
87d1ad59732f265a5b0db54490dc1762c14ea4b868e7eb1aedc3ce57b48046de7bbc08cf5cfcf6f1380fa84063b0edb16ba3d5e3c5670be9bbb229275c88b221 imx6q-no-unclocked-sleep.patch
65697a0652795bc2f57c74968b4e541b372bf9ebfd8effe9d17b75143f2444a76d41982dddee3c7cda28dc33c88f221b89964282d82761593ec697b5fa77f8d4 kernelconfig.x86
diff --git a/main/linux-grsec/grsecurity-3.0-3.14.16-201408110024.patch b/main/linux-grsec/grsecurity-3.0-3.14.17-201408140021.patch
index cd58a6f54d..1f1739cdbb 100644
--- a/main/linux-grsec/grsecurity-3.0-3.14.16-201408110024.patch
+++ b/main/linux-grsec/grsecurity-3.0-3.14.17-201408140021.patch
@@ -287,7 +287,7 @@ index 7116fda..d8ed6e8 100644
pcd. [PARIDE]
diff --git a/Makefile b/Makefile
-index 8b22e24..7f4d29b 100644
+index 12aac03..33d9e9f 100644
--- a/Makefile
+++ b/Makefile
@@ -244,8 +244,9 @@ CONFIG_SHELL := $(shell if [ -x "$$BASH" ]; then echo $$BASH; \
@@ -9883,142 +9883,6 @@ index 502f632..da1917f 100644
#define __S100 PAGE_READONLY
#define __S101 PAGE_READONLY
#define __S110 PAGE_SHARED
-diff --git a/arch/sparc/include/asm/pgtable_64.h b/arch/sparc/include/asm/pgtable_64.h
-index 0f9e945..a949e55 100644
---- a/arch/sparc/include/asm/pgtable_64.h
-+++ b/arch/sparc/include/asm/pgtable_64.h
-@@ -71,6 +71,23 @@
-
- #include <linux/sched.h>
-
-+extern unsigned long sparc64_valid_addr_bitmap[];
-+
-+/* Needs to be defined here and not in linux/mm.h, as it is arch dependent */
-+static inline bool __kern_addr_valid(unsigned long paddr)
-+{
-+ if ((paddr >> MAX_PHYS_ADDRESS_BITS) != 0UL)
-+ return false;
-+ return test_bit(paddr >> ILOG2_4MB, sparc64_valid_addr_bitmap);
-+}
-+
-+static inline bool kern_addr_valid(unsigned long addr)
-+{
-+ unsigned long paddr = __pa(addr);
-+
-+ return __kern_addr_valid(paddr);
-+}
-+
- /* Entries per page directory level. */
- #define PTRS_PER_PTE (1UL << (PAGE_SHIFT-3))
- #define PTRS_PER_PMD (1UL << PMD_BITS)
-@@ -79,9 +96,12 @@
- /* Kernel has a separate 44bit address space. */
- #define FIRST_USER_ADDRESS 0
-
--#define pte_ERROR(e) __builtin_trap()
--#define pmd_ERROR(e) __builtin_trap()
--#define pgd_ERROR(e) __builtin_trap()
-+#define pmd_ERROR(e) \
-+ pr_err("%s:%d: bad pmd %p(%016lx) seen at (%pS)\n", \
-+ __FILE__, __LINE__, &(e), pmd_val(e), __builtin_return_address(0))
-+#define pgd_ERROR(e) \
-+ pr_err("%s:%d: bad pgd %p(%016lx) seen at (%pS)\n", \
-+ __FILE__, __LINE__, &(e), pgd_val(e), __builtin_return_address(0))
-
- #endif /* !(__ASSEMBLY__) */
-
-@@ -633,7 +653,7 @@ static inline unsigned long pmd_large(pmd_t pmd)
- {
- pte_t pte = __pte(pmd_val(pmd));
-
-- return (pte_val(pte) & _PAGE_PMD_HUGE) && pte_present(pte);
-+ return pte_val(pte) & _PAGE_PMD_HUGE;
- }
-
- #ifdef CONFIG_TRANSPARENT_HUGEPAGE
-@@ -719,20 +739,6 @@ static inline pmd_t pmd_mkwrite(pmd_t pmd)
- return __pmd(pte_val(pte));
- }
-
--static inline pmd_t pmd_mknotpresent(pmd_t pmd)
--{
-- unsigned long mask;
--
-- if (tlb_type == hypervisor)
-- mask = _PAGE_PRESENT_4V;
-- else
-- mask = _PAGE_PRESENT_4U;
--
-- pmd_val(pmd) &= ~mask;
--
-- return pmd;
--}
--
- static inline pmd_t pmd_mksplitting(pmd_t pmd)
- {
- pte_t pte = __pte(pmd_val(pmd));
-@@ -757,6 +763,20 @@ static inline int pmd_present(pmd_t pmd)
-
- #define pmd_none(pmd) (!pmd_val(pmd))
-
-+/* pmd_bad() is only called on non-trans-huge PMDs. Our encoding is
-+ * very simple, it's just the physical address. PTE tables are of
-+ * size PAGE_SIZE so make sure the sub-PAGE_SIZE bits are clear and
-+ * the top bits outside of the range of any physical address size we
-+ * support are clear as well. We also validate the physical itself.
-+ */
-+#define pmd_bad(pmd) ((pmd_val(pmd) & ~PAGE_MASK) || \
-+ !__kern_addr_valid(pmd_val(pmd)))
-+
-+#define pud_none(pud) (!pud_val(pud))
-+
-+#define pud_bad(pud) ((pud_val(pud) & ~PAGE_MASK) || \
-+ !__kern_addr_valid(pud_val(pud)))
-+
- #ifdef CONFIG_TRANSPARENT_HUGEPAGE
- extern void set_pmd_at(struct mm_struct *mm, unsigned long addr,
- pmd_t *pmdp, pmd_t pmd);
-@@ -790,10 +810,7 @@ static inline unsigned long __pmd_page(pmd_t pmd)
- #define pud_page_vaddr(pud) \
- ((unsigned long) __va(pud_val(pud)))
- #define pud_page(pud) virt_to_page((void *)pud_page_vaddr(pud))
--#define pmd_bad(pmd) (0)
- #define pmd_clear(pmdp) (pmd_val(*(pmdp)) = 0UL)
--#define pud_none(pud) (!pud_val(pud))
--#define pud_bad(pud) (0)
- #define pud_present(pud) (pud_val(pud) != 0U)
- #define pud_clear(pudp) (pud_val(*(pudp)) = 0UL)
-
-@@ -893,6 +910,10 @@ extern void update_mmu_cache(struct vm_area_struct *, unsigned long, pte_t *);
- extern void update_mmu_cache_pmd(struct vm_area_struct *vma, unsigned long addr,
- pmd_t *pmd);
-
-+#define __HAVE_ARCH_PMDP_INVALIDATE
-+extern void pmdp_invalidate(struct vm_area_struct *vma, unsigned long address,
-+ pmd_t *pmdp);
-+
- #define __HAVE_ARCH_PGTABLE_DEPOSIT
- extern void pgtable_trans_huge_deposit(struct mm_struct *mm, pmd_t *pmdp,
- pgtable_t pgtable);
-@@ -919,18 +940,6 @@ extern unsigned long pte_file(pte_t);
- extern pte_t pgoff_to_pte(unsigned long);
- #define PTE_FILE_MAX_BITS (64UL - PAGE_SHIFT - 1UL)
-
--extern unsigned long sparc64_valid_addr_bitmap[];
--
--/* Needs to be defined here and not in linux/mm.h, as it is arch dependent */
--static inline bool kern_addr_valid(unsigned long addr)
--{
-- unsigned long paddr = __pa(addr);
--
-- if ((paddr >> 41UL) != 0UL)
-- return false;
-- return test_bit(paddr >> 22, sparc64_valid_addr_bitmap);
--}
--
- extern int page_in_phys_avail(unsigned long paddr);
-
- /*
diff --git a/arch/sparc/include/asm/pgtsrmmu.h b/arch/sparc/include/asm/pgtsrmmu.h
index 79da178..c2eede8 100644
--- a/arch/sparc/include/asm/pgtsrmmu.h
@@ -10196,20 +10060,6 @@ index a5f01ac..703b554 100644
/*
* Thread-synchronous status.
*
-diff --git a/arch/sparc/include/asm/tsb.h b/arch/sparc/include/asm/tsb.h
-index 2230f80..90916f9 100644
---- a/arch/sparc/include/asm/tsb.h
-+++ b/arch/sparc/include/asm/tsb.h
-@@ -171,7 +171,8 @@ extern struct tsb_phys_patch_entry __tsb_phys_patch, __tsb_phys_patch_end;
- andcc REG1, REG2, %g0; \
- be,pt %xcc, 700f; \
- sethi %hi(4 * 1024 * 1024), REG2; \
-- andn REG1, REG2, REG1; \
-+ brgez,pn REG1, FAIL_LABEL; \
-+ andn REG1, REG2, REG1; \
- and VADDR, REG2, REG2; \
- brlz,pt REG1, PTE_LABEL; \
- or REG1, REG2, REG1; \
diff --git a/arch/sparc/include/asm/uaccess.h b/arch/sparc/include/asm/uaccess.h
index 0167d26..767bb0c 100644
--- a/arch/sparc/include/asm/uaccess.h
@@ -10458,7 +10308,7 @@ index c13c9f2..d572c34 100644
if (unlikely(test_thread_flag(TIF_SYSCALL_TRACEPOINT)))
diff --git a/arch/sparc/kernel/smp_64.c b/arch/sparc/kernel/smp_64.c
-index b085311..6f885f7 100644
+index 8416d7f..f83823c 100644
--- a/arch/sparc/kernel/smp_64.c
+++ b/arch/sparc/kernel/smp_64.c
@@ -870,8 +870,8 @@ extern unsigned long xcall_flush_dcache_page_cheetah;
@@ -10958,37 +10808,10 @@ index 4ced92f..965eeed 100644
}
EXPORT_SYMBOL(die_if_kernel);
diff --git a/arch/sparc/kernel/unaligned_64.c b/arch/sparc/kernel/unaligned_64.c
-index 3c1a7cb..9046547 100644
+index 35ab8b6..9046547 100644
--- a/arch/sparc/kernel/unaligned_64.c
+++ b/arch/sparc/kernel/unaligned_64.c
-@@ -166,17 +166,23 @@ static unsigned long *fetch_reg_addr(unsigned int reg, struct pt_regs *regs)
- unsigned long compute_effective_address(struct pt_regs *regs,
- unsigned int insn, unsigned int rd)
- {
-+ int from_kernel = (regs->tstate & TSTATE_PRIV) != 0;
- unsigned int rs1 = (insn >> 14) & 0x1f;
- unsigned int rs2 = insn & 0x1f;
-- int from_kernel = (regs->tstate & TSTATE_PRIV) != 0;
-+ unsigned long addr;
-
- if (insn & 0x2000) {
- maybe_flush_windows(rs1, 0, rd, from_kernel);
-- return (fetch_reg(rs1, regs) + sign_extend_imm13(insn));
-+ addr = (fetch_reg(rs1, regs) + sign_extend_imm13(insn));
- } else {
- maybe_flush_windows(rs1, rs2, rd, from_kernel);
-- return (fetch_reg(rs1, regs) + fetch_reg(rs2, regs));
-+ addr = (fetch_reg(rs1, regs) + fetch_reg(rs2, regs));
- }
-+
-+ if (!from_kernel && test_thread_flag(TIF_32BIT))
-+ addr &= 0xffffffff;
-+
-+ return addr;
- }
-
- /* This is just to make gcc think die_if_kernel does return... */
-@@ -289,7 +295,7 @@ static void log_unaligned(struct pt_regs *regs)
+@@ -295,7 +295,7 @@ static void log_unaligned(struct pt_regs *regs)
static DEFINE_RATELIMIT_STATE(ratelimit, 5 * HZ, 5);
if (__ratelimit(&ratelimit)) {
@@ -11578,7 +11401,7 @@ index 59dbd46..1dd7f5e 100644
if (!(vma->vm_flags & (VM_READ | VM_EXEC)))
goto bad_area;
diff --git a/arch/sparc/mm/fault_64.c b/arch/sparc/mm/fault_64.c
-index 69bb818..3542236 100644
+index 4ced3fc..234f1e4 100644
--- a/arch/sparc/mm/fault_64.c
+++ b/arch/sparc/mm/fault_64.c
@@ -22,6 +22,9 @@
@@ -11600,124 +11423,7 @@ index 69bb818..3542236 100644
printk(KERN_CRIT "OOPS: Fault was to vaddr[%lx]\n", vaddr);
dump_stack();
unhandled_fault(regs->tpc, current, regs);
-@@ -96,38 +99,51 @@ static unsigned int get_user_insn(unsigned long tpc)
- pte_t *ptep, pte;
- unsigned long pa;
- u32 insn = 0;
-- unsigned long pstate;
-
-- if (pgd_none(*pgdp))
-- goto outret;
-+ if (pgd_none(*pgdp) || unlikely(pgd_bad(*pgdp)))
-+ goto out;
- pudp = pud_offset(pgdp, tpc);
-- if (pud_none(*pudp))
-- goto outret;
-- pmdp = pmd_offset(pudp, tpc);
-- if (pmd_none(*pmdp))
-- goto outret;
-+ if (pud_none(*pudp) || unlikely(pud_bad(*pudp)))
-+ goto out;
-
- /* This disables preemption for us as well. */
-- __asm__ __volatile__("rdpr %%pstate, %0" : "=r" (pstate));
-- __asm__ __volatile__("wrpr %0, %1, %%pstate"
-- : : "r" (pstate), "i" (PSTATE_IE));
-- ptep = pte_offset_map(pmdp, tpc);
-- pte = *ptep;
-- if (!pte_present(pte))
-- goto out;
-+ local_irq_disable();
-
-- pa = (pte_pfn(pte) << PAGE_SHIFT);
-- pa += (tpc & ~PAGE_MASK);
-+ pmdp = pmd_offset(pudp, tpc);
-+ if (pmd_none(*pmdp) || unlikely(pmd_bad(*pmdp)))
-+ goto out_irq_enable;
-
-- /* Use phys bypass so we don't pollute dtlb/dcache. */
-- __asm__ __volatile__("lduwa [%1] %2, %0"
-- : "=r" (insn)
-- : "r" (pa), "i" (ASI_PHYS_USE_EC));
-+#ifdef CONFIG_TRANSPARENT_HUGEPAGE
-+ if (pmd_trans_huge(*pmdp)) {
-+ if (pmd_trans_splitting(*pmdp))
-+ goto out_irq_enable;
-
-+ pa = pmd_pfn(*pmdp) << PAGE_SHIFT;
-+ pa += tpc & ~HPAGE_MASK;
-+
-+ /* Use phys bypass so we don't pollute dtlb/dcache. */
-+ __asm__ __volatile__("lduwa [%1] %2, %0"
-+ : "=r" (insn)
-+ : "r" (pa), "i" (ASI_PHYS_USE_EC));
-+ } else
-+#endif
-+ {
-+ ptep = pte_offset_map(pmdp, tpc);
-+ pte = *ptep;
-+ if (pte_present(pte)) {
-+ pa = (pte_pfn(pte) << PAGE_SHIFT);
-+ pa += (tpc & ~PAGE_MASK);
-+
-+ /* Use phys bypass so we don't pollute dtlb/dcache. */
-+ __asm__ __volatile__("lduwa [%1] %2, %0"
-+ : "=r" (insn)
-+ : "r" (pa), "i" (ASI_PHYS_USE_EC));
-+ }
-+ pte_unmap(ptep);
-+ }
-+out_irq_enable:
-+ local_irq_enable();
- out:
-- pte_unmap(ptep);
-- __asm__ __volatile__("wrpr %0, 0x0, %%pstate" : : "r" (pstate));
--outret:
- return insn;
- }
-
-@@ -153,7 +169,8 @@ show_signal_msg(struct pt_regs *regs, int sig, int code,
- }
-
- static void do_fault_siginfo(int code, int sig, struct pt_regs *regs,
-- unsigned int insn, int fault_code)
-+ unsigned long fault_addr, unsigned int insn,
-+ int fault_code)
- {
- unsigned long addr;
- siginfo_t info;
-@@ -161,10 +178,18 @@ static void do_fault_siginfo(int code, int sig, struct pt_regs *regs,
- info.si_code = code;
- info.si_signo = sig;
- info.si_errno = 0;
-- if (fault_code & FAULT_CODE_ITLB)
-+ if (fault_code & FAULT_CODE_ITLB) {
- addr = regs->tpc;
-- else
-- addr = compute_effective_address(regs, insn, 0);
-+ } else {
-+ /* If we were able to probe the faulting instruction, use it
-+ * to compute a precise fault address. Otherwise use the fault
-+ * time provided address which may only have page granularity.
-+ */
-+ if (insn)
-+ addr = compute_effective_address(regs, insn, 0);
-+ else
-+ addr = fault_addr;
-+ }
- info.si_addr = (void __user *) addr;
- info.si_trapno = 0;
-
-@@ -239,7 +264,7 @@ static void __kprobes do_kernel_fault(struct pt_regs *regs, int si_code,
- /* The si_code was set to make clear whether
- * this was a SEGV_MAPERR or SEGV_ACCERR fault.
- */
-- do_fault_siginfo(si_code, SIGSEGV, regs, insn, fault_code);
-+ do_fault_siginfo(si_code, SIGSEGV, regs, address, insn, fault_code);
- return;
- }
-
-@@ -271,6 +296,466 @@ static void noinline __kprobes bogus_32bit_fault_address(struct pt_regs *regs,
+@@ -281,6 +284,466 @@ static void noinline __kprobes bogus_32bit_fault_tpc(struct pt_regs *regs)
show_regs(regs);
}
@@ -12184,7 +11890,7 @@ index 69bb818..3542236 100644
asmlinkage void __kprobes do_sparc64_fault(struct pt_regs *regs)
{
enum ctx_state prev_state = exception_enter();
-@@ -344,6 +829,29 @@ retry:
+@@ -352,6 +815,29 @@ retry:
if (!vma)
goto bad_area;
@@ -12214,28 +11920,6 @@ index 69bb818..3542236 100644
/* Pure DTLB misses do not tell us whether the fault causing
* load/store/atomic was a write or not, it only says that there
* was no match. So in such a case we (carefully) read the
-@@ -525,7 +1033,7 @@ do_sigbus:
- * Send a sigbus, regardless of whether we were in kernel
- * or user mode.
- */
-- do_fault_siginfo(BUS_ADRERR, SIGBUS, regs, insn, fault_code);
-+ do_fault_siginfo(BUS_ADRERR, SIGBUS, regs, address, insn, fault_code);
-
- /* Kernel mode? Handle exceptions or die */
- if (regs->tstate & TSTATE_PRIV)
-diff --git a/arch/sparc/mm/gup.c b/arch/sparc/mm/gup.c
-index c4d3da6..1aed043 100644
---- a/arch/sparc/mm/gup.c
-+++ b/arch/sparc/mm/gup.c
-@@ -73,7 +73,7 @@ static int gup_huge_pmd(pmd_t *pmdp, pmd_t pmd, unsigned long addr,
- struct page *head, *page, *tail;
- int refs;
-
-- if (!pmd_large(pmd))
-+ if (!(pmd_val(pmd) & _PAGE_VALID))
- return 0;
-
- if (write && !pmd_write(pmd))
diff --git a/arch/sparc/mm/hugetlbpage.c b/arch/sparc/mm/hugetlbpage.c
index d329537..2c3746a 100644
--- a/arch/sparc/mm/hugetlbpage.c
@@ -12343,7 +12027,7 @@ index d329537..2c3746a 100644
pte_t *huge_pte_alloc(struct mm_struct *mm,
diff --git a/arch/sparc/mm/init_64.c b/arch/sparc/mm/init_64.c
-index eafbc65..5a8070d 100644
+index 9686224..dfbdb10 100644
--- a/arch/sparc/mm/init_64.c
+++ b/arch/sparc/mm/init_64.c
@@ -188,9 +188,9 @@ unsigned long sparc64_kern_sec_context __read_mostly;
@@ -12367,7 +12051,7 @@ index eafbc65..5a8070d 100644
#endif
#ifdef DCACHE_ALIASING_POSSIBLE
-@@ -466,10 +466,10 @@ void mmu_info(struct seq_file *m)
+@@ -470,10 +470,10 @@ void mmu_info(struct seq_file *m)
#ifdef CONFIG_DEBUG_DCFLUSH
seq_printf(m, "DCPageFlushes\t: %d\n",
@@ -12380,67 +12064,6 @@ index eafbc65..5a8070d 100644
#endif /* CONFIG_SMP */
#endif /* CONFIG_DEBUG_DCFLUSH */
}
-diff --git a/arch/sparc/mm/tlb.c b/arch/sparc/mm/tlb.c
-index b12cb5e..b89aba2 100644
---- a/arch/sparc/mm/tlb.c
-+++ b/arch/sparc/mm/tlb.c
-@@ -134,7 +134,7 @@ no_cache_flush:
-
- #ifdef CONFIG_TRANSPARENT_HUGEPAGE
- static void tlb_batch_pmd_scan(struct mm_struct *mm, unsigned long vaddr,
-- pmd_t pmd, bool exec)
-+ pmd_t pmd)
- {
- unsigned long end;
- pte_t *pte;
-@@ -142,8 +142,11 @@ static void tlb_batch_pmd_scan(struct mm_struct *mm, unsigned long vaddr,
- pte = pte_offset_map(&pmd, vaddr);
- end = vaddr + HPAGE_SIZE;
- while (vaddr < end) {
-- if (pte_val(*pte) & _PAGE_VALID)
-+ if (pte_val(*pte) & _PAGE_VALID) {
-+ bool exec = pte_exec(*pte);
-+
- tlb_batch_add_one(mm, vaddr, exec);
-+ }
- pte++;
- vaddr += PAGE_SIZE;
- }
-@@ -177,19 +180,30 @@ void set_pmd_at(struct mm_struct *mm, unsigned long addr,
- }
-
- if (!pmd_none(orig)) {
-- pte_t orig_pte = __pte(pmd_val(orig));
-- bool exec = pte_exec(orig_pte);
--
- addr &= HPAGE_MASK;
- if (pmd_trans_huge(orig)) {
-+ pte_t orig_pte = __pte(pmd_val(orig));
-+ bool exec = pte_exec(orig_pte);
-+
- tlb_batch_add_one(mm, addr, exec);
- tlb_batch_add_one(mm, addr + REAL_HPAGE_SIZE, exec);
- } else {
-- tlb_batch_pmd_scan(mm, addr, orig, exec);
-+ tlb_batch_pmd_scan(mm, addr, orig);
- }
- }
- }
-
-+void pmdp_invalidate(struct vm_area_struct *vma, unsigned long address,
-+ pmd_t *pmdp)
-+{
-+ pmd_t entry = *pmdp;
-+
-+ pmd_val(entry) &= ~_PAGE_VALID;
-+
-+ set_pmd_at(vma->vm_mm, address, pmdp, entry);
-+ flush_tlb_range(vma, address, address + HPAGE_PMD_SIZE);
-+}
-+
- void pgtable_trans_huge_deposit(struct mm_struct *mm, pmd_t *pmdp,
- pgtable_t pgtable)
- {
diff --git a/arch/tile/Kconfig b/arch/tile/Kconfig
index b3692ce..e4517c9 100644
--- a/arch/tile/Kconfig
@@ -47122,10 +46745,10 @@ index bf0d55e..82bcfbd1 100644
priv = netdev_priv(dev);
priv->phy = phy;
diff --git a/drivers/net/macvlan.c b/drivers/net/macvlan.c
-index 5adecc5..aec7730 100644
+index 7f1abb7..6434b33 100644
--- a/drivers/net/macvlan.c
+++ b/drivers/net/macvlan.c
-@@ -991,13 +991,15 @@ static const struct nla_policy macvlan_policy[IFLA_MACVLAN_MAX + 1] = {
+@@ -992,13 +992,15 @@ static const struct nla_policy macvlan_policy[IFLA_MACVLAN_MAX + 1] = {
int macvlan_link_register(struct rtnl_link_ops *ops)
{
/* common fields */
@@ -47148,7 +46771,7 @@ index 5adecc5..aec7730 100644
return rtnl_link_register(ops);
};
-@@ -1051,7 +1053,7 @@ static int macvlan_device_event(struct notifier_block *unused,
+@@ -1052,7 +1054,7 @@ static int macvlan_device_event(struct notifier_block *unused,
return NOTIFY_DONE;
}
@@ -47201,19 +46824,6 @@ index 72ff14b..11d442d 100644
break;
err = 0;
break;
-diff --git a/drivers/net/ppp/pptp.c b/drivers/net/ppp/pptp.c
-index 0180531..1aff970 100644
---- a/drivers/net/ppp/pptp.c
-+++ b/drivers/net/ppp/pptp.c
-@@ -281,7 +281,7 @@ static int pptp_xmit(struct ppp_channel *chan, struct sk_buff *skb)
- nf_reset(skb);
-
- skb->ip_summed = CHECKSUM_NONE;
-- ip_select_ident(skb, &rt->dst, NULL);
-+ ip_select_ident(skb, NULL);
- ip_send_check(iph);
-
- ip_local_out(skb);
diff --git a/drivers/net/slip/slhc.c b/drivers/net/slip/slhc.c
index 1252d9c..80e660b 100644
--- a/drivers/net/slip/slhc.c
@@ -84291,52 +83901,20 @@ index c55aeed..b3393f4 100644
/** inet_connection_sock - INET connection oriented sock
*
diff --git a/include/net/inetpeer.h b/include/net/inetpeer.h
-index 058271b..1af4453 100644
+index 823ec7b..1af4453 100644
--- a/include/net/inetpeer.h
+++ b/include/net/inetpeer.h
-@@ -41,14 +41,13 @@ struct inet_peer {
- struct rcu_head gc_rcu;
- };
- /*
-- * Once inet_peer is queued for deletion (refcnt == -1), following fields
-- * are not available: rid, ip_id_count
-+ * Once inet_peer is queued for deletion (refcnt == -1), following field
-+ * is not available: rid
- * We can share memory with rcu_head to help keep inet_peer small.
+@@ -47,7 +47,7 @@ struct inet_peer {
*/
union {
struct {
- atomic_t rid; /* Frag reception counter */
-- atomic_t ip_id_count; /* IP ID for the next packet */
+ atomic_unchecked_t rid; /* Frag reception counter */
};
struct rcu_head rcu;
struct inet_peer *gc_next;
-@@ -165,7 +164,7 @@ bool inet_peer_xrlim_allow(struct inet_peer *peer, int timeout);
- void inetpeer_invalidate_tree(struct inet_peer_base *);
-
- /*
-- * temporary check to make sure we dont access rid, ip_id_count, tcp_ts,
-+ * temporary check to make sure we dont access rid, tcp_ts,
- * tcp_ts_stamp if no refcount is taken on inet_peer
- */
- static inline void inet_peer_refcheck(const struct inet_peer *p)
-@@ -173,13 +172,4 @@ static inline void inet_peer_refcheck(const struct inet_peer *p)
- WARN_ON_ONCE(atomic_read(&p->refcnt) <= 0);
- }
-
--
--/* can be called with or without local BH being disabled */
--static inline int inet_getid(struct inet_peer *p, int more)
--{
-- more++;
-- inet_peer_refcheck(p);
-- return atomic_add_return(more, &p->ip_id_count) - more;
--}
--
- #endif /* _NET_INETPEER_H */
diff --git a/include/net/ip.h b/include/net/ip.h
-index 23be0fd..7251808 100644
+index 937f196..7251808 100644
--- a/include/net/ip.h
+++ b/include/net/ip.h
@@ -214,7 +214,7 @@ static inline void snmp_mib_free(void __percpu *ptr[SNMP_ARRAY_SZ])
@@ -84348,55 +83926,15 @@ index 23be0fd..7251808 100644
static inline int inet_is_reserved_local_port(int port)
{
return test_bit(port, sysctl_local_reserved_ports);
-@@ -297,9 +297,10 @@ static inline unsigned int ip_skb_dst_mtu(const struct sk_buff *skb)
+@@ -297,7 +297,7 @@ static inline unsigned int ip_skb_dst_mtu(const struct sk_buff *skb)
}
}
--void __ip_select_ident(struct iphdr *iph, struct dst_entry *dst, int more);
+-u32 ip_idents_reserve(u32 hash, int segs);
+u32 ip_idents_reserve(u32 hash, int segs) __intentional_overflow(-1);
-+void __ip_select_ident(struct iphdr *iph, int segs);
-
--static inline void ip_select_ident(struct sk_buff *skb, struct dst_entry *dst, struct sock *sk)
-+static inline void ip_select_ident_segs(struct sk_buff *skb, struct sock *sk, int segs)
- {
- struct iphdr *iph = ip_hdr(skb);
-
-@@ -309,24 +310,20 @@ static inline void ip_select_ident(struct sk_buff *skb, struct dst_entry *dst, s
- * does not change, they drop every other packet in
- * a TCP stream using header compression.
- */
-- iph->id = (sk && inet_sk(sk)->inet_daddr) ?
-- htons(inet_sk(sk)->inet_id++) : 0;
-- } else
-- __ip_select_ident(iph, dst, 0);
--}
--
--static inline void ip_select_ident_more(struct sk_buff *skb, struct dst_entry *dst, struct sock *sk, int more)
--{
-- struct iphdr *iph = ip_hdr(skb);
--
-- if ((iph->frag_off & htons(IP_DF)) && !skb->local_df) {
- if (sk && inet_sk(sk)->inet_daddr) {
- iph->id = htons(inet_sk(sk)->inet_id);
-- inet_sk(sk)->inet_id += 1 + more;
-- } else
-+ inet_sk(sk)->inet_id += segs;
-+ } else {
- iph->id = 0;
-- } else
-- __ip_select_ident(iph, dst, more);
-+ }
-+ } else {
-+ __ip_select_ident(iph, segs);
-+ }
-+}
-+
-+static inline void ip_select_ident(struct sk_buff *skb, struct sock *sk)
-+{
-+ ip_select_ident_segs(skb, sk, 1);
- }
+ void __ip_select_ident(struct iphdr *iph, int segs);
- /*
+ static inline void ip_select_ident_segs(struct sk_buff *skb, struct sock *sk, int segs)
diff --git a/include/net/ip_fib.h b/include/net/ip_fib.h
index 9922093..a1755d6 100644
--- a/include/net/ip_fib.h
@@ -84446,19 +83984,6 @@ index 5679d92..2e7a690 100644
/* ip_vs_est */
struct list_head est_list; /* estimator list */
spinlock_t est_lock;
-diff --git a/include/net/ipv6.h b/include/net/ipv6.h
-index 4f541f1..9ac6578 100644
---- a/include/net/ipv6.h
-+++ b/include/net/ipv6.h
-@@ -660,8 +660,6 @@ static inline int ipv6_addr_diff(const struct in6_addr *a1, const struct in6_add
- return __ipv6_addr_diff(a1, a2, sizeof(struct in6_addr));
- }
-
--void ipv6_select_ident(struct frag_hdr *fhdr, struct rt6_info *rt);
--
- int ip6_dst_hoplimit(struct dst_entry *dst);
-
- /*
diff --git a/include/net/irda/ircomm_tty.h b/include/net/irda/ircomm_tty.h
index 8d4f588..2e37ad2 100644
--- a/include/net/irda/ircomm_tty.h
@@ -84859,19 +84384,6 @@ index 0dfcc92..7967849 100644
/* Structure to track chunk fragments that have been acked, but peer
-diff --git a/include/net/secure_seq.h b/include/net/secure_seq.h
-index f257486..3f36d45 100644
---- a/include/net/secure_seq.h
-+++ b/include/net/secure_seq.h
-@@ -3,8 +3,6 @@
-
- #include <linux/types.h>
-
--__u32 secure_ip_id(__be32 daddr);
--__u32 secure_ipv6_id(const __be32 daddr[4]);
- u32 secure_ipv4_port_ephemeral(__be32 saddr, __be32 daddr, __be16 dport);
- u32 secure_ipv6_port_ephemeral(const __be32 *saddr, const __be32 *daddr,
- __be16 dport);
diff --git a/include/net/sock.h b/include/net/sock.h
index 2f7bc43..530dadc 100644
--- a/include/net/sock.h
@@ -98413,10 +97925,10 @@ index d074d06..ad3cfcf 100644
if (ogm_packet->flags & BATADV_DIRECTLINK)
has_directlink_flag = true;
diff --git a/net/batman-adv/fragmentation.c b/net/batman-adv/fragmentation.c
-index cc1cfd6..7a68e022 100644
+index c46387a..6ad5ef9 100644
--- a/net/batman-adv/fragmentation.c
+++ b/net/batman-adv/fragmentation.c
-@@ -446,7 +446,7 @@ bool batadv_frag_send_packet(struct sk_buff *skb,
+@@ -450,7 +450,7 @@ bool batadv_frag_send_packet(struct sk_buff *skb,
frag_header.packet_type = BATADV_UNICAST_FRAG;
frag_header.version = BATADV_COMPAT_VERSION;
frag_header.ttl = BATADV_TTL;
@@ -98779,7 +98291,7 @@ index 988721a..947846d 100644
switch (ss->ss_family) {
diff --git a/net/compat.c b/net/compat.c
-index f50161f..ab7644e 100644
+index cbc1a2a..ab7644e 100644
--- a/net/compat.c
+++ b/net/compat.c
@@ -73,9 +73,9 @@ int get_compat_msghdr(struct msghdr *kmsg, struct compat_msghdr __user *umsg)
@@ -98795,28 +98307,17 @@ index f50161f..ab7644e 100644
return 0;
}
-@@ -85,21 +85,22 @@ int verify_compat_iovec(struct msghdr *kern_msg, struct iovec *kern_iov,
- {
- int tot_len;
+@@ -87,7 +87,7 @@ int verify_compat_iovec(struct msghdr *kern_msg, struct iovec *kern_iov,
-- if (kern_msg->msg_namelen) {
-+ if (kern_msg->msg_name && kern_msg->msg_namelen) {
+ if (kern_msg->msg_name && kern_msg->msg_namelen) {
if (mode == VERIFY_READ) {
- int err = move_addr_to_kernel(kern_msg->msg_name,
+ int err = move_addr_to_kernel((void __force_user *)kern_msg->msg_name,
kern_msg->msg_namelen,
kern_address);
if (err < 0)
- return err;
- }
-- if (kern_msg->msg_name)
-- kern_msg->msg_name = kern_address;
-- } else
-+ kern_msg->msg_name = kern_address;
-+ } else {
- kern_msg->msg_name = NULL;
-+ kern_msg->msg_namelen = 0;
-+ }
+@@ -100,7 +100,7 @@ int verify_compat_iovec(struct msghdr *kern_msg, struct iovec *kern_iov,
+ }
tot_len = iov_from_user_compat_to_kern(kern_iov,
- (struct compat_iovec __user *)kern_msg->msg_iov,
@@ -98824,7 +98325,7 @@ index f50161f..ab7644e 100644
kern_msg->msg_iovlen);
if (tot_len >= 0)
kern_msg->msg_iov = kern_iov;
-@@ -119,20 +120,20 @@ int verify_compat_iovec(struct msghdr *kern_msg, struct iovec *kern_iov,
+@@ -120,20 +120,20 @@ int verify_compat_iovec(struct msghdr *kern_msg, struct iovec *kern_iov,
#define CMSG_COMPAT_FIRSTHDR(msg) \
(((msg)->msg_controllen) >= sizeof(struct compat_cmsghdr) ? \
@@ -98848,7 +98349,7 @@ index f50161f..ab7644e 100644
msg->msg_controllen)
return NULL;
return (struct compat_cmsghdr __user *)ptr;
-@@ -222,7 +223,7 @@ Efault:
+@@ -223,7 +223,7 @@ Efault:
int put_cmsg_compat(struct msghdr *kmsg, int level, int type, int len, void *data)
{
@@ -98857,7 +98358,7 @@ index f50161f..ab7644e 100644
struct compat_cmsghdr cmhdr;
struct compat_timeval ctv;
struct compat_timespec cts[3];
-@@ -278,7 +279,7 @@ int put_cmsg_compat(struct msghdr *kmsg, int level, int type, int len, void *dat
+@@ -279,7 +279,7 @@ int put_cmsg_compat(struct msghdr *kmsg, int level, int type, int len, void *dat
void scm_detach_fds_compat(struct msghdr *kmsg, struct scm_cookie *scm)
{
@@ -98866,7 +98367,7 @@ index f50161f..ab7644e 100644
int fdmax = (kmsg->msg_controllen - sizeof(struct compat_cmsghdr)) / sizeof(int);
int fdnum = scm->fp->count;
struct file **fp = scm->fp->fp;
-@@ -366,7 +367,7 @@ static int do_set_sock_timeout(struct socket *sock, int level,
+@@ -367,7 +367,7 @@ static int do_set_sock_timeout(struct socket *sock, int level,
return -EFAULT;
old_fs = get_fs();
set_fs(KERNEL_DS);
@@ -98875,7 +98376,7 @@ index f50161f..ab7644e 100644
set_fs(old_fs);
return err;
-@@ -427,7 +428,7 @@ static int do_get_sock_timeout(struct socket *sock, int level, int optname,
+@@ -428,7 +428,7 @@ static int do_get_sock_timeout(struct socket *sock, int level, int optname,
len = sizeof(ktime);
old_fs = get_fs();
set_fs(KERNEL_DS);
@@ -98884,7 +98385,7 @@ index f50161f..ab7644e 100644
set_fs(old_fs);
if (!err) {
-@@ -570,7 +571,7 @@ int compat_mc_setsockopt(struct sock *sock, int level, int optname,
+@@ -571,7 +571,7 @@ int compat_mc_setsockopt(struct sock *sock, int level, int optname,
case MCAST_JOIN_GROUP:
case MCAST_LEAVE_GROUP:
{
@@ -98893,7 +98394,7 @@ index f50161f..ab7644e 100644
struct group_req __user *kgr =
compat_alloc_user_space(sizeof(struct group_req));
u32 interface;
-@@ -591,7 +592,7 @@ int compat_mc_setsockopt(struct sock *sock, int level, int optname,
+@@ -592,7 +592,7 @@ int compat_mc_setsockopt(struct sock *sock, int level, int optname,
case MCAST_BLOCK_SOURCE:
case MCAST_UNBLOCK_SOURCE:
{
@@ -98902,7 +98403,7 @@ index f50161f..ab7644e 100644
struct group_source_req __user *kgsr = compat_alloc_user_space(
sizeof(struct group_source_req));
u32 interface;
-@@ -612,7 +613,7 @@ int compat_mc_setsockopt(struct sock *sock, int level, int optname,
+@@ -613,7 +613,7 @@ int compat_mc_setsockopt(struct sock *sock, int level, int optname,
}
case MCAST_MSFILTER:
{
@@ -98911,7 +98412,7 @@ index f50161f..ab7644e 100644
struct group_filter __user *kgf;
u32 interface, fmode, numsrc;
-@@ -650,7 +651,7 @@ int compat_mc_getsockopt(struct sock *sock, int level, int optname,
+@@ -651,7 +651,7 @@ int compat_mc_getsockopt(struct sock *sock, int level, int optname,
char __user *optval, int __user *optlen,
int (*getsockopt)(struct sock *, int, int, char __user *, int __user *))
{
@@ -98920,7 +98421,7 @@ index f50161f..ab7644e 100644
struct group_filter __user *kgf;
int __user *koptlen;
u32 interface, fmode, numsrc;
-@@ -803,7 +804,7 @@ asmlinkage long compat_sys_socketcall(int call, u32 __user *args)
+@@ -804,7 +804,7 @@ asmlinkage long compat_sys_socketcall(int call, u32 __user *args)
if (call < SYS_SOCKET || call > SYS_SENDMMSG)
return -EINVAL;
@@ -99145,15 +98646,11 @@ index dfa602c..3103d88 100644
fle->object = flo;
else
diff --git a/net/core/iovec.c b/net/core/iovec.c
-index b618694..cd5f0af 100644
+index 26dc006..89e838e 100644
--- a/net/core/iovec.c
+++ b/net/core/iovec.c
-@@ -39,23 +39,23 @@ int verify_iovec(struct msghdr *m, struct iovec *iov, struct sockaddr_storage *a
- {
- int size, ct, err;
-
-- if (m->msg_namelen) {
-+ if (m->msg_name && m->msg_namelen) {
+@@ -42,7 +42,7 @@ int verify_iovec(struct msghdr *m, struct iovec *iov, struct sockaddr_storage *a
+ if (m->msg_name && m->msg_namelen) {
if (mode == VERIFY_READ) {
void __user *namep;
- namep = (void __user __force *) m->msg_name;
@@ -99161,14 +98658,7 @@ index b618694..cd5f0af 100644
err = move_addr_to_kernel(namep, m->msg_namelen,
address);
if (err < 0)
- return err;
- }
-- if (m->msg_name)
-- m->msg_name = address;
-+ m->msg_name = address;
- } else {
- m->msg_name = NULL;
-+ m->msg_namelen = 0;
+@@ -55,7 +55,7 @@ int verify_iovec(struct msghdr *m, struct iovec *iov, struct sockaddr_storage *a
}
size = m->msg_iovlen * sizeof(struct iovec);
@@ -99421,44 +98911,8 @@ index b442e7e..6f5b5a2 100644
i++, cmfptr++)
{
struct socket *sock;
-diff --git a/net/core/secure_seq.c b/net/core/secure_seq.c
-index 897da56..ba71212 100644
---- a/net/core/secure_seq.c
-+++ b/net/core/secure_seq.c
-@@ -85,31 +85,6 @@ EXPORT_SYMBOL(secure_ipv6_port_ephemeral);
- #endif
-
- #ifdef CONFIG_INET
--__u32 secure_ip_id(__be32 daddr)
--{
-- u32 hash[MD5_DIGEST_WORDS];
--
-- net_secret_init();
-- hash[0] = (__force __u32) daddr;
-- hash[1] = net_secret[13];
-- hash[2] = net_secret[14];
-- hash[3] = net_secret[15];
--
-- md5_transform(hash, net_secret);
--
-- return hash[0];
--}
--
--__u32 secure_ipv6_id(const __be32 daddr[4])
--{
-- __u32 hash[4];
--
-- net_secret_init();
-- memcpy(hash, daddr, 16);
-- md5_transform(hash, net_secret);
--
-- return hash[0];
--}
-
- __u32 secure_tcp_sequence_number(__be32 saddr, __be32 daddr,
- __be16 sport, __be16 dport)
diff --git a/net/core/skbuff.c b/net/core/skbuff.c
-index 7f2e1fc..6206b10 100644
+index 8f6391b..40bc442 100644
--- a/net/core/skbuff.c
+++ b/net/core/skbuff.c
@@ -2003,7 +2003,7 @@ EXPORT_SYMBOL(__skb_checksum);
@@ -99921,28 +99375,6 @@ index 9d43468..ffa28cc 100644
return nh->nh_saddr;
}
-diff --git a/net/ipv4/igmp.c b/net/ipv4/igmp.c
-index 9db3b87..0ffcd4d 100644
---- a/net/ipv4/igmp.c
-+++ b/net/ipv4/igmp.c
-@@ -369,7 +369,7 @@ static struct sk_buff *igmpv3_newpack(struct net_device *dev, int size)
- pip->saddr = fl4.saddr;
- pip->protocol = IPPROTO_IGMP;
- pip->tot_len = 0; /* filled in later */
-- ip_select_ident(skb, &rt->dst, NULL);
-+ ip_select_ident(skb, NULL);
- ((u8 *)&pip[1])[0] = IPOPT_RA;
- ((u8 *)&pip[1])[1] = 4;
- ((u8 *)&pip[1])[2] = 0;
-@@ -714,7 +714,7 @@ static int igmp_send_report(struct in_device *in_dev, struct ip_mc_list *pmc,
- iph->daddr = dst;
- iph->saddr = fl4.saddr;
- iph->protocol = IPPROTO_IGMP;
-- ip_select_ident(skb, &rt->dst, NULL);
-+ ip_select_ident(skb, NULL);
- ((u8 *)&iph[1])[0] = IPOPT_RA;
- ((u8 *)&iph[1])[1] = 4;
- ((u8 *)&iph[1])[2] = 0;
diff --git a/net/ipv4/inet_connection_sock.c b/net/ipv4/inet_connection_sock.c
index 0d1e2cb..4501a2c 100644
--- a/net/ipv4/inet_connection_sock.c
@@ -99987,47 +99419,14 @@ index 8b9cf27..0d8d592 100644
inet_twsk_deschedule(tw, death_row);
while (twrefcnt) {
diff --git a/net/ipv4/inetpeer.c b/net/ipv4/inetpeer.c
-index 48f4244..d83ba8a 100644
+index bf2cb4a..d83ba8a 100644
--- a/net/ipv4/inetpeer.c
+++ b/net/ipv4/inetpeer.c
-@@ -26,20 +26,7 @@
- * Theory of operations.
- * We keep one entry for each peer IP address. The nodes contains long-living
- * information about the peer which doesn't depend on routes.
-- * At this moment this information consists only of ID field for the next
-- * outgoing IP packet. This field is incremented with each packet as encoded
-- * in inet_getid() function (include/net/inetpeer.h).
-- * At the moment of writing this notes identifier of IP packets is generated
-- * to be unpredictable using this code only for packets subjected
-- * (actually or potentially) to defragmentation. I.e. DF packets less than
-- * PMTU in size when local fragmentation is disabled use a constant ID and do
-- * not use this code (see ip_select_ident() in include/net/ip.h).
- *
-- * Route cache entries hold references to our nodes.
-- * New cache entries get references via lookup by destination IP address in
-- * the avl tree. The reference is grabbed only when it's needed i.e. only
-- * when we try to output IP packet which needs an unpredictable ID (see
-- * __ip_select_ident() in net/ipv4/route.c).
- * Nodes are removed only when reference counter goes to 0.
- * When it's happened the node may be removed when a sufficient amount of
- * time has been passed since its last use. The less-recently-used entry can
-@@ -62,7 +49,6 @@
- * refcnt: atomically against modifications on other CPU;
- * usually under some other lock to prevent node disappearing
- * daddr: unchangeable
-- * ip_id_count: atomic value (no lock needed)
- */
-
- static struct kmem_cache *peer_cachep __read_mostly;
-@@ -496,11 +482,7 @@ relookup:
+@@ -482,7 +482,7 @@ relookup:
if (p) {
p->daddr = *daddr;
atomic_set(&p->refcnt, 1);
- atomic_set(&p->rid, 0);
-- atomic_set(&p->ip_id_count,
-- (daddr->family == AF_INET) ?
-- secure_ip_id(daddr->addr.a4) :
-- secure_ipv6_id(daddr->addr.a6));
+ atomic_set_unchecked(&p->rid, 0);
p->metrics[RTAX_LOCK-1] = INETPEER_METRICS_NEW;
p->rate_tokens = 0;
@@ -100114,38 +99513,6 @@ index 94213c8..8bdb342 100644
.kind = "gretap",
.maxtype = IFLA_GRE_MAX,
.policy = ipgre_policy,
-diff --git a/net/ipv4/ip_output.c b/net/ipv4/ip_output.c
-index 73c6b63..ed88d78 100644
---- a/net/ipv4/ip_output.c
-+++ b/net/ipv4/ip_output.c
-@@ -148,7 +148,7 @@ int ip_build_and_send_pkt(struct sk_buff *skb, struct sock *sk,
- iph->daddr = (opt && opt->opt.srr ? opt->opt.faddr : daddr);
- iph->saddr = saddr;
- iph->protocol = sk->sk_protocol;
-- ip_select_ident(skb, &rt->dst, sk);
-+ ip_select_ident(skb, sk);
-
- if (opt && opt->opt.optlen) {
- iph->ihl += opt->opt.optlen>>2;
-@@ -386,8 +386,7 @@ packet_routed:
- ip_options_build(skb, &inet_opt->opt, inet->inet_daddr, rt, 0);
- }
-
-- ip_select_ident_more(skb, &rt->dst, sk,
-- (skb_shinfo(skb)->gso_segs ?: 1) - 1);
-+ ip_select_ident_segs(skb, sk, skb_shinfo(skb)->gso_segs ?: 1);
-
- skb->priority = sk->sk_priority;
- skb->mark = sk->sk_mark;
-@@ -1338,7 +1337,7 @@ struct sk_buff *__ip_make_skb(struct sock *sk,
- iph->ttl = ttl;
- iph->protocol = sk->sk_protocol;
- ip_copy_addrs(iph, fl4);
-- ip_select_ident(skb, &rt->dst, sk);
-+ ip_select_ident(skb, sk);
-
- if (opt) {
- iph->ihl += opt->optlen>>2;
diff --git a/net/ipv4/ip_sockglue.c b/net/ipv4/ip_sockglue.c
index 580dd96..9fcef7e 100644
--- a/net/ipv4/ip_sockglue.c
@@ -100169,19 +99536,6 @@ index 580dd96..9fcef7e 100644
msg.msg_controllen = len;
msg.msg_flags = flags;
-diff --git a/net/ipv4/ip_tunnel_core.c b/net/ipv4/ip_tunnel_core.c
-index 8d69626..65b664d 100644
---- a/net/ipv4/ip_tunnel_core.c
-+++ b/net/ipv4/ip_tunnel_core.c
-@@ -74,7 +74,7 @@ int iptunnel_xmit(struct rtable *rt, struct sk_buff *skb,
- iph->daddr = dst;
- iph->saddr = src;
- iph->ttl = ttl;
-- __ip_select_ident(iph, &rt->dst, (skb_shinfo(skb)->gso_segs ?: 1) - 1);
-+ __ip_select_ident(iph, skb_shinfo(skb)->gso_segs ?: 1);
-
- err = ip_local_out(skb);
- if (unlikely(net_xmit_eval(err)))
diff --git a/net/ipv4/ip_vti.c b/net/ipv4/ip_vti.c
index e4a8f76..dd8ad72 100644
--- a/net/ipv4/ip_vti.c
@@ -100257,19 +99611,6 @@ index 62eaa00..29b2dc2 100644
.kind = "ipip",
.maxtype = IFLA_IPTUN_MAX,
.policy = ipip_policy,
-diff --git a/net/ipv4/ipmr.c b/net/ipv4/ipmr.c
-index 2886357..1149fc2 100644
---- a/net/ipv4/ipmr.c
-+++ b/net/ipv4/ipmr.c
-@@ -1663,7 +1663,7 @@ static void ip_encap(struct sk_buff *skb, __be32 saddr, __be32 daddr)
- iph->protocol = IPPROTO_IPIP;
- iph->ihl = 5;
- iph->tot_len = htons(skb->len);
-- ip_select_ident(skb, skb_dst(skb), NULL);
-+ ip_select_ident(skb, NULL);
- ip_send_check(iph);
-
- memset(&(IPCB(skb)->opt), 0, sizeof(IPCB(skb)->opt));
diff --git a/net/ipv4/netfilter/arp_tables.c b/net/ipv4/netfilter/arp_tables.c
index f95b6f9..2ee2097 100644
--- a/net/ipv4/netfilter/arp_tables.c
@@ -100453,7 +99794,7 @@ index e21934b..4e7cb58 100644
static int ping_v4_seq_show(struct seq_file *seq, void *v)
diff --git a/net/ipv4/raw.c b/net/ipv4/raw.c
-index c04518f..d67116b 100644
+index 11c8d81..d67116b 100644
--- a/net/ipv4/raw.c
+++ b/net/ipv4/raw.c
@@ -311,7 +311,7 @@ static int raw_rcv_skb(struct sock *sk, struct sk_buff *skb)
@@ -100465,15 +99806,6 @@ index c04518f..d67116b 100644
kfree_skb(skb);
return NET_RX_DROP;
}
-@@ -389,7 +389,7 @@ static int raw_send_hdrinc(struct sock *sk, struct flowi4 *fl4,
- iph->check = 0;
- iph->tot_len = htons(length);
- if (!iph->id)
-- ip_select_ident(skb, &rt->dst, NULL);
-+ ip_select_ident(skb, NULL);
-
- iph->check = ip_fast_csum((unsigned char *)iph, iph->ihl);
- }
@@ -748,16 +748,20 @@ static int raw_init(struct sock *sk)
static int raw_seticmpfilter(struct sock *sk, char __user *optval, int optlen)
@@ -100517,18 +99849,10 @@ index c04518f..d67116b 100644
static int raw_seq_show(struct seq_file *seq, void *v)
diff --git a/net/ipv4/route.c b/net/ipv4/route.c
-index 031553f..1f6f4e2 100644
+index ca5a01e..1f6f4e2 100644
--- a/net/ipv4/route.c
+++ b/net/ipv4/route.c
-@@ -89,6 +89,7 @@
- #include <linux/rcupdate.h>
- #include <linux/times.h>
- #include <linux/slab.h>
-+#include <linux/jhash.h>
- #include <net/dst.h>
- #include <net/net_namespace.h>
- #include <net/protocol.h>
-@@ -233,7 +234,7 @@ static const struct seq_operations rt_cache_seq_ops = {
+@@ -234,7 +234,7 @@ static const struct seq_operations rt_cache_seq_ops = {
static int rt_cache_seq_open(struct inode *inode, struct file *file)
{
@@ -100537,7 +99861,7 @@ index 031553f..1f6f4e2 100644
}
static const struct file_operations rt_cache_seq_fops = {
-@@ -324,7 +325,7 @@ static const struct seq_operations rt_cpu_seq_ops = {
+@@ -325,7 +325,7 @@ static const struct seq_operations rt_cpu_seq_ops = {
static int rt_cpu_seq_open(struct inode *inode, struct file *file)
{
@@ -100546,7 +99870,7 @@ index 031553f..1f6f4e2 100644
}
static const struct file_operations rt_cpu_seq_fops = {
-@@ -362,7 +363,7 @@ static int rt_acct_proc_show(struct seq_file *m, void *v)
+@@ -363,7 +363,7 @@ static int rt_acct_proc_show(struct seq_file *m, void *v)
static int rt_acct_proc_open(struct inode *inode, struct file *file)
{
@@ -100555,78 +99879,25 @@ index 031553f..1f6f4e2 100644
}
static const struct file_operations rt_acct_proc_fops = {
-@@ -462,39 +463,45 @@ static struct neighbour *ipv4_neigh_lookup(const struct dst_entry *dst,
- return neigh_create(&arp_tbl, pkey, dev);
- }
+@@ -465,7 +465,7 @@ static struct neighbour *ipv4_neigh_lookup(const struct dst_entry *dst,
--/*
-- * Peer allocation may fail only in serious out-of-memory conditions. However
-- * we still can generate some output.
-- * Random ID selection looks a bit dangerous because we have no chances to
-- * select ID being unique in a reasonable period of time.
-- * But broken packet identifier may be better than no packet at all.
-+#define IP_IDENTS_SZ 2048u
-+struct ip_ident_bucket {
+ #define IP_IDENTS_SZ 2048u
+ struct ip_ident_bucket {
+- atomic_t id;
+ atomic_unchecked_t id;
-+ u32 stamp32;
-+};
-+
-+static struct ip_ident_bucket *ip_idents __read_mostly;
-+
-+/* In order to protect privacy, we add a perturbation to identifiers
-+ * if one generator is seldom used. This makes hard for an attacker
-+ * to infer how many packets were sent between two points in time.
- */
--static void ip_select_fb_ident(struct iphdr *iph)
-+u32 ip_idents_reserve(u32 hash, int segs)
- {
-- static DEFINE_SPINLOCK(ip_fb_id_lock);
-- static u32 ip_fallback_id;
-- u32 salt;
-+ struct ip_ident_bucket *bucket = ip_idents + hash % IP_IDENTS_SZ;
-+ u32 old = ACCESS_ONCE(bucket->stamp32);
-+ u32 now = (u32)jiffies;
-+ u32 delta = 0;
-
-- spin_lock_bh(&ip_fb_id_lock);
-- salt = secure_ip_id((__force __be32)ip_fallback_id ^ iph->daddr);
-- iph->id = htons(salt & 0xFFFF);
-- ip_fallback_id = salt;
-- spin_unlock_bh(&ip_fb_id_lock);
-+ if (old != now && cmpxchg(&bucket->stamp32, old, now) == old)
-+ delta = prandom_u32_max(now - old);
-+
-+ return atomic_add_return_unchecked(segs + delta, &bucket->id) - segs;
- }
-+EXPORT_SYMBOL(ip_idents_reserve);
-
--void __ip_select_ident(struct iphdr *iph, struct dst_entry *dst, int more)
-+void __ip_select_ident(struct iphdr *iph, int segs)
- {
-- struct net *net = dev_net(dst->dev);
-- struct inet_peer *peer;
-+ static u32 ip_idents_hashrnd __read_mostly;
-+ u32 hash, id;
+ u32 stamp32;
+ };
-- peer = inet_getpeer_v4(net->ipv4.peers, iph->daddr, 1);
-- if (peer) {
-- iph->id = htons(inet_getid(peer, more));
-- inet_putpeer(peer);
-- return;
-- }
-+ net_get_random_once(&ip_idents_hashrnd, sizeof(ip_idents_hashrnd));
+@@ -485,7 +485,7 @@ u32 ip_idents_reserve(u32 hash, int segs)
+ if (old != now && cmpxchg(&bucket->stamp32, old, now) == old)
+ delta = prandom_u32_max(now - old);
-- ip_select_fb_ident(iph);
-+ hash = jhash_3words((__force u32)iph->daddr,
-+ (__force u32)iph->saddr,
-+ iph->protocol,
-+ ip_idents_hashrnd);
-+ id = ip_idents_reserve(hash, segs);
-+ iph->id = htons(id);
+- return atomic_add_return(segs + delta, &bucket->id) - segs;
++ return atomic_add_return_unchecked(segs + delta, &bucket->id) - segs;
}
- EXPORT_SYMBOL(__ip_select_ident);
+ EXPORT_SYMBOL(ip_idents_reserve);
-@@ -2624,34 +2631,34 @@ static struct ctl_table ipv4_route_flush_table[] = {
+@@ -2631,34 +2631,34 @@ static struct ctl_table ipv4_route_flush_table[] = {
.maxlen = sizeof(int),
.mode = 0200,
.proc_handler = ipv4_sysctl_rtcache_flush,
@@ -100669,7 +99940,7 @@ index 031553f..1f6f4e2 100644
err_dup:
return -ENOMEM;
}
-@@ -2674,8 +2681,8 @@ static __net_initdata struct pernet_operations sysctl_route_ops = {
+@@ -2681,8 +2681,8 @@ static __net_initdata struct pernet_operations sysctl_route_ops = {
static __net_init int rt_genid_init(struct net *net)
{
@@ -100680,19 +99951,6 @@ index 031553f..1f6f4e2 100644
get_random_bytes(&net->ipv4.dev_addr_genid,
sizeof(net->ipv4.dev_addr_genid));
return 0;
-@@ -2718,6 +2725,12 @@ int __init ip_rt_init(void)
- {
- int rc = 0;
-
-+ ip_idents = kmalloc(IP_IDENTS_SZ * sizeof(*ip_idents), GFP_KERNEL);
-+ if (!ip_idents)
-+ panic("IP: failed to allocate ip_idents\n");
-+
-+ prandom_bytes(ip_idents, IP_IDENTS_SZ * sizeof(*ip_idents));
-+
- #ifdef CONFIG_IP_ROUTE_CLASSID
- ip_rt_acct = __alloc_percpu(256 * sizeof(struct ip_rt_acct), __alignof__(struct ip_rt_acct));
- if (!ip_rt_acct)
diff --git a/net/ipv4/sysctl_net_ipv4.c b/net/ipv4/sysctl_net_ipv4.c
index 44eba05..b36864b 100644
--- a/net/ipv4/sysctl_net_ipv4.c
@@ -100989,33 +100247,6 @@ index 64f0354..a81b39d 100644
if (retransmits_timed_out(sk, retry_until,
syn_set ? 0 : icsk->icsk_user_timeout, syn_set)) {
/* Has it gone just too far? */
-diff --git a/net/ipv4/tcp_vegas.c b/net/ipv4/tcp_vegas.c
-index 06cae62..6b1a5fd 100644
---- a/net/ipv4/tcp_vegas.c
-+++ b/net/ipv4/tcp_vegas.c
-@@ -219,7 +219,8 @@ static void tcp_vegas_cong_avoid(struct sock *sk, u32 ack, u32 acked,
- * This is:
- * (actual rate in segments) * baseRTT
- */
-- target_cwnd = tp->snd_cwnd * vegas->baseRTT / rtt;
-+ target_cwnd = (u64)tp->snd_cwnd * vegas->baseRTT;
-+ do_div(target_cwnd, rtt);
-
- /* Calculate the difference between the window we had,
- * and the window we would like to have. This quantity
-diff --git a/net/ipv4/tcp_veno.c b/net/ipv4/tcp_veno.c
-index 326475a..603ad49 100644
---- a/net/ipv4/tcp_veno.c
-+++ b/net/ipv4/tcp_veno.c
-@@ -145,7 +145,7 @@ static void tcp_veno_cong_avoid(struct sock *sk, u32 ack, u32 acked,
-
- rtt = veno->minrtt;
-
-- target_cwnd = (tp->snd_cwnd * veno->basertt);
-+ target_cwnd = (u64)tp->snd_cwnd * veno->basertt;
- target_cwnd <<= V_PARAM_SHIFT;
- do_div(target_cwnd, rtt);
-
diff --git a/net/ipv4/udp.c b/net/ipv4/udp.c
index b25e852..cdc3258 100644
--- a/net/ipv4/udp.c
@@ -101134,24 +100365,6 @@ index b25e852..cdc3258 100644
}
int udp4_seq_show(struct seq_file *seq, void *v)
-diff --git a/net/ipv4/xfrm4_mode_tunnel.c b/net/ipv4/xfrm4_mode_tunnel.c
-index 31b1815..1f564a1 100644
---- a/net/ipv4/xfrm4_mode_tunnel.c
-+++ b/net/ipv4/xfrm4_mode_tunnel.c
-@@ -117,12 +117,12 @@ static int xfrm4_mode_tunnel_output(struct xfrm_state *x, struct sk_buff *skb)
-
- top_iph->frag_off = (flags & XFRM_STATE_NOPMTUDISC) ?
- 0 : (XFRM_MODE_SKB_CB(skb)->frag_off & htons(IP_DF));
-- ip_select_ident(skb, dst->child, NULL);
-
- top_iph->ttl = ip4_dst_hoplimit(dst->child);
-
- top_iph->saddr = x->props.saddr.a4;
- top_iph->daddr = x->id.daddr.a4;
-+ ip_select_ident(skb, NULL);
-
- return 0;
- }
diff --git a/net/ipv4/xfrm4_policy.c b/net/ipv4/xfrm4_policy.c
index e1a6393..f634ce5 100644
--- a/net/ipv4/xfrm4_policy.c
@@ -101365,31 +100578,6 @@ index 2465d18..bc5bf7f 100644
.kind = "ip6gretap",
.maxtype = IFLA_GRE_MAX,
.policy = ip6gre_policy,
-diff --git a/net/ipv6/ip6_output.c b/net/ipv6/ip6_output.c
-index a62b610..073e5a6 100644
---- a/net/ipv6/ip6_output.c
-+++ b/net/ipv6/ip6_output.c
-@@ -537,6 +537,20 @@ static void ip6_copy_metadata(struct sk_buff *to, struct sk_buff *from)
- skb_copy_secmark(to, from);
- }
-
-+static void ipv6_select_ident(struct frag_hdr *fhdr, struct rt6_info *rt)
-+{
-+ static u32 ip6_idents_hashrnd __read_mostly;
-+ u32 hash, id;
-+
-+ net_get_random_once(&ip6_idents_hashrnd, sizeof(ip6_idents_hashrnd));
-+
-+ hash = __ipv6_addr_jhash(&rt->rt6i_dst.addr, ip6_idents_hashrnd);
-+ hash = __ipv6_addr_jhash(&rt->rt6i_src.addr, hash);
-+
-+ id = ip_idents_reserve(hash, 1);
-+ fhdr->identification = htonl(id);
-+}
-+
- int ip6_fragment(struct sk_buff *skb, int (*output)(struct sk_buff *))
- {
- struct sk_buff *frag;
diff --git a/net/ipv6/ip6_tunnel.c b/net/ipv6/ip6_tunnel.c
index 9120339..cfdd84f 100644
--- a/net/ipv6/ip6_tunnel.c
@@ -101539,36 +100727,13 @@ index 767ab8d..c5ec70a 100644
return -ENOMEM;
}
diff --git a/net/ipv6/output_core.c b/net/ipv6/output_core.c
-index b31a012..ab2f47d 100644
+index 798eb0f..ab2f47d 100644
--- a/net/ipv6/output_core.c
+++ b/net/ipv6/output_core.c
-@@ -7,30 +7,6 @@
+@@ -7,7 +7,6 @@
#include <net/ip6_fib.h>
#include <net/addrconf.h>
--void ipv6_select_ident(struct frag_hdr *fhdr, struct rt6_info *rt)
--{
-- static atomic_t ipv6_fragmentation_id;
-- int ident;
--
--#if IS_ENABLED(CONFIG_IPV6)
-- if (rt && !(rt->dst.flags & DST_NOPEER)) {
-- struct inet_peer *peer;
-- struct net *net;
--
-- net = dev_net(rt->dst.dev);
-- peer = inet_getpeer_v6(net->ipv6.peers, &rt->rt6i_dst.addr, 1);
-- if (peer) {
-- fhdr->identification = htonl(inet_getid(peer, 0));
-- inet_putpeer(peer);
-- return;
-- }
-- }
--#endif
-- ident = atomic_inc_return(&ipv6_fragmentation_id);
-- fhdr->identification = htonl(ident);
--}
--EXPORT_SYMBOL(ipv6_select_ident);
-
int ip6_find_1stfragopt(struct sk_buff *skb, u8 **nexthdr)
{
@@ -102591,18 +101756,9 @@ index db80126..ef7110e 100644
cp->old_state = cp->state;
/*
diff --git a/net/netfilter/ipvs/ip_vs_xmit.c b/net/netfilter/ipvs/ip_vs_xmit.c
-index c47444e..e9a86e6 100644
+index 7f0e1cf..e9a86e6 100644
--- a/net/netfilter/ipvs/ip_vs_xmit.c
+++ b/net/netfilter/ipvs/ip_vs_xmit.c
-@@ -883,7 +883,7 @@ ip_vs_tunnel_xmit(struct sk_buff *skb, struct ip_vs_conn *cp,
- iph->daddr = cp->daddr.ip;
- iph->saddr = saddr;
- iph->ttl = old_iph->ttl;
-- ip_select_ident(skb, &rt->dst, NULL);
-+ ip_select_ident(skb, NULL);
-
- /* Another hack: avoid icmp_send in ip_fragment */
- skb->local_df = 1;
@@ -1102,7 +1102,7 @@ ip_vs_icmp_xmit(struct sk_buff *skb, struct ip_vs_conn *cp,
else
rc = NF_ACCEPT;
@@ -103519,18 +102675,6 @@ index f226709..0e735a8 100644
_proto("Tx RESPONSE %%%u", ntohl(hdr->serial));
ret = kernel_sendmsg(conn->trans->local->socket, &msg, iov, 3, len);
-diff --git a/net/sctp/associola.c b/net/sctp/associola.c
-index a4d5701..5d97d8f 100644
---- a/net/sctp/associola.c
-+++ b/net/sctp/associola.c
-@@ -1151,6 +1151,7 @@ void sctp_assoc_update(struct sctp_association *asoc,
- asoc->c = new->c;
- asoc->peer.rwnd = new->peer.rwnd;
- asoc->peer.sack_needed = new->peer.sack_needed;
-+ asoc->peer.auth_capable = new->peer.auth_capable;
- asoc->peer.i = new->peer.i;
- sctp_tsnmap_init(&asoc->peer.tsn_map, SCTP_TSN_MAP_INITIAL,
- asoc->peer.i.initial_tsn, GFP_ATOMIC);
diff --git a/net/sctp/ipv6.c b/net/sctp/ipv6.c
index 2b1738e..a9d0fc9 100644
--- a/net/sctp/ipv6.c