Message ID | 20221212173416.90590-1-deller@gmx.de (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
Series | [1/2] linux-user: Implement SOL_ALG encryption support | expand |
Le 12/12/2022 à 18:34, Helge Deller a écrit : > Add suport to handle SOL_ALG packets via sendmsg() and recvmsg(). > This allows emulated userspace to use encryption functionality. > > Tested with the debian ell package with hppa guest on x86_64 host. > > Signed-off-by: Helge Deller <deller@gmx.de> > --- > linux-user/syscall.c | 8 ++++++++ > 1 file changed, 8 insertions(+) > > diff --git a/linux-user/syscall.c b/linux-user/syscall.c > index 71ae867024..a365903a3a 100644 > --- a/linux-user/syscall.c > +++ b/linux-user/syscall.c > @@ -1871,6 +1871,14 @@ static inline abi_long target_to_host_cmsg(struct msghdr *msgh, > __get_user(cred->pid, &target_cred->pid); > __get_user(cred->uid, &target_cred->uid); > __get_user(cred->gid, &target_cred->gid); > + } else if (cmsg->cmsg_level == SOL_ALG) { > + uint32_t *dst = (uint32_t *)data; > + > + memcpy(dst, target_data, len); > + /* fix endianess of first 32-bit word */ > + if (len >= sizeof(uint32_t)) { > + *dst = tswap32(*dst); > + } > } else { > qemu_log_mask(LOG_UNIMP, "Unsupported ancillary data: %d/%d\n", > cmsg->cmsg_level, cmsg->cmsg_type); > -- > 2.38.1 > > Reviewed-by: Laurent Vivier <laurent@vivier.eu>
Le 12/12/2022 à 18:34, Helge Deller a écrit : > Add suport to handle SOL_ALG packets via sendmsg() and recvmsg(). > This allows emulated userspace to use encryption functionality. > > Tested with the debian ell package with hppa guest on x86_64 host. > > Signed-off-by: Helge Deller <deller@gmx.de> > --- > linux-user/syscall.c | 8 ++++++++ > 1 file changed, 8 insertions(+) > > diff --git a/linux-user/syscall.c b/linux-user/syscall.c > index 71ae867024..a365903a3a 100644 > --- a/linux-user/syscall.c > +++ b/linux-user/syscall.c > @@ -1871,6 +1871,14 @@ static inline abi_long target_to_host_cmsg(struct msghdr *msgh, > __get_user(cred->pid, &target_cred->pid); > __get_user(cred->uid, &target_cred->uid); > __get_user(cred->gid, &target_cred->gid); > + } else if (cmsg->cmsg_level == SOL_ALG) { > + uint32_t *dst = (uint32_t *)data; > + > + memcpy(dst, target_data, len); > + /* fix endianess of first 32-bit word */ > + if (len >= sizeof(uint32_t)) { > + *dst = tswap32(*dst); > + } > } else { > qemu_log_mask(LOG_UNIMP, "Unsupported ancillary data: %d/%d\n", > cmsg->cmsg_level, cmsg->cmsg_type); > -- > 2.38.1 > > Applied to my linux-user-for-8.0 branch. Thanks, Laurent
diff --git a/linux-user/syscall.c b/linux-user/syscall.c index 71ae867024..a365903a3a 100644 --- a/linux-user/syscall.c +++ b/linux-user/syscall.c @@ -1871,6 +1871,14 @@ static inline abi_long target_to_host_cmsg(struct msghdr *msgh, __get_user(cred->pid, &target_cred->pid); __get_user(cred->uid, &target_cred->uid); __get_user(cred->gid, &target_cred->gid); + } else if (cmsg->cmsg_level == SOL_ALG) { + uint32_t *dst = (uint32_t *)data; + + memcpy(dst, target_data, len); + /* fix endianess of first 32-bit word */ + if (len >= sizeof(uint32_t)) { + *dst = tswap32(*dst); + } } else { qemu_log_mask(LOG_UNIMP, "Unsupported ancillary data: %d/%d\n", cmsg->cmsg_level, cmsg->cmsg_type);
Add suport to handle SOL_ALG packets via sendmsg() and recvmsg(). This allows emulated userspace to use encryption functionality. Tested with the debian ell package with hppa guest on x86_64 host. Signed-off-by: Helge Deller <deller@gmx.de> --- linux-user/syscall.c | 8 ++++++++ 1 file changed, 8 insertions(+) -- 2.38.1