Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

arm64: expected absolute expression #473

Closed
bwendling opened this issue May 9, 2019 · 4 comments
Closed

arm64: expected absolute expression #473

bwendling opened this issue May 9, 2019 · 4 comments
Assignees
Labels
[BUG] llvm A bug that should be fixed in upstream LLVM [FIXED][LLVM] 10 This bug was fixed in LLVM 10.0 [TOOL] integrated-as The issue is relevant to LLVM integrated assembler

Comments

@bwendling
Copy link

bwendling commented May 9, 2019

I'm seeing this with ARM64, but I think it's a generic failure. This occurs when compiling arch/arm64/kernel/vdso/gettimeofday.S:

$ cat bad.s
.macro jump_slot jumptable, index, label
.if (. - \jumptable) != 4 * (\index)
.error "Jump slot index mismatch"
.endif
  b \label
.endm

.text
jumptable:
  jump_slot jumptable, 0, realtime

$ clang -cc1as -triple aarch64-grtev4-linux-gnu -target-cpu generic -target-feature +neon -mrelocation-model static -o /dev/null bad.s
<instantiation>:1:5: error: expected absolute expression
.if (. - jumptable) != 4 * (0)
    ^
bad.s:10:3: note: while in macro instantiation
  jump_slot jumptable, 0, realtime
  ^
<instantiation>:2:1: error: Jump slot index mismatch
.error "Jump slot index mismatch"
^
bad.s:10:3: note: while in macro instantiation
  jump_slot jumptable, 0, realtime
  ^
@bwendling bwendling added [BUG] llvm A bug that should be fixed in upstream LLVM [TOOL] integrated-as The issue is relevant to LLVM integrated assembler labels May 9, 2019
@bwendling
Copy link
Author

bwendling commented May 10, 2019

https://llvm.org/pr41825

nathanchance pushed a commit that referenced this issue Oct 26, 2019
We have a test case like block/001 in blktests, which will create a scsi
device by loading scsi_debug module and then try to delete the device by
sysfs interface. At the same time, it may remove the scsi_debug module.

And getting a invalid paging request BUG_ON as following:

[   34.625854] BUG: unable to handle page fault for address: ffffffffa0016bb8
[   34.629189] Oops: 0000 [#1] SMP PTI
[   34.629618] CPU: 1 PID: 450 Comm: bash Tainted: G        W         5.4.0-rc3+ #473
[   34.632524] RIP: 0010:scsi_proc_hostdir_rm+0x5/0xa0
[   34.643555] CR2: ffffffffa0016bb8 CR3: 000000012cd88000 CR4: 00000000000006e0
[   34.644545] Call Trace:
[   34.644907]  scsi_host_dev_release+0x6b/0x1f0
[   34.645511]  device_release+0x74/0x110
[   34.646046]  kobject_put+0x116/0x390
[   34.646559]  put_device+0x17/0x30
[   34.647041]  scsi_target_dev_release+0x2b/0x40
[   34.647652]  device_release+0x74/0x110
[   34.648186]  kobject_put+0x116/0x390
[   34.648691]  put_device+0x17/0x30
[   34.649157]  scsi_device_dev_release_usercontext+0x2e8/0x360
[   34.649953]  execute_in_process_context+0x29/0x80
[   34.650603]  scsi_device_dev_release+0x20/0x30
[   34.651221]  device_release+0x74/0x110
[   34.651732]  kobject_put+0x116/0x390
[   34.652230]  sysfs_unbreak_active_protection+0x3f/0x50
[   34.652935]  sdev_store_delete.cold.4+0x71/0x8f
[   34.653579]  dev_attr_store+0x1b/0x40
[   34.654103]  sysfs_kf_write+0x3d/0x60
[   34.654603]  kernfs_fop_write+0x174/0x250
[   34.655165]  __vfs_write+0x1f/0x60
[   34.655639]  vfs_write+0xc7/0x280
[   34.656117]  ksys_write+0x6d/0x140
[   34.656591]  __x64_sys_write+0x1e/0x30
[   34.657114]  do_syscall_64+0xb1/0x400
[   34.657627]  entry_SYSCALL_64_after_hwframe+0x44/0xa9
[   34.658335] RIP: 0033:0x7f156f337130

During deleting scsi target, the scsi_debug module have been removed. Then,
sdebug_driver_template belonged to the module cannot be accessd, resulting
in scsi_proc_hostdir_rm() BUG_ON.

To fix the bug, we add scsi_device_get() in sdev_store_delete() to try to
increase refcount of module, avoiding the module been removed.

Cc: [email protected]
Link: https://lore.kernel.org/r/[email protected]
Signed-off-by: Yufen Yu <[email protected]>
Reviewed-by: Bart Van Assche <[email protected]>
Signed-off-by: Martin K. Petersen <[email protected]>
@jcai19 jcai19 self-assigned this Nov 9, 2019
@jcai19
Copy link
Member

jcai19 commented Nov 9, 2019

https://llvm.org/pr41825

I have a patch at https://reviews.llvm.org/D69411 for issue #742. The causes of the two issue are different, but their solution seems to be similar enough so I have added code to the same patch to fix issue as well. I have updated the upstream bug with more details.

@jcai19 jcai19 added [PATCH] Exists There is a patch that fixes this issue [PATCH] Submitted A patch has been submitted for review and removed [PATCH] Exists There is a patch that fixes this issue labels Nov 9, 2019
@jcai19
Copy link
Member

jcai19 commented Nov 11, 2019

A new solution is available at https://reviews.llvm.org/D70062.

@nickdesaulniers nickdesaulniers assigned jyknight and unassigned jcai19 Nov 12, 2019
@nickdesaulniers
Copy link
Member

@nickdesaulniers nickdesaulniers added [FIXED][LLVM] 10 This bug was fixed in LLVM 10.0 and removed [PATCH] Submitted A patch has been submitted for review labels Nov 18, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
[BUG] llvm A bug that should be fixed in upstream LLVM [FIXED][LLVM] 10 This bug was fixed in LLVM 10.0 [TOOL] integrated-as The issue is relevant to LLVM integrated assembler
Projects
None yet
Development

No branches or pull requests

4 participants