From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 25BA93858D34; Sun, 17 Mar 2024 02:02:44 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 25BA93858D34 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1710640964; bh=z9TTaGObfz+ZqIeNJwYOW19Dt2rc4EGuEp0uf2hRmK0=; h=From:To:Subject:Date:In-Reply-To:References:From; b=XO4DxrldGIBcZOgnN7QO+hLiwI3kD1Aak9/LXJtgO7hrxZrBZ5k+2LeWGr0EKr8UR W8FNg1O1ufebeY+NsMbuLAPwklaSnvYSMDUAr+bnldhU5P6e6B3DWpoM9OrUdMFAGa SZAbB/vVRYXGK/rCUgWOSusQQxzdF9fdnL19fIV8= From: "luofengwc at qq dot com" To: glibc-bugs@sourceware.org Subject: [Bug libc/31492] ARM ldp instruction trigger bus error when kernel open option CONFIG_IO_STRICT_DEVMEM Date: Sun, 17 Mar 2024 02:02:38 +0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: glibc X-Bugzilla-Component: libc X-Bugzilla-Version: 2.34 X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: luofengwc at qq dot com X-Bugzilla-Status: RESOLVED X-Bugzilla-Resolution: INVALID X-Bugzilla-Priority: P2 X-Bugzilla-Assigned-To: unassigned at sourceware dot org X-Bugzilla-Target-Milestone: --- X-Bugzilla-Flags: security- X-Bugzilla-Changed-Fields: Message-ID: In-Reply-To: References: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Bugzilla-URL: http://sourceware.org/bugzilla/ Auto-Submitted: auto-generated MIME-Version: 1.0 List-Id: https://sourceware.org/bugzilla/show_bug.cgi?id=3D31492 --- Comment #3 from luofeng14 --- (In reply to Florian Weimer from comment #2) > You use the x0 and x1 registers, but you don't tell the compiler about it. > Anything may happen as a result. there may be some misunderstandings about the problem, actually, i encounte= red this problem ``` #include #include #include #include #include #include #include #include #include typedef char u8; void * func(void) { off_t base =3D 9654697984; void *p; int fd; int len =3D 724; // scanf ("%d",&len); struct stat statbuf; off_t mmoffset; void *mmp; if ((fd =3D open("/dev/mem", O_RDONLY)) =3D=3D -1) { printf("%d\n",__LINE__); return NULL; } if ((p =3D malloc(len)) =3D=3D NULL) { printf("%d\n",__LINE__); return NULL; } if (fstat(fd, &statbuf) =3D=3D -1) { printf("%d\n",__LINE__); return NULL; } mmoffset =3D base % sysconf(_SC_PAGESIZE); mmp =3D mmap(NULL, mmoffset + len, PROT_READ, MAP_SHARED, fd, base - mmoffset); if (mmp =3D=3D MAP_FAILED) return 0; memcpy(p, (char *)mmp + mmoffset, len); if (munmap(mmp, mmoffset + len) =3D=3D -1) { return NULL; } return p; } int main() { if(!func()) return -1; return 0; } ``` in above code, the ldp command is also used in memcpy. when use memcpy to c= opy /dev/mem data, alos has bus error; using inline assembly is to simplify the problem --=20 You are receiving this mail because: You are on the CC list for the bug.=