Note: This is a public test instance of Red Hat Bugzilla. The data contained within is a snapshot of the live data so any changes you make will not be reflected in the production Bugzilla. Email is disabled so feel free to test any aspect of the site that you want. File any problems you find or give feedback at bugzilla.redhat.com.
Bug 1395969 - Unhandled Level1 translation fault in polkitd due to mozjs package
Summary: Unhandled Level1 translation fault in polkitd due to mozjs package
Keywords:
Status: CLOSED RAWHIDE
Alias: None
Product: Fedora
Classification: Fedora
Component: mozjs31
Version: rawhide
Hardware: aarch64
OS: Linux
unspecified
medium
Target Milestone: ---
Assignee: Paulo Andrade
QA Contact: Fedora Extras Quality Assurance
URL:
Whiteboard:
Depends On:
Blocks: 1394837
TreeView+ depends on / blocked
 
Reported: 2016-11-17 05:59 UTC by Zheng Xu
Modified: 2017-02-13 15:00 UTC (History)
11 users (show)

Fixed In Version: mozjs31-31.5.0-3.fc26
Doc Type: If docs needed, set a value
Doc Text:
Clone Of: 1242326
Environment:
Last Closed: 2017-02-13 15:00:33 UTC
Type: Bug
Embargoed:


Attachments (Terms of Use)
patch back ported from upstream which fix the crash on 48-bit VA kernel. (2.40 KB, application/mbox)
2016-11-17 05:59 UTC, Zheng Xu
no flags Details

Description Zheng Xu 2016-11-17 05:59:25 UTC
Created attachment 1221486 [details]
patch back ported from upstream which fix the crash on 48-bit VA kernel.

+++ This bug was initially created as a clone of Bug #1242326 +++

Description of problem:
On Aarch64 systems with a VA bits of 48 the polkitd process crashes continuously due to an unhandled level 1 translation fault. On debugging we found that it is caused by the mozjs code.



Version-Release number of selected component (if applicable):
Fedora 21 for Aarch64

How reproducible:
Its easily reproducible on Cavium ThunderX platform.

Steps to Reproduce:
1. Just boot the F21 release for aarch64 and can be seen every time polkitd runs

Actual results:
Below is the crash.

====== cut here ========
unhandled level 1 translation fault (11) at 0x00000000, esr 0x92000045
pgd = ffff8003c3e3ba00
[00000000] *pgd=0000000000000000, *pud=0000000000000000

CPU: 0 PID: 1983 Comm: polkitd Not tainted 3.18.0 #1
task: ffff8003c3a60b00 ti: ffff8003c3ba0000 task.ti: ffff8003c3ba0000
PC is at 0xffff7a733f90
LR is at 0xffff7a733f74
pc : [<0000ffff7a733f90>] lr : [<0000ffff7a733f74>] pstate: 20000000
sp : 0000ffffe1ef0e60
x29: 0000ffffe1ef0e90 x28: 0000ffffb1acdc40 
x27: 0000ffffb1ad18e0 x26: 0000ffffb1acd720 
x25: 0000ffff7a9e2588 x24: 0000000000000000 
x23: 0000000000000000 x22: 0000ffffe1ef0f78 
x21: 0000ffffb1ad1840 x20: 0000000000800000 
x19: 0000ffff7a7a7e08 x18: 0000ffff7a363b4c 
x17: 0000ffff7a797b40 x16: 0000ffff7a40af0c 
x15: 00000000ffffffff x14: 0000ffff7ac0a000 
x13: 0000ffff7ac09000 x12: 0000ffffe1ef0ce0 
x11: 0000ffff7ac2a250 x10: 0000000002eb0939 
x9 : 0000000000000000 x8 : 0000000000000001 
x7 : ffffffffffffffff x6 : 0000ffffb1aca9f0 
x5 : 0000ffffb1aca9f0 x4 : 0000ffffb1aca9f0 
x3 : 0000ffff7a40b074 x2 : 0000ffff7a40b578 
x1 : 000000000000007b x0 : 0000000000000000 

====== end =========

Expected results:
It shouldn't crash.

Additional info:
The attached patch to the mozjs source fixes the problem. On aarch64 architecture the VA bit maximum is 48.

--- Additional comment from Jan Kurik on 2015-07-15 09:18:20 EDT ---

This bug appears to have been reported against 'rawhide' during the Fedora 23 development cycle.
Changing version to '23'.

(As we did not run this process for some time, it could affect also pre-Fedora 23 development
cycle bugs. We are very sorry. It will help us with cleanup during Fedora 23 End Of Life. Thank you.)

More information and reason for this action is here:
https://fedoraproject.org/wiki/BugZappers/HouseKeeping/Fedora23

