On Wed, Mar 17, 2021 at 7:58 AM 马麟 <
kylin.f...@gmail.com> wrote:
>
> Hi there
> I was trying to write my own pseudo-syscall to start fuzzing. That is why I have to add some descriptions using syzlang.
>
> After figuring out the contents in the documentation as well as some examples, I have the following concerns.
>
> Can syzlang support multiple resource descriptions?
>
> The "multiple" I talked about here is like maybe one (pseudo-)system call will produce two different resources. These two different resources may be used individually by other syscalls. For code, it looks like
>
> resource my_resource_1[int32]
> resource my_resource_2[int32]
>
> my_new_syscall(....) <= Both my_resource_1/my_resource_2 created in this syscall
> some_syscall1(fd my_resource_1)
> some_syscall2(fd my_resource_2)
>
> From my point of view, the design of my_new_syscall maybe is not graceful. However, is there any choice I can encode a resource into one struct and split them for other syscalls?
Hi,
Yes, this is perfectly supported. A single syscall can return multiple
resources via different pointers, or via multiple fields of a single
struct.
> For example, define a resource as int64, which is the concatenation of two int32.
You just declare it as 2 int32 fields. Not sure why you want to treat
it as a single int64 in the first.
> When calling some_syscall1, the resource has to be xor with a mask.
>
> How can I manage to achieve this? Or is there any else way out?
There is no direct support for xor. Looks like a very unfortunate API
design. If it still can be changed, I would go and ask authors to
change it to accepted/common kernel API patterns.