From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id 7BD37C30653 for ; Wed, 26 Jun 2024 13:29:08 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id C82346B0085; Wed, 26 Jun 2024 09:29:07 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id C31C26B008A; Wed, 26 Jun 2024 09:29:07 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id AD3346B008C; Wed, 26 Jun 2024 09:29:07 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0012.hostedemail.com [216.40.44.12]) by kanga.kvack.org (Postfix) with ESMTP id 8FD786B0085 for ; Wed, 26 Jun 2024 09:29:07 -0400 (EDT) Received: from smtpin28.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay07.hostedemail.com (Postfix) with ESMTP id 06C4A160E58 for ; Wed, 26 Jun 2024 13:29:07 +0000 (UTC) X-FDA: 82273120734.28.18C85CD Received: from relay6-d.mail.gandi.net (relay6-d.mail.gandi.net [217.70.183.198]) by imf15.hostedemail.com (Postfix) with ESMTP id E36D6A001B for ; Wed, 26 Jun 2024 13:29:04 +0000 (UTC) Authentication-Results: imf15.hostedemail.com; dkim=pass header.d=yoseli.org header.s=gm1 header.b=YF9SH7dc; dmarc=none; spf=none (imf15.hostedemail.com: domain of jeanmichel.hautbois@yoseli.org has no SPF policy when checking 217.70.183.198) smtp.mailfrom=jeanmichel.hautbois@yoseli.org ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1719408532; a=rsa-sha256; cv=none; b=X428xvfR+DJ+Fl5Y7bo5jv3D5h8uScEdphaOiihWZ0djmgUQLs10t+QHRsY1Tj4W/HvrdM D3PTptomrubzBDdeTx1NVQwM0IqwJUmvSn+OK2wIn7RQKoSLnC9tIlZCiSRj9tSzJcPo0b LhYnnYrBv/LGkuUsuLx4J3ngz2mbMgM= ARC-Authentication-Results: i=1; imf15.hostedemail.com; dkim=pass header.d=yoseli.org header.s=gm1 header.b=YF9SH7dc; dmarc=none; spf=none (imf15.hostedemail.com: domain of jeanmichel.hautbois@yoseli.org has no SPF policy when checking 217.70.183.198) smtp.mailfrom=jeanmichel.hautbois@yoseli.org ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1719408532; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=PP9w32Smj5kF17ItJ7qIzuuKC9WIW96IhYXhKbYU93I=; b=BXLO/gyWeCvht/dn5AvG0OTPqCX5b/C3nh/WmJazVTL2jx7D1SZyN3claw93Gn5CCWQWuA 2Drphd3mfzrOlLDcnfDQ6ey1U+9y2CikX25IWoh7RtDrtp7ZNLFap58Uz52YOzshwqHwil SSLSDAoe2Pvs+8FbAWz8uMRju0s+Hws= Received: by mail.gandi.net (Postfix) with ESMTPSA id A3DA5C0008; Wed, 26 Jun 2024 13:29:00 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yoseli.org; s=gm1; t=1719408543; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=PP9w32Smj5kF17ItJ7qIzuuKC9WIW96IhYXhKbYU93I=; b=YF9SH7dcM5Eiiczp9j4yCDk7UnAhKzh45lFnp3oP7N6GRJUTQNXvT+yG8YbMuCRgmtjzQC sK9qaTMcsqu8QgLbS5uElTkMVhIJcfaWSFADZXy389mqBTihQKqqAZ8ijNHLGDWMgDqRtV SabjU2aTulUHz9313MaRd4c6tQ+Tqek6EuUXYWVhPFJL8H8iLhViJnd2/5enVuG+EAdFA4 22hxiw3isspMg1v/YiG8RNki6CffHPH0adsaPx4vhlodQiT0uabw6uIN7WnsJAdv0n3kHn R/UILgt1tlH+k7Bp8jYeVhwtlw5XYCbaJzegKVYENyrtqnzNZ4Z3BlCp+ezRyQ== Message-ID: Date: Wed, 26 Jun 2024 15:28:59 +0200 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: m68k 54418 fails to execute user space To: Michael Schmitz , linux-m68k@lists.linux-m68k.org, linux-mm@kvack.org, linux-mtd@lists.infradead.org Cc: Greg Ungerer , Geert Uytterhoeven , Christoph Hellwig , wbx@openadk.org References: <735e19b6-3747-417f-ba5b-1a7da137a3a3@yoseli.org> <7fb2988d-ab89-405f-8cf1-edcdd2196376@gmail.com> Content-Language: en-US, fr From: Jean-Michel Hautbois In-Reply-To: <7fb2988d-ab89-405f-8cf1-edcdd2196376@gmail.com> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit X-GND-Sasl: jeanmichel.hautbois@yoseli.org X-Rspamd-Server: rspam12 X-Rspamd-Queue-Id: E36D6A001B X-Stat-Signature: 6dw44g7qs4q787dgi97sh3ro73ed66jr X-Rspam-User: X-HE-Tag: 1719408544-984196 X-HE-Meta: U2FsdGVkX1/XsEvGGBDP7PahLq2qjDWXEqT4uNLgtr+BrM+4qKIhZ/17uAqHlUERxJinarK8jJVwxn+WovTXX+KlfRR1zVqE9Mg0qARywRXwevPo+e10HHSmlvITGCitYsLPuSRhndNfxvzqqOqsZR67UZUhkY8BWfwI2U5VUZm6PIkHMsO2F2hpHj6SMmO0wLtpyr8OyxDcWGzfKfLzps7jHbvMgnLgATNn5Of3y1x5DQbk0WYRHXcrB1OmcrYwqe/OA1Kl9ENNFjNJu1vRoJBRwhfO1JRp65UvwUDXLbXHsBnnGj0D+aXIqcoDjtrPOMyIR5EkYvrffhNR3MBwFMlg1uvRAQx7/bZ+0SML8UBaP/fi9cpe3qV3/6m9DOs9HEgqTl7hBAbiuhubiR4sklc3/NX8qS6aTmKf3a+bQhBsm0xrNROgz9jUbkbM6IdbeHojFjbIRncLhGg0SvkXoJ50StvvPO6Gd0aSpNNSta0A5n7/sGZp9WMH+sH38zuK4YJwP8VrKdAlNrRVvyuxKBCK8e9/8CuCkJSZqzrp3Q0mpxrxOKubvj+02rNmxR8/th1JrZt7GX6+zcs82/mUYAGXdoZS7HE2C5bumfmzwWq28ZTZOpkicvIW6Wwjz2YwNrQ22zl2Hn/NSkm8MiLvLaToi7WQ8TmXHEZ7xQBhyeD7WkXI/EYB9dt6FU/WjNPEUSnXqwdLvwrfVW+RQcOPdRgXKOIK4FWOLb0n6w4rItWC+lq/pFFZCGiMLmkTKirzYZSsOgsBXRTf7YLmGiZLXVZVahQbbuKa3ByA1I3yvNHhRX0XsjHg70jv7GDXgmkf8oaxWtl7xu1SFom5OxbK4rxg6DS9Y3Zxsuar+UYGExMA+7vzcPZCSz9w9ES2rywhEPs6VBwi/TpUrAKITG/TWF0eSCVHRWZrqZ+2xF79rb35GAJfQOYiuKFFtH1jbHopCiOEmcK72yy1CcX4fc6 TGRlXSo2 vC3GCCMVM4153UYoTToCI1PYd4YdEPRgaVIuKqHs6F7On5f687l/Ak8wuP8VT0pQlrxmdv6qS1/Ls4WogMJqUv/RLCcpPCZ7Imijn3PCBMe4BS+1c2WHhuvdKsCln3S/3o9hHWe8eLGw3+1BSH0AumY24PMyTE6SC3WfC X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: List-Subscribe: List-Unsubscribe: Hi Michael, On 26/06/2024 03:56, Michael Schmitz wrote: > Jean-Michel, > > On 24/06/24 20:56, Jean-Michel Hautbois wrote: >> >> When I printk the do_page_fault first debug, I get for the first call >> to ls: >> bash-5.2# ls >> [   14.700000] do page fault: >> [   14.700000] regs->sr=0x0, regs->pc=0x70069ee6, address=0x70069ee6, >> 0, (ptrval) > > Page not present, read fault. Please disable obfuscation of kernel > pointer addresses by printk. Maybe also disable address space > randomization while debugging this. > >> This call works almost fine (I still have the assert failed: >> folio->private != NULL issue). >> >> And when I call it a second time, I get: >> bash-5.2# ls >> [   19.820000] do page fault: >> [   19.820000] regs->sr=0x0, regs->pc=0x6011d65a, address=0x700e2004, >> 2, (ptrval) > > Page not present, write fault. > > It would be helpful if you could get a dump of /proc/1/maps before the > execve() syscall in your helloworld init replacement. That might confirm > all these addresses are legit (assuming mappings survive across > execve(), that is), and what they correspond to. > >> >> The address corresponds to the defined zone ELF_ET_DYN_BASE as I set >> it to 0x70000000. >> >> regs->pc is not the same as the address. It might be unrelevant, but >> any help is appreciated to understand the process behind :-). >> >> I keep digging, and I am in the asm part which fears me a bit ! > > I don't see that you'd need to look at any asm code here. I add a small test in do_page_fault, and in case of an error, it panics. The result follows:  ./scripts/decode_stacktrace.sh vmlinux < /tmp/trace.log [ 3.857000] Run /bin/bash as init process [ 3.858000] with arguments: [ 3.861000] /bin/bash [ 3.862000] with environment: [ 3.863000] HOME=/ [ 3.864000] TERM=linux [ 4.242000] do page fault: [ 4.242000] regs->sr=0x2000, regs->pc=0x41366924, address=0x700b3364, 2, 41fb0000 [ 4.242000] Kernel panic - not syncing: page fault error [ 4.242000] CPU: 0 PID: 1 Comm: bash Not tainted 6.10.0-rc5-g927da6cf01fe-dirty #25 [ 4.242000] Stack from 4186dda8: [ 4.242000] 4186dda8 41423aa4 41423aa4 700b3300 00000001 00000000 4136ee10 41423aa4 [ 4.242000] 41366d7a 700b3364 700b3364 00000000 0000000d 4186de60 41fb0000 41d51a60 [ 4.242000] 41005696 41416a90 41416a4d 00002000 41366924 700b3364 00000002 41fb0000 [ 4.242000] 0000000a 700b3364 00000000 0000000d 00000012 41d51a00 4186de60 41d51a60 [ 4.242000] 41fb81c0 41d51a60 410052fe 4100529a 4186de60 700b3364 00000002 00000000 [ 4.242000] 700bc414 00000003 00008000 700ac000 41003660 4186de60 00000000 00000000 [ 4.242000] Call Trace: dump_stack (lib/dump_stack.c:124) [ 4.242000] panic (kernel/panic.c:266 kernel/panic.c:368) [ 4.242000] do_page_fault (arch/m68k/mm/fault.c:88 (discriminator 1)) [ 4.242000] __clear_user (arch/m68k/lib/uaccess.c:108) [ 4.242000] buserr_c (arch/m68k/kernel/traps.c:725 arch/m68k/kernel/traps.c:775) [ 4.242000] buserr_c (arch/m68k/kernel/traps.c:748 arch/m68k/kernel/traps.c:775) [ 4.242000] buserr (arch/m68k/kernel/entry.S:116) [ 4.242000] ma_slots (lib/maple_tree.c:759) [ 4.242000] __clear_user (arch/m68k/lib/uaccess.c:108) [ 4.242000] elf_load (fs/binfmt_elf.c:125 (discriminator 1) fs/binfmt_elf.c:421 (discriminator 1)) [ 4.242000] load_elf_binary (fs/binfmt_elf.c:1132) [ 4.242000] memset (arch/m68k/lib/memset.c:11) [ 4.242000] load_misc_binary (fs/binfmt_misc.c:97 fs/binfmt_misc.c:146 fs/binfmt_misc.c:213) [ 4.242000] memset (arch/m68k/lib/memset.c:11) [ 4.242000] bprm_execve (fs/exec.c:1797 fs/exec.c:1839 fs/exec.c:1891 fs/exec.c:1867) [ 4.242000] copy_strings_kernel (fs/exec.c:669) [ 4.242000] count_strings_kernel (fs/exec.c:473) [ 4.242000] kernel_execve (fs/exec.c:2058) [ 4.242000] __dynamic_pr_debug (lib/dynamic_debug.c:865) [ 4.242000] run_init_process (init/main.c:1389) [ 4.242000] _printk (kernel/printk/printk.c:2365) [ 4.242000] kernel_init (init/main.c:1508) [ 4.242000] kernel_init (init/main.c:1459) [ 4.242000] ret_from_kernel_thread (arch/m68k/kernel/entry.S:142) [ 4.242000] [ 4.242000] ---[ end Kernel panic - not syncing: page fault error ]--- Looks like a memory mapping failure, but why ? My JTAG at this point dumps a list of 0s at 0x41fb0000 and my SDRAM starts at 0x40000000 and ends at 0x50000000 (256MB). It looks like a TLB write miss which is obscure to me :-). I tried to use the /proc but as expected it is not alive after mounting it. Thanks, JM > Cheers, > >     Michael > >> >> Thanks ! >> JM