--- Additional comment from Peter Newton on 2015-08-18 18:53:00 EDT ---

I was interested in making mozjs17 work on an aarch64 system so I built the mozjs17 RPM with the patch above applied.  I can confirm that the RPM built and all of its tests passed on this aarch64 system with a 48b VA kernel.

However, I also built the RPM on a KVM/QEMU VM running Fedora 22 with stock Fedora 22 kernel which is configured with a 42b VA (see Documentation/arm64/memory.txt in kernel source).  In this case, the patch causes the RPM to fail its tests.

I think that JS::Value on 64b platforms uses 17b of tag and 47b of payload (punboxing) for pointers.  So, I am not sure that the patch is actually correct.

--- Additional comment from Radha Mohan Chintakuntla on 2015-08-19 00:30:58 EDT ---

Thanks for testing this out. I am not 100% aware of the mozjs code, so was looking for anyone who can tell if this patch is sufficient or not. Feel free to improve it to make it work on all combinations.

--- Additional comment from Jeremy Linton on 2016-08-02 14:25:34 EDT ---

Please don't apply the attached patch, it will break x86. It also causes an ABI break, requiring everything linked against mozjs to be rebuilt (which implies a .so name bump).


I have a backported version of the upstream patch against mozjs24, and an additional patch to move polkitd off mozjs17 to mozjs24. 

I would take the bug, but I don't appear to have permissions.

--- Additional comment from Zheng Xu on 2016-09-07 02:56 EDT ---

Modify the tag pointer data structure using less tagged bits to mozjs be compatible with 48-bit VA kernel configuration.

--- Additional comment from Zheng Xu on 2016-09-07 02:58 EDT ---

Limit the heap allocation to use memory within 47 bits to make mozjs be compatible with 48-bit VA kernel configuration.

--- Additional comment from Zheng Xu on 2016-09-07 02:58 EDT ---

Limit the heap allocation to use memory within 47 bits to make mozjs be compatible with 48-bit VA kernel configuration.

--- Additional comment from Zheng Xu on 2016-09-07 02:59 EDT ---

Limit the heap allocation to use memory within 47 bits to make mozjs be compatible with 48-bit VA kernel configuration.

--- Additional comment from Zheng Xu on 2016-09-07 03:09:59 EDT ---

Not sure if it is too late. I just attached the patches for mozjs fixes for different versions.

Note : mozjs1.8.5 is a bit different. Because the old mozjs has pre-generated js strings in C code which will be mapped to memory by dynamic linker, so changing heap allocation doesn't help. But the patch for mozjs1.8.5 modifies the tag pointer data structure which is a part of JSAPI, so all the packages depending on mozjs1.8.5 need to be re-built if the patch is used.

--- Additional comment from Fedora Update System on 2016-09-12 13:41:35 EDT ---

mozjs17-17.0.0-16.fc25 has been submitted as an update to Fedora 25. https://bodhi.fedoraproject.org/updates/FEDORA-2016-6a046a4367

--- Additional comment from Debarshi Ray on 2016-09-12 13:42:43 EDT ---

Thanks you very much for the patches!

--- Additional comment from Jeremy Linton on 2016-09-12 17:28:27 EDT ---

See also bug# 1375368 which moves polkit to mozjs24

--- Additional comment from Fedora Update System on 2016-09-13 23:25:27 EDT ---

mozjs17-17.0.0-16.fc25 has been pushed to the Fedora 25 testing repository. If problems still persist, please make note of it in this bug report.
See https://fedoraproject.org/wiki/QA:Updates_Testing for
instructions on how to install test updates.
You can provide feedback for this update here: https://bodhi.fedoraproject.org/updates/FEDORA-2016-6a046a4367

--- Additional comment from Fedora Update System on 2016-09-16 20:58:05 EDT ---

mozjs17-17.0.0-16.fc25 has been pushed to the Fedora 25 stable repository. If problems still persist, please make note of it in this bug report.

Comment 1 Jeremy Linton 2016-11-17 15:08:28 UTC
Yah this one is already in the build. The attached patch is basically the same. 

I would close this, but I cant...

Comment 2 Jeremy Linton 2016-11-17 17:46:39 UTC
Doh, this defect is for mozjs31, (not 45). I submitted my comment about this defect being redundant to the wrong defect.

This patch needs to be applied _IF_ the gjs branch to mozjs31 is accepted before I can get in front of it and get it working with mozjs38.

Comment 3 Zheng Xu 2016-11-18 11:02:11 UTC
Re-open the issue. mozjs31 doesn't have the patch applied. We've closed the wrong ticket.


Note You need to log in before you can comment on or make changes to this bug.