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

Add initial code for syscall redirection, fix path lookup failures. #21

Open
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

krnlyng
Copy link
Contributor

@krnlyng krnlyng commented Jan 10, 2023

No description provided.

@krnlyng
Copy link
Contributor Author

krnlyng commented Jan 10, 2023

I still need to test this a bit before merging, but seems to work so far.

@krnlyng krnlyng changed the title [sb2] Allow redirecting syscalls (execve only for now). JB#55042 Add inital code for syscall redirection, fix loading libclang. Jan 10, 2023
@krnlyng krnlyng force-pushed the jb55042 branch 8 times, most recently from b8d9339 to 4c78b09 Compare January 11, 2023 18:04
Copy link
Contributor

@Thaodan Thaodan left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Re: Make sure libclang can be loaded properly, I think commit message is incorrect since you add rules for clang and llvm.

Also the changes need to be applied to all rules that use tooling e.g. the debian obs rules.

@krnlyng krnlyng changed the title Add inital code for syscall redirection, fix loading libclang. WIP: Add inital code for syscall redirection, fix loading libclang. Jan 11, 2023
* syscallgate -- syscall() GATE for the scratchbox2 preload library
*
* Copyright (C) 2023 Jolla Ltd.
* Contact: Franz-Josef Haider <[email protected]>
Copy link
Contributor

@Thaodan Thaodan Jan 11, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we should skip adding contact addresses here.

The header misses the license, I would suggest:

 *
 *  SPDX-FileCopyrightText: 2022, Jolla Ltd.
 *  SPDX-License-Identifier: GPL-2.0
 *

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

added a header, is it ok like i did it?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah looks good, we should check the contact address

@krnlyng krnlyng force-pushed the jb55042 branch 11 times, most recently from 4028239 to 6615f60 Compare January 12, 2023 10:54
krnlyng pushed a commit to krnlyng/qemu-usermode that referenced this pull request Jan 12, 2023
krnlyng pushed a commit to krnlyng/qemu-usermode that referenced this pull request Jan 12, 2023
After sailfishos/scratchbox2#21
is merged, we can now let syscalls go through the C syscall
function.
@krnlyng krnlyng changed the title WIP: Add inital code for syscall redirection, fix loading libclang. WIP: Add initial code for syscall redirection, fix loading libclang. Jan 12, 2023
preload/syscalls.c Outdated Show resolved Hide resolved
@krnlyng krnlyng force-pushed the jb55042 branch 2 times, most recently from dcf761b to d851745 Compare January 12, 2023 12:24
krnlyng pushed a commit to krnlyng/qemu-usermode that referenced this pull request Jan 12, 2023
After sailfishos/scratchbox2#21
is merged, we can now let syscalls go through the C syscall
function.
@krnlyng krnlyng force-pushed the jb55042 branch 2 times, most recently from 03ce75d to 25414dc Compare January 12, 2023 13:21

#define GET_MACRO(_0,_1,_2,_3,_4,_5,_6,NAME,...) NAME
#define FOR_EACH(action,...) \
GET_MACRO(_0,__VA_ARGS__,EXPAND_6,EXPAND_5,EXPAND_4,EXPAND_3,EXPAND_2,EXPAND_1,EXPAND_0)(action,__VA_ARGS__)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is brilliant!

@vigejolla
Copy link
Member

LGTM, except for the "WIP" in title

krnlyng pushed a commit to krnlyng/qemu-usermode that referenced this pull request Jan 13, 2023
After sailfishos/scratchbox2#21
is merged, we can now let syscalls go through the C syscall
function.
krnlyng pushed a commit to krnlyng/qemu-usermode that referenced this pull request Jan 13, 2023
After sailfishos/scratchbox2#21
is merged, we can now let syscalls go through the C syscall
function.
if (asprintf(&virtual_abs_path_at_fd, "%s/%s", dirfd_path, virtual_path) < 0) {
/* asprintf failed */
abort();
if (!virtual_path) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

!virtual_path || *virtual_path == '\0' would avoid trailing slash in the latter case I think.

@krnlyng krnlyng changed the title WIP: Add initial code for syscall redirection, fix loading libclang. Add initial code for syscall redirection, fix path lookup failures. Aug 22, 2023
Copy link

@vige vige left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants