Page MenuHomeFreeBSD

Stop calling set_syscall_retval() from linux_set_syscall_retval()
ClosedPublic

Authored by trasz on Sep 11 2020, 6:24 PM.
Tags
None
Referenced Files
F81619199: D26406.diff
Fri, Apr 19, 2:02 AM
Unknown Object (File)
Feb 19 2024, 9:53 AM
Unknown Object (File)
Feb 19 2024, 9:53 AM
Unknown Object (File)
Feb 19 2024, 9:53 AM
Unknown Object (File)
Dec 20 2023, 4:03 AM
Unknown Object (File)
Nov 7 2023, 9:42 AM
Unknown Object (File)
Oct 9 2023, 6:51 PM
Unknown Object (File)
Sep 13 2023, 8:47 PM
Subscribers

Details

Summary

Stop calling set_syscall_retval() from linux_set_syscall_retval().
The former clobbers some registers that shouldn't be touched.

Diff Detail

Repository
rS FreeBSD src repository - subversion
Lint
Lint Passed
Unit
No Test Coverage
Build Status
Buildable 33694
Build 30931: arc lint + arc unit

Event Timeline

trasz requested review of this revision.Sep 11 2020, 6:24 PM
sys/amd64/linux/linux_sysvec.c
221

So why return instead of break ?

232

Why do this twice ?

252

And you are trying to remove this macro in other review ? Why do you put incomplete change to review ?

sys/amd64/linux/linux_sysvec.c
221

Because that's the end of the fast path for this function. The set_syscall_retval() does the same. It makes actual sense there, since it doesn't need PCB_FULL_IRET, but I've tried to keep two routines as similar as possible.

232

This one is needed; the ones we do unconditionally are to be removed (eventually). Again, same as with set_syscall_retval().

252

It is complete - it applies to CURRENT. Otherwise this patch would depend on the other one, otherwise unrelated.

sys/amd64/linux/linux_sysvec.c
221

But you still set FULL_IRET, which completely undermines the meaning of the 'fast path'.

232

I do not see this patch as committable until the 'eventually' part is resolved. set_syscall_retval() does not set FULL_IRET twice.

252

I do not understand this: you cannot get proper review until one of the patches is resolved.

trasz marked 6 inline comments as done.

Fix multiple issues.

sys/amd64/linux/linux_sysvec.c
221

True. The plan was to keep it as close to set_syscall_retval() as possible, and later just remove the problematic calls to set_pcb_flags(). But you're probably right that the code should fit the current state of things, not the one we'd like to have in the future.

sys/amd64/linux/linux_sysvec.c
230

This paragraph does not make much sense in the context of linux_set_syscall_retval.

234

Isn't this half of the comment relevant to all paths ending in set(FULL_IRET) ? I suggest to move it right above set_pcb_flags() instead of the wishful thinking that is currently at lines 2490250.

trasz marked 2 inline comments as done.Oct 8 2020, 4:52 PM
trasz added inline comments.
sys/amd64/linux/linux_sysvec.c
230

True. I've reworded this somewhat; it still gives a useful hint.

trasz marked an inline comment as done.

Fix stuff.

sys/amd64/linux/linux_sysvec.c
218–219

Why is this assignment needed ?

Remove unnecessary assignment.

trasz added inline comments.
sys/amd64/linux/linux_sysvec.c
218–219

It's not; I just didn't quite understood what it did and wanted to be extra safe there. Removed.

kib added inline comments.
sys/amd64/linux/linux_sysvec.c
217

May be move this comment down as the first sentence before 'require full context restore ...'. It would avoid requiring to read everything to understand that comment.

250

I think it would be more up to point if you say there '... to get all registers except %rcx and %r11 restored ...'.

This revision is now accepted and ready to land.Oct 16 2020, 2:23 PM
This revision was automatically updated to reflect the committed changes.
trasz marked an inline comment as done.