Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in / Register
Toggle navigation
M
Magisk
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Administrator
Magisk
Commits
cbe97cdf
Commit
cbe97cdf
authored
Jan 23, 2022
by
topjohnwu
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix dynamic_bitset implementation
parent
407dfc75
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
15 additions
and
13 deletions
+15
-13
misc.hpp
native/jni/utils/misc.hpp
+12
-10
entry.cpp
native/jni/zygisk/entry.cpp
+2
-2
hook.cpp
native/jni/zygisk/hook.cpp
+1
-1
No files found.
native/jni/utils/misc.hpp
View file @
cbe97cdf
...
...
@@ -81,21 +81,23 @@ public:
};
class
dynamic_bitset
{
private
:
using
long_bits
=
std
::
bitset
<
sizeof
(
unsigned
long
)
>
;
std
::
vector
<
long_bits
>
bits
;
public
:
constexpr
static
int
slot_size
=
sizeof
(
unsigned
long
);
long_bits
::
reference
operator
[]
(
size_t
pos
)
{
using
slot_type
=
unsigned
long
;
constexpr
static
int
slot_size
=
sizeof
(
slot_type
)
*
8
;
using
slot_bits
=
std
::
bitset
<
slot_size
>
;
slot_bits
::
reference
operator
[]
(
size_t
pos
)
{
size_t
slot
=
pos
/
slot_size
;
size_t
index
=
pos
%
slot_size
;
if
(
bits
.
size
()
<=
slot
)
{
bits
.
resize
(
slot
+
1
);
if
(
slot_list
.
size
()
<=
slot
)
{
slot_list
.
resize
(
slot
+
1
);
}
return
bits
[
slot
][
index
];
return
slot_list
[
slot
][
index
];
}
size_t
slots
()
const
{
return
bits
.
size
();
}
unsigned
long
to_ulong
(
size_t
slot
)
const
{
return
bits
[
slot
].
to_ulong
();
}
size_t
slots
()
const
{
return
slot_list
.
size
();
}
slot_type
get_slot
(
size_t
slot
)
const
{
return
slot_list
[
slot
].
to_ulong
();
}
private
:
std
::
vector
<
slot_bits
>
slot_list
;
};
int
parse_int
(
std
::
string_view
s
);
...
...
native/jni/zygisk/entry.cpp
View file @
cbe97cdf
...
...
@@ -362,9 +362,9 @@ static void get_process_info(int client, const sock_cred *cred) {
int
slots
=
read_int
(
client
);
int
id
=
0
;
for
(
int
i
=
0
;
i
<
slots
;
++
i
)
{
unsigned
long
l
=
0
;
dynamic_bitset
::
slot_type
l
=
0
;
xxread
(
client
,
&
l
,
sizeof
(
l
));
bitset
<
sizeof
(
unsigned
long
)
>
bits
(
l
);
dynamic_bitset
::
slot_bits
bits
(
l
);
for
(
int
j
=
0
;
id
<
module_list
->
size
();
++
j
,
++
id
)
{
if
(
!
bits
[
j
])
{
// Either not a zygisk module, or incompatible
...
...
native/jni/zygisk/hook.cpp
View file @
cbe97cdf
...
...
@@ -505,7 +505,7 @@ void HookContext::nativeForkSystemServer_pre() {
}
write_int
(
fd
,
bits
.
slots
());
for
(
int
i
=
0
;
i
<
bits
.
slots
();
++
i
)
{
unsigned
long
l
=
bits
.
to_ulong
(
i
);
auto
l
=
bits
.
get_slot
(
i
);
xwrite
(
fd
,
&
l
,
sizeof
(
l
));
}
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment