Skip to content

arm64: kvims_defconfig: enable IP_NF_TARGET_TTL and NETFILTER_XT_TARGET_HL#37

Open
S-trace wants to merge 1 commit intokhadas:khadas-vims-4.9.yfrom
S-trace:khadas-vims-4.9.y
Open

arm64: kvims_defconfig: enable IP_NF_TARGET_TTL and NETFILTER_XT_TARGET_HL#37
S-trace wants to merge 1 commit intokhadas:khadas-vims-4.9.yfrom
S-trace:khadas-vims-4.9.y

Conversation

@S-trace
Copy link
Copy Markdown

@S-trace S-trace commented Dec 4, 2020

Those features are necessary to change TTL in IP packets using iptables rules:
iptables -t mangle -A POSTROUTING -j TTL --ttl-set 65
iptables -t mangle -A PREROUTING -j TTL --ttl-set 65

This may be used to work around some ISPs with misconfigured network
(i.e. TTL always equals 1 for all incoming packets and/or connectivity problems
if an ISP receives packets with different TTLs from the same connection)
when VIMx is set up as a router/WiFi AP.

…ET_HL

Those features are necessary to change TTL in IP packets using iptables rules:
iptables -t mangle -A POSTROUTING -j TTL --ttl-set 65
iptables -t mangle -A PREROUTING -j TTL --ttl-set 65

This may be used to work around some ISPs with misconfigured network
(i.e. TTL always equals 1 for all incoming packets and/or connectivity problems
if an ISP receives packets with different TTLs from the same connection)
when VIMx is set up as a router/WiFi AP.
viraniac pushed a commit to viraniac/khadas_linux that referenced this pull request Aug 21, 2024
commit 12f3519 upstream.

This change fixes the following kernel NULL pointer dereference
which is reproduced by blktests srp/007 occasionally.

BUG: kernel NULL pointer dereference, address: 0000000000000170
PGD 0 P4D 0
Oops: 0002 [khadas#1] PREEMPT SMP NOPTI
CPU: 0 PID: 9 Comm: kworker/0:1H Kdump: loaded Not tainted 6.0.0-rc1+ khadas#37
Hardware name: QEMU Standard PC (Q35 + ICH9, 2009), BIOS rel-1.15.0-29-g6a62e0cb0dfe-prebuilt.qemu.org 04/01/2014
Workqueue:  0x0 (kblockd)
RIP: 0010:srp_recv_done+0x176/0x500 [ib_srp]
Code: 00 4d 85 ff 0f 84 52 02 00 00 48 c7 82 80 02 00 00 00 00 00 00 4c 89 df 4c 89 14 24 e8 53 d3 4a f6 4c 8b 14 24 41 0f b6 42 13 <41> 89 87 70 01 00 00 41 0f b6 52 12 f6 c2 02 74 44 41 8b 42 1c b9
RSP: 0018:ffffaef7c0003e28 EFLAGS: 00000282
RAX: 0000000000000000 RBX: ffff9bc9486dea60 RCX: 0000000000000000
RDX: 0000000000000102 RSI: ffffffffb76bbd0e RDI: 00000000ffffffff
RBP: ffff9bc980099a00 R08: 0000000000000001 R09: 0000000000000001
R10: ffff9bca53ef0000 R11: ffff9bc980099a10 R12: ffff9bc956e14000
R13: ffff9bc9836b9cb0 R14: ffff9bc9557b4480 R15: 0000000000000000
FS:  0000000000000000(0000) GS:ffff9bc97ec00000(0000) knlGS:0000000000000000
CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
CR2: 0000000000000170 CR3: 0000000007e04000 CR4: 00000000000006f0
Call Trace:
 <IRQ>
 __ib_process_cq+0xb7/0x280 [ib_core]
 ib_poll_handler+0x2b/0x130 [ib_core]
 irq_poll_softirq+0x93/0x150
 __do_softirq+0xee/0x4b8
 irq_exit_rcu+0xf7/0x130
 sysvec_apic_timer_interrupt+0x8e/0xc0
 </IRQ>

Fixes: ad215aa ("RDMA/srp: Make struct scsi_cmnd and struct srp_request adjacent")
Link: https://lore.kernel.org/r/20220831081626.18712-1-yangx.jy@fujitsu.com
Signed-off-by: Xiao Yang <yangx.jy@fujitsu.com>
Acked-by: Bart Van Assche <bvanassche@acm.org>
Signed-off-by: Leon Romanovsky <leon@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
NegXuan pushed a commit to NegXuan/linux that referenced this pull request Aug 25, 2025
commit fb1cf08 upstream.

__kernel_map_pages() is a debug function which clears the valid bit in page
table entry for deallocated pages to detect illegal memory accesses to
freed pages.

This function set/clear the valid bit using __set_memory(). __set_memory()
acquires init_mm's semaphore, and this operation may sleep. This is
problematic, because  __kernel_map_pages() can be called in atomic context,
and thus is illegal to sleep. An example warning that this causes:

BUG: sleeping function called from invalid context at kernel/locking/rwsem.c:1578
in_atomic(): 1, irqs_disabled(): 0, non_block: 0, pid: 2, name: kthreadd
preempt_count: 2, expected: 0
CPU: 0 PID: 2 Comm: kthreadd Not tainted 6.9.0-g1d4c6d784ef6 khadas#37
Hardware name: riscv-virtio,qemu (DT)
Call Trace:
[<ffffffff800060dc>] dump_backtrace+0x1c/0x24
[<ffffffff8091ef6e>] show_stack+0x2c/0x38
[<ffffffff8092baf8>] dump_stack_lvl+0x5a/0x72
[<ffffffff8092bb24>] dump_stack+0x14/0x1c
[<ffffffff8003b7ac>] __might_resched+0x104/0x10e
[<ffffffff8003b7f4>] __might_sleep+0x3e/0x62
[<ffffffff8093276a>] down_write+0x20/0x72
[<ffffffff8000cf00>] __set_memory+0x82/0x2fa
[<ffffffff8000d324>] __kernel_map_pages+0x5a/0xd4
[<ffffffff80196cca>] __alloc_pages_bulk+0x3b2/0x43a
[<ffffffff8018ee82>] __vmalloc_node_range+0x196/0x6ba
[<ffffffff80011904>] copy_process+0x72c/0x17ec
[<ffffffff80012ab4>] kernel_clone+0x60/0x2fe
[<ffffffff80012f62>] kernel_thread+0x82/0xa0
[<ffffffff8003552c>] kthreadd+0x14a/0x1be
[<ffffffff809357de>] ret_from_fork+0xe/0x1c

Rewrite this function with apply_to_existing_page_range(). It is fine to
not have any locking, because __kernel_map_pages() works with pages being
allocated/deallocated and those pages are not changed by anyone else in the
meantime.

Fixes: 5fde3db ("riscv: add ARCH_SUPPORTS_DEBUG_PAGEALLOC support")
Signed-off-by: Nam Cao <namcao@linutronix.de>
Cc: stable@vger.kernel.org
Reviewed-by: Alexandre Ghiti <alexghiti@rivosinc.com>
Link: https://lore.kernel.org/r/1289ecba9606a19917bc12b6c27da8aa23e1e5ae.1715750938.git.namcao@linutronix.de
Signed-off-by: Palmer Dabbelt <palmer@rivosinc.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
goenjoy-hlm pushed a commit that referenced this pull request Mar 31, 2026
[   27.785304] Unable to handle kernel paging request at virtual address 002d737370766bee
[   28.258589] Mem abort info:
[   28.258841]   ESR = 0x0000000096000004
[   28.259169]   EC = 0x25: DABT (current EL), IL = 32 bits
[   28.259637]   SET = 0, FnV = 0
[   28.259911]   EA = 0, S1PTW = 0
[   28.260184]   FSC = 0x04: level 0 translation fault
[   28.260610] Data abort info:
[   28.260861]   ISV = 0, ISS = 0x00000004
[   28.261200]   CM = 0, WnR = 0
[   28.261462] [002d737370766bee] address between user and kernel address ranges
[   28.262085] Internal error: Oops: 0000000096000004 [#1] SMP
[   28.262576] Modules linked in:
[   28.262852] CPU: 0 PID: 1064 Comm: vo_render_0 Not tainted 6.1.75 #37
[   28.263420] Hardware name: Rockchip RK3576 EVB2 V10 Linux Board (DT)
[   28.263975] pstate: 800000c5 (Nzcv daIF -PAN -UAO -TCO -DIT -SSBS BTYPE=--)
[   28.264587] pc : clk_core_disable+0x1c/0x1ec
[   28.264974] lr : clk_disable+0x34/0x50
[   28.265303] sp : ffffffc00aedb8f0
[   28.265599] x29: ffffffc00aedb8f0 x28: 0000000000000009 x27: 0000007f8322c290
[   28.266224] x26: 0000000000000000 x25: 0000000000000000 x24: ffffff80c3bd4040
[   28.266848] x23: ffffff80c038e068 x22: ffffffc009951ca0 x21: 0000000000000005
[   28.267473] x20: 762d737370766b72 x19: 762d737370766b72 x18: 0000000000000030
[   28.268097] x17: 2076656420323435 x16: 323239206d756e5f x15: 6b6c632039666534
[   28.268721] x14: 6465353630303030 x13: 6633366362613364 x12: 3030303030303030
[   28.269344] x11: 0000000000144580 x10: 0000000000144550 x9 : ffffffc0086ed044
[   28.269969] x8 : ffffffc00a2141f8 x7 : ffffffc00a2c41f8 x6 : 0000000000000001
[   28.270593] x5 : ffffff80fb529b60 x4 : ffffffc00a60aa30 x3 : 0000000000000000
[   28.271216] x2 : 0000000000000001 x1 : ffffff80c0fa0000 x0 : 762d737370766b72
[   28.271840] Call trace:
[   28.272060]  clk_core_disable+0x1c/0x1ec
[   28.272411]  clk_disable+0x34/0x50
[   28.272718]  rkvpss_runtime_suspend+0xac/0xd8
[   28.273104]  pm_generic_runtime_suspend+0x30/0x44
[   28.273521]  genpd_runtime_suspend+0xb8/0x2f4
[   28.273906]  __rpm_callback+0x4c/0x200
[   28.274236]  rpm_callback+0x6c/0x80
[   28.274544]  rpm_suspend+0xd4/0x78c
[   28.274852]  rpm_idle+0x1a4/0x3b0
[   28.275149]  __pm_runtime_idle+0x64/0x1a0
[   28.275501]  ofl_release+0x78/0x94
[   28.275810]  v4l2_release+0xbc/0xf0
[   28.276117]  __fput+0xc0/0x250
[   28.276393]  ____fput+0x14/0x1c
[   28.276668]  task_work_run+0xb8/0x170
[   28.276997]  do_exit+0x2d4/0x924
[   28.277283]  do_group_exit+0x38/0xa0
[   28.277600]  get_signal+0x998/0x9c0
[   28.277908]  do_notify_resume+0x180/0xde0
[   28.278261]  el0_svc+0x6c/0x80
[   28.278535]  el0t_64_sync_handler+0xb0/0xb4
[   28.278907]  el0t_64_sync+0x158/0x15c
[   28.279235]
[   28.279235] PC: 0xffffffc0086ece40:

Signed-off-by: Rimon Xu <rimon.xu@rock-chips.com>
Change-Id: I39d709ed8526b91c67d4181d51bad670edf9c88a
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant