Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 22 May 2020 17:32:37 +0200
From:      Paul Floyd <pjfloyd@wanadoo.fr>
To:        FreeBSD Hackers <freebsd-hackers@freebsd.org>
Subject:   Re: SIGBUS si_code 12
Message-ID:  <679A6BE4-E344-49D0-B76D-DB65A41E26FA@wanadoo.fr>
In-Reply-To: <068F2B99-24C2-4F38-ACC1-02273C198434@wanadoo.fr>
References:  <2102917207.11671.1589487524169.JavaMail.www@wwinf1n11> <490544208.11847.1589489181927.JavaMail.www@wwinf1n11> <20200514224347.GB46537@kib.kiev.ua> <9840EA0E-CF11-4332-A5A0-A3CDBA0F0464@wanadoo.fr> <20200521154621.GB85681@raichu> <068F2B99-24C2-4F38-ACC1-02273C198434@wanadoo.fr>

next in thread | previous in thread | raw e-mail | index | archive | help
A bit more on this.

The code in question is in trap.c:

			if (signo =3D=3D SIGSEGV) {
				ucode =3D SEGV_MAPERR;
			} else if (prot_fault_translation =3D=3D 0) {
				/*
				 * Autodetect.  This check also covers
				 * the images without the ABI-tag ELF
				 * note.
				 */
				if (SV_CURPROC_ABI() =3D=3D =
SV_ABI_FREEBSD &&
				    p->p_osrel >=3D P_OSREL_SIGSEGV) {
					signo =3D SIGSEGV;
					ucode =3D SEGV_ACCERR;
				} else {
					signo =3D SIGBUS;
					ucode =3D T_PAGEFLT;
				}
			} else if (prot_fault_translation =3D=3D 1) {
				/*
				 * Always compat mode.
				 */
				signo =3D SIGBUS;
				ucode =3D T_PAGEFLT;
			} else {
				/*
				 * Always SIGSEGV mode.
				 */
				signo =3D SIGSEGV;
				ucode =3D SEGV_ACCERR;
			}


I have machte.prot_fault_translation set to 0 (the default I believe) so =
this enters the first =E2=80=98else if=E2=80=99 branch.

The value of p_osrel looks like it comes from retold.c. I see two =
mechanisms - passed via auxv AT_OSRELDATE (with a backup of using a =
sysctl) and reading the NT_FREEBSD_ABI_TAG note - I=E2=80=99m not sure =
which is used in this case.

The auxv value seems to be sent and I can=E2=80=99t see why either =
should be failing.

A+
Paul





Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?679A6BE4-E344-49D0-B76D-DB65A41E26FA>