2017-04-13 18:35:13

by abed mohammad kamaluddin

[permalink] [raw]
Subject: [RFC PATCH v1 0/1] *** crypto: AF_ALG: add compression support ***

Hi Herbert,

This patch adds compression support to the AF_ALG interface exported by the
kernel crypto API. By extending AF_ALG, all compression algorithms of types
scomp and acomp, which the kernel crypto API allows access to, are now also
accessible from userspace.

The new compression interface has been tested with both kernel software
deflate(scomp) and HW accelerated ThunderX deflate(scomp) using the zpipe
example application provided by zlib.

The user-space side would look similar to hash/cipher implementations.

struct sockaddr_alg sa = {
.salg_family = AF_ALG,
.salg_type = "compression",
.salg_name = "deflate"
};

The operations supported are ALG_OP_DECOMPRESS and ALG_OP_COMPRESS. This
interface is synchronous and handles one request at a time. The data for
compression/decompression is read in sendmsg and all operations are carried
out and completed in recvmsg.

This interface can utilize full deflate functionality provided by kernel.
However to achieve complete zlib functionality in user space, the acomp
interface needs to be modified and provide api's to pass context and additional
data between the kernel user and algorithm as has been pointed on a different
thread.

Patches have been generated on top of "kernel/git/herbert/crypto-2.6.git" repo.

Abed Kamaluddin (1):
crypto: algif_compression - User-space interface for compression

crypto/Kconfig | 11 ++
crypto/Makefile | 1 +
crypto/algif_compression.c | 272 ++++++++++++++++++++++++++++++++++++++++++++
include/uapi/linux/if_alg.h | 2 +
4 files changed, 286 insertions(+)
create mode 100644 crypto/algif_compression.c

--
2.7.4


2017-04-13 18:35:37

by abed mohammad kamaluddin

[permalink] [raw]
Subject: [RFC PATCH v1 1/1] crypto: algif_compression - User-space interface for compression

crypto: algif_compression - User-space interface for compression

This patch adds af_alg plugin for compression algorithms of type scomp/acomp
registered to the kernel crypto layer.

The user needs to set operation (compression/decompression) as a control
message to sendmsg, identical to selecting the cipher operation type in case of
ciphers. Once a sendmsg call occurs, no further writes can be made to the
socket until all previous data has been processed and read. Therefore the
interface only supports one request at a time.

The interface is completely synchronous; all operations are carried out in
recvmsg and will complete prior to the system call returning.

The sendmsg and recvmsg interface supports directly reading/writing to
user-space without additional copying, i.e., the kernel crypto interface will
receive the user-space address as its input/output SG list. The scomp interface
or crypto drivers may copy the data as required.

Signed-off-by: Abed Kamaluddin <[email protected]>
Signed-off-by: Mahipal Challa <[email protected]>

---
crypto/Kconfig | 11 ++
crypto/Makefile | 1 +
crypto/algif_compression.c | 272 ++++++++++++++++++++++++++++++++++++++++++++
include/uapi/linux/if_alg.h | 2 +
4 files changed, 286 insertions(+)

diff --git a/crypto/Kconfig b/crypto/Kconfig
index f37e9cc..13b03ba 100644
--- a/crypto/Kconfig
+++ b/crypto/Kconfig
@@ -1741,6 +1741,17 @@ config CRYPTO_USER_API_AEAD
This option enables the user-spaces interface for AEAD
cipher algorithms.

+config CRYPTO_USER_API_COMPRESSION
+ tristate "User-space interface for compression algorithms"
+ depends on NET
+ select CRYPTO_ACOMP
+ select CRYPTO_USER_API
+ help
+ This option enables the user-space interface for compression
+ algorithms. Enable this option for access to compression algorithms
+ of type scomp/acomp exported by the kernel crypto layer through
+ AF_ALG interface.
+
config CRYPTO_HASH_INFO
bool

diff --git a/crypto/Makefile b/crypto/Makefile
index 8a44057..1469e06 100644
--- a/crypto/Makefile
+++ b/crypto/Makefile
@@ -134,6 +134,7 @@ obj-$(CONFIG_CRYPTO_TEST) += tcrypt.o
obj-$(CONFIG_CRYPTO_GHASH) += ghash-generic.o
obj-$(CONFIG_CRYPTO_USER_API) += af_alg.o
obj-$(CONFIG_CRYPTO_USER_API_HASH) += algif_hash.o
+obj-$(CONFIG_CRYPTO_USER_API_COMPRESSION) += algif_compression.o
obj-$(CONFIG_CRYPTO_USER_API_SKCIPHER) += algif_skcipher.o
obj-$(CONFIG_CRYPTO_USER_API_RNG) += algif_rng.o
obj-$(CONFIG_CRYPTO_USER_API_AEAD) += algif_aead.o
diff --git a/crypto/algif_compression.c b/crypto/algif_compression.c
new file mode 100644
index 0000000..0ba6d1e
--- /dev/null
+++ b/crypto/algif_compression.c
@@ -0,0 +1,272 @@
+/*
+ * algif_compression: User-space interface for COMPRESSION algorithms
+ *
+ * This file provides user-space API support for compression algorithms
+ * registered through the kernel crypto layer.
+ *
+ * Copyright (C) 2017 Cavium, Inc.
+ *
+ * Original Authors: Abed Kamaluddin <[email protected]>
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License as published by the Free
+ * Software Foundation; either version 2 of the License, or (at your option)
+ * any later version.
+ */
+
+#include <crypto/acompress.h>
+#include <crypto/if_alg.h>
+#include <linux/crypto.h>
+#include <linux/init.h>
+#include <linux/kernel.h>
+#include <linux/mm.h>
+#include <linux/module.h>
+#include <linux/net.h>
+#include <net/sock.h>
+#include <linux/scatterlist.h>
+
+/* scomp scratch is currently 128KB */
+#define COMP_BUFFER_SIZE 65535
+
+struct comp_ctx {
+ struct af_alg_sgl tsgl;
+ struct af_alg_sgl rsgl;
+ struct af_alg_completion completion;
+ unsigned int clen;
+ unsigned int slen;
+ unsigned int dlen;
+ bool comp;
+ bool used;
+ struct acomp_req *acomp_req;
+};
+
+struct comp_tfm {
+ struct crypto_acomp *acomp;
+};
+
+static int comp_sendmsg(struct socket *sock, struct msghdr *msg,
+ size_t ignored)
+{
+ struct sock *sk = sock->sk;
+ struct alg_sock *ask = alg_sk(sk);
+ struct comp_ctx *ctx = ask->private;
+ struct af_alg_control con = {};
+ int limit = COMP_BUFFER_SIZE;
+ int len;
+ int err = -EINVAL;
+
+ if (msg->msg_controllen) {
+ err = af_alg_cmsg_send(msg, &con);
+ if (err)
+ return err;
+
+ switch (con.op) {
+ case ALG_OP_COMPRESS:
+ ctx->comp = 1;
+ break;
+
+ case ALG_OP_DECOMPRESS:
+ ctx->comp = 0;
+ break;
+
+ default:
+ return -EINVAL;
+ }
+ }
+
+ lock_sock(sk);
+
+ /* One request at a time supported, data submitted for comp/decomp will
+ * be processed at subsequent recvmsg
+ */
+ if (ctx->used) {
+ err = -EAGAIN;
+ goto unlock;
+ }
+
+ len = msg_data_left(msg);
+
+ if (len > limit)
+ len = limit;
+
+ len = af_alg_make_sg(&ctx->tsgl, &msg->msg_iter, len);
+
+ if (len < 0) {
+ err = len;
+ goto unlock;
+ }
+
+ ctx->slen = len;
+ ctx->used = 1;
+
+unlock:
+ release_sock(sk);
+
+ return err ?: len;
+}
+
+static int comp_recvmsg(struct socket *sock, struct msghdr *msg, size_t len,
+ int flags)
+{
+ struct sock *sk = sock->sk;
+ struct alg_sock *ask = alg_sk(sk);
+ struct comp_ctx *ctx = ask->private;
+ int rlen = ctx->dlen;
+ int err;
+
+ if (len > rlen)
+ len = rlen;
+
+ lock_sock(sk);
+
+ if (!ctx->used) {
+ err = -EAGAIN;
+ goto unlock;
+ }
+
+ len = af_alg_make_sg(&ctx->rsgl, &msg->msg_iter, len);
+ if (len < 0) {
+ err = len;
+ goto unlock;
+ }
+
+ acomp_request_set_params(ctx->acomp_req, ctx->tsgl.sg, ctx->rsgl.sg,
+ ctx->slen, len);
+
+ /* Synchronous completion of comp/decomp requests */
+ err = af_alg_wait_for_completion(
+ ctx->comp ?
+ crypto_acomp_compress(ctx->acomp_req) :
+ crypto_acomp_decompress(ctx->acomp_req),
+ &ctx->completion);
+
+ /* Add acomp req wrapper for dlen */
+ len = (ctx->acomp_req)->dlen;
+
+ af_alg_free_sg(&ctx->tsgl);
+ af_alg_free_sg(&ctx->rsgl);
+
+unlock:
+ ctx->used = 0;
+ release_sock(sk);
+
+ return err ?: len;
+}
+
+static struct proto_ops algif_comp_ops = {
+ .family = PF_ALG,
+
+ .connect = sock_no_connect,
+ .socketpair = sock_no_socketpair,
+ .getname = sock_no_getname,
+ .ioctl = sock_no_ioctl,
+ .listen = sock_no_listen,
+ .shutdown = sock_no_shutdown,
+ .getsockopt = sock_no_getsockopt,
+ .mmap = sock_no_mmap,
+ .bind = sock_no_bind,
+ .setsockopt = sock_no_setsockopt,
+ .poll = sock_no_poll,
+
+ .release = af_alg_release,
+ .sendmsg = comp_sendmsg,
+ .recvmsg = comp_recvmsg,
+ .sendpage = sock_no_sendpage,
+ .accept = sock_no_accept,
+};
+
+static void *comp_bind(const char *name, u32 type, u32 mask)
+{
+ struct comp_tfm *tfm;
+ struct crypto_acomp *acomp;
+
+ tfm = kzalloc(sizeof(*tfm), GFP_KERNEL);
+ if (!tfm)
+ return ERR_PTR(-ENOMEM);
+
+ acomp = crypto_alloc_acomp(name, type, mask);
+ if (IS_ERR_OR_NULL(acomp)) {
+ kfree(tfm);
+ return ERR_PTR(-ENOMEM);
+ }
+ tfm->acomp = acomp;
+
+ return tfm;
+}
+
+static void comp_release(void *private)
+{
+ struct comp_tfm *tfm = private;
+
+ crypto_free_acomp(tfm->acomp);
+ kfree(tfm);
+}
+
+static void comp_sock_destruct(struct sock *sk)
+{
+ struct alg_sock *ask = alg_sk(sk);
+ struct comp_ctx *ctx = ask->private;
+
+ acomp_request_free(ctx->acomp_req);
+ sock_kfree_s(sk, ctx, ctx->clen);
+ af_alg_release_parent(sk);
+}
+
+static int comp_accept_parent(void *private, struct sock *sk)
+{
+ struct comp_ctx *ctx;
+ struct alg_sock *ask = alg_sk(sk);
+ struct comp_tfm *tfm = private;
+ struct crypto_acomp *acomp = tfm->acomp;
+ unsigned int len = sizeof(*ctx);
+
+ ctx = sock_kmalloc(sk, len, GFP_KERNEL);
+ if (!ctx)
+ return -ENOMEM;
+
+ ctx->used = 0;
+ ctx->clen = len;
+ ctx->dlen = COMP_BUFFER_SIZE;
+ ctx->slen = COMP_BUFFER_SIZE;
+
+ af_alg_init_completion(&ctx->completion);
+
+ ctx->acomp_req = acomp_request_alloc(acomp);
+ if (!ctx->acomp_req) {
+ sock_kfree_s(sk, ctx, ctx->clen);
+ return -ENOMEM;
+ }
+
+ acomp_request_set_callback(ctx->acomp_req, CRYPTO_TFM_REQ_MAY_BACKLOG,
+ af_alg_complete, &ctx->completion);
+
+ ask->private = ctx;
+ sk->sk_destruct = comp_sock_destruct;
+
+ return 0;
+}
+
+static const struct af_alg_type algif_type_comp = {
+ .bind = comp_bind,
+ .release = comp_release,
+ .accept = comp_accept_parent,
+ .ops = &algif_comp_ops,
+ .name = "compression",
+ .owner = THIS_MODULE
+};
+
+static int __init algif_comp_init(void)
+{
+ return af_alg_register_type(&algif_type_comp);
+}
+
+static void __exit algif_comp_exit(void)
+{
+ int err = af_alg_unregister_type(&algif_type_comp);
+
+ BUG_ON(err);
+}
+
+module_init(algif_comp_init);
+module_exit(algif_comp_exit);
+MODULE_LICENSE("GPL");
diff --git a/include/uapi/linux/if_alg.h b/include/uapi/linux/if_alg.h
index f2acd2f..5cca9eb 100644
--- a/include/uapi/linux/if_alg.h
+++ b/include/uapi/linux/if_alg.h
@@ -38,5 +38,7 @@ struct af_alg_iv {
/* Operations */
#define ALG_OP_DECRYPT 0
#define ALG_OP_ENCRYPT 1
+#define ALG_OP_DECOMPRESS 0
+#define ALG_OP_COMPRESS 1

#endif /* _LINUX_IF_ALG_H */
--
2.7.4

Subject: Re: [RFC PATCH v1 1/1] crypto: algif_compression - User-space interface for compression

On 14 April 2017 at 00:04, Abed Kamaluddin <[email protected]> wrote:
> crypto: algif_compression - User-space interface for compression
>
> This patch adds af_alg plugin for compression algorithms of type scomp/acomp
> registered to the kernel crypto layer.
>
> The user needs to set operation (compression/decompression) as a control
> message to sendmsg, identical to selecting the cipher operation type in case of
> ciphers. Once a sendmsg call occurs, no further writes can be made to the
> socket until all previous data has been processed and read. Therefore the
> interface only supports one request at a time.
>
> The interface is completely synchronous; all operations are carried out in
> recvmsg and will complete prior to the system call returning.
>
> The sendmsg and recvmsg interface supports directly reading/writing to
> user-space without additional copying, i.e., the kernel crypto interface will
> receive the user-space address as its input/output SG list. The scomp interface
> or crypto drivers may copy the data as required.
>
> Signed-off-by: Abed Kamaluddin <[email protected]>
> Signed-off-by: Mahipal Challa <[email protected]>
>
> ---
> crypto/Kconfig | 11 ++
> crypto/Makefile | 1 +
> crypto/algif_compression.c | 272 ++++++++++++++++++++++++++++++++++++++++++++
> include/uapi/linux/if_alg.h | 2 +
> 4 files changed, 286 insertions(+)
>
> diff --git a/crypto/Kconfig b/crypto/Kconfig
> index f37e9cc..13b03ba 100644
> --- a/crypto/Kconfig
> +++ b/crypto/Kconfig
> @@ -1741,6 +1741,17 @@ config CRYPTO_USER_API_AEAD
> This option enables the user-spaces interface for AEAD
> cipher algorithms.
>
> +config CRYPTO_USER_API_COMPRESSION
> + tristate "User-space interface for compression algorithms"
> + depends on NET
> + select CRYPTO_ACOMP
> + select CRYPTO_USER_API
> + help
> + This option enables the user-space interface for compression
> + algorithms. Enable this option for access to compression algorithms
> + of type scomp/acomp exported by the kernel crypto layer through
> + AF_ALG interface.
> +
> config CRYPTO_HASH_INFO
> bool
>
> diff --git a/crypto/Makefile b/crypto/Makefile
> index 8a44057..1469e06 100644
> --- a/crypto/Makefile
> +++ b/crypto/Makefile
> @@ -134,6 +134,7 @@ obj-$(CONFIG_CRYPTO_TEST) += tcrypt.o
> obj-$(CONFIG_CRYPTO_GHASH) += ghash-generic.o
> obj-$(CONFIG_CRYPTO_USER_API) += af_alg.o
> obj-$(CONFIG_CRYPTO_USER_API_HASH) += algif_hash.o
> +obj-$(CONFIG_CRYPTO_USER_API_COMPRESSION) += algif_compression.o
> obj-$(CONFIG_CRYPTO_USER_API_SKCIPHER) += algif_skcipher.o
> obj-$(CONFIG_CRYPTO_USER_API_RNG) += algif_rng.o
> obj-$(CONFIG_CRYPTO_USER_API_AEAD) += algif_aead.o
> diff --git a/crypto/algif_compression.c b/crypto/algif_compression.c
> new file mode 100644
> index 0000000..0ba6d1e
> --- /dev/null
> +++ b/crypto/algif_compression.c
> @@ -0,0 +1,272 @@
> +/*
> + * algif_compression: User-space interface for COMPRESSION algorithms
> + *
> + * This file provides user-space API support for compression algorithms
> + * registered through the kernel crypto layer.
> + *
> + * Copyright (C) 2017 Cavium, Inc.
> + *
> + * Original Authors: Abed Kamaluddin <[email protected]>
> + *
> + * This program is free software; you can redistribute it and/or modify it
> + * under the terms of the GNU General Public License as published by the Free
> + * Software Foundation; either version 2 of the License, or (at your option)
> + * any later version.
> + */
> +
> +#include <crypto/acompress.h>
> +#include <crypto/if_alg.h>
> +#include <linux/crypto.h>
> +#include <linux/init.h>
> +#include <linux/kernel.h>
> +#include <linux/mm.h>
> +#include <linux/module.h>
> +#include <linux/net.h>
> +#include <net/sock.h>
> +#include <linux/scatterlist.h>
> +
> +/* scomp scratch is currently 128KB */
> +#define COMP_BUFFER_SIZE 65535
> +
> +struct comp_ctx {
> + struct af_alg_sgl tsgl;
> + struct af_alg_sgl rsgl;
> + struct af_alg_completion completion;
> + unsigned int clen;
> + unsigned int slen;
> + unsigned int dlen;
> + bool comp;
> + bool used;
> + struct acomp_req *acomp_req;
> +};

Is it necessary to have 3 len fields viz clen, slen, dlen? Please add
a comment indicating their purpose.

> +struct comp_tfm {
> + struct crypto_acomp *acomp;
> +};
> +
> +static int comp_sendmsg(struct socket *sock, struct msghdr *msg,
> + size_t ignored)
> +{
> + struct sock *sk = sock->sk;
> + struct alg_sock *ask = alg_sk(sk);
> + struct comp_ctx *ctx = ask->private;
> + struct af_alg_control con = {};
> + int limit = COMP_BUFFER_SIZE;
> + int len;
> + int err = -EINVAL;
> +
> + if (msg->msg_controllen) {
> + err = af_alg_cmsg_send(msg, &con);
> + if (err)
> + return err;
> +
> + switch (con.op) {
> + case ALG_OP_COMPRESS:
> + ctx->comp = 1;
> + break;
> +
> + case ALG_OP_DECOMPRESS:
> + ctx->comp = 0;
> + break;
> +
> + default:
> + return -EINVAL;
> + }
> + }
> +
> + lock_sock(sk);
> +
> + /* One request at a time supported, data submitted for comp/decomp will
> + * be processed at subsequent recvmsg
> + */
> + if (ctx->used) {
> + err = -EAGAIN;
> + goto unlock;
> + }
> +
> + len = msg_data_left(msg);
> +
> + if (len > limit)
> + len = limit;
> +
> + len = af_alg_make_sg(&ctx->tsgl, &msg->msg_iter, len);
> +
> + if (len < 0) {
> + err = len;
> + goto unlock;
> + }
> +
> + ctx->slen = len;
> + ctx->used = 1;
> +
> +unlock:
> + release_sock(sk);
> +
> + return err ?: len;
> +}
> +
> +static int comp_recvmsg(struct socket *sock, struct msghdr *msg, size_t len,
> + int flags)
> +{
> + struct sock *sk = sock->sk;
> + struct alg_sock *ask = alg_sk(sk);
> + struct comp_ctx *ctx = ask->private;
> + int rlen = ctx->dlen;
> + int err;
> +
> + if (len > rlen)
> + len = rlen;
> +
> + lock_sock(sk);
> +
> + if (!ctx->used) {
> + err = -EAGAIN;
> + goto unlock;
> + }
> +
> + len = af_alg_make_sg(&ctx->rsgl, &msg->msg_iter, len);
> + if (len < 0) {
> + err = len;
> + goto unlock;
> + }
> +
> + acomp_request_set_params(ctx->acomp_req, ctx->tsgl.sg, ctx->rsgl.sg,
> + ctx->slen, len);
> +
> + /* Synchronous completion of comp/decomp requests */
> + err = af_alg_wait_for_completion(
> + ctx->comp ?
> + crypto_acomp_compress(ctx->acomp_req) :
> + crypto_acomp_decompress(ctx->acomp_req),
> + &ctx->completion);
> +
> + /* Add acomp req wrapper for dlen */
> + len = (ctx->acomp_req)->dlen;
> +
> + af_alg_free_sg(&ctx->tsgl);
> + af_alg_free_sg(&ctx->rsgl);
> +
> +unlock:
> + ctx->used = 0;
> + release_sock(sk);
> +
> + return err ?: len;
> +}
> +
> +static struct proto_ops algif_comp_ops = {
> + .family = PF_ALG,
> +
> + .connect = sock_no_connect,
> + .socketpair = sock_no_socketpair,
> + .getname = sock_no_getname,
> + .ioctl = sock_no_ioctl,
> + .listen = sock_no_listen,
> + .shutdown = sock_no_shutdown,
> + .getsockopt = sock_no_getsockopt,
> + .mmap = sock_no_mmap,
> + .bind = sock_no_bind,
> + .setsockopt = sock_no_setsockopt,
> + .poll = sock_no_poll,
> +
> + .release = af_alg_release,
> + .sendmsg = comp_sendmsg,
> + .recvmsg = comp_recvmsg,
> + .sendpage = sock_no_sendpage,
> + .accept = sock_no_accept,
> +};
> +
> +static void *comp_bind(const char *name, u32 type, u32 mask)
> +{
> + struct comp_tfm *tfm;
> + struct crypto_acomp *acomp;
> +
> + tfm = kzalloc(sizeof(*tfm), GFP_KERNEL);
> + if (!tfm)
> + return ERR_PTR(-ENOMEM);
> +
> + acomp = crypto_alloc_acomp(name, type, mask);
> + if (IS_ERR_OR_NULL(acomp)) {
> + kfree(tfm);
> + return ERR_PTR(-ENOMEM);
> + }
> + tfm->acomp = acomp;
> +
> + return tfm;
> +}
> +
> +static void comp_release(void *private)
> +{
> + struct comp_tfm *tfm = private;
> +
> + crypto_free_acomp(tfm->acomp);
> + kfree(tfm);
> +}
> +
> +static void comp_sock_destruct(struct sock *sk)
> +{
> + struct alg_sock *ask = alg_sk(sk);
> + struct comp_ctx *ctx = ask->private;
> +
> + acomp_request_free(ctx->acomp_req);
> + sock_kfree_s(sk, ctx, ctx->clen);
> + af_alg_release_parent(sk);
> +}
> +
> +static int comp_accept_parent(void *private, struct sock *sk)
> +{
> + struct comp_ctx *ctx;
> + struct alg_sock *ask = alg_sk(sk);
> + struct comp_tfm *tfm = private;
> + struct crypto_acomp *acomp = tfm->acomp;
> + unsigned int len = sizeof(*ctx);
> +
> + ctx = sock_kmalloc(sk, len, GFP_KERNEL);
> + if (!ctx)
> + return -ENOMEM;
> +
> + ctx->used = 0;
> + ctx->clen = len;
> + ctx->dlen = COMP_BUFFER_SIZE;
> + ctx->slen = COMP_BUFFER_SIZE;
> +
> + af_alg_init_completion(&ctx->completion);
> +
> + ctx->acomp_req = acomp_request_alloc(acomp);
> + if (!ctx->acomp_req) {
> + sock_kfree_s(sk, ctx, ctx->clen);
> + return -ENOMEM;
> + }
> +
> + acomp_request_set_callback(ctx->acomp_req, CRYPTO_TFM_REQ_MAY_BACKLOG,
> + af_alg_complete, &ctx->completion);
> +
> + ask->private = ctx;
> + sk->sk_destruct = comp_sock_destruct;
> +
> + return 0;
> +}
> +
> +static const struct af_alg_type algif_type_comp = {
> + .bind = comp_bind,
> + .release = comp_release,
> + .accept = comp_accept_parent,
> + .ops = &algif_comp_ops,
> + .name = "compression",
> + .owner = THIS_MODULE
> +};
> +
> +static int __init algif_comp_init(void)
> +{
> + return af_alg_register_type(&algif_type_comp);
> +}
> +
> +static void __exit algif_comp_exit(void)
> +{
> + int err = af_alg_unregister_type(&algif_type_comp);
> +
> + BUG_ON(err);
> +}
> +
> +module_init(algif_comp_init);
> +module_exit(algif_comp_exit);
> +MODULE_LICENSE("GPL");
> diff --git a/include/uapi/linux/if_alg.h b/include/uapi/linux/if_alg.h
> index f2acd2f..5cca9eb 100644
> --- a/include/uapi/linux/if_alg.h
> +++ b/include/uapi/linux/if_alg.h
> @@ -38,5 +38,7 @@ struct af_alg_iv {
> /* Operations */
> #define ALG_OP_DECRYPT 0
> #define ALG_OP_ENCRYPT 1
> +#define ALG_OP_DECOMPRESS 0
> +#define ALG_OP_COMPRESS 1
>
> #endif /* _LINUX_IF_ALG_H */
> --
> 2.7.4
>

Regards,
PrasannaKumar

2017-04-14 08:33:35

by Herbert Xu

[permalink] [raw]
Subject: Re: [RFC PATCH v1 0/1] *** crypto: AF_ALG: add compression support ***

On Fri, Apr 14, 2017 at 12:04:53AM +0530, Abed Kamaluddin wrote:
> Hi Herbert,
>
> This patch adds compression support to the AF_ALG interface exported by the
> kernel crypto API. By extending AF_ALG, all compression algorithms of types
> scomp and acomp, which the kernel crypto API allows access to, are now also
> accessible from userspace.
>
> The new compression interface has been tested with both kernel software
> deflate(scomp) and HW accelerated ThunderX deflate(scomp) using the zpipe
> example application provided by zlib.

I think we should convert ipcomp over to the new interface first
in order to make sure that we don't need to change the interface
which would be hard to do once we export it to user-space.

Thanks,
--
Email: Herbert Xu <[email protected]>
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt

2017-04-17 01:31:23

by Eric Biggers

[permalink] [raw]
Subject: Re: [RFC PATCH v1 1/1] crypto: algif_compression - User-space interface for compression

On Fri, Apr 14, 2017 at 12:04:54AM +0530, Abed Kamaluddin wrote:
> crypto: algif_compression - User-space interface for compression
>
> This patch adds af_alg plugin for compression algorithms of type scomp/acomp
> registered to the kernel crypto layer.
>
> The user needs to set operation (compression/decompression) as a control
> message to sendmsg, identical to selecting the cipher operation type in case of
> ciphers. Once a sendmsg call occurs, no further writes can be made to the
> socket until all previous data has been processed and read. Therefore the
> interface only supports one request at a time.
>
> The interface is completely synchronous; all operations are carried out in
> recvmsg and will complete prior to the system call returning.
>
> The sendmsg and recvmsg interface supports directly reading/writing to
> user-space without additional copying, i.e., the kernel crypto interface will
> receive the user-space address as its input/output SG list. The scomp interface
> or crypto drivers may copy the data as required.

Fun, so unprivileged users will be able to feed arbitrary data into the kernel's
zlib, LZ4, LZO, etc. compressors and decompressors. Including zlib which is 12
years out of date from the upstream version. Moreover, if anyone decides to
optimize these to directly support the new "acomp" (page-based) API, e.g. for
zlib by using its streaming API, then the algorithms will be passed the actual
userspace memory which can be modified by userspace concurrently. When people
write compression algorithms usually it's assumed that's not possible. At the
very least, it's unlikely to have been covered by fuzz testing that's been done
on the original userspace versions of these algorithms. They might be safe by
chance, but I don't know.

Why does userspace need to be able to call the in-kernel zlib, LZ4, LZO, etc.
anyway? At the very least, how about limiting the new attack surface by only
exposing algorithms provided by hardware drivers?

Eric

2017-04-18 10:12:22

by Stephan Müller

[permalink] [raw]
Subject: Re: [RFC PATCH v1 1/1] crypto: algif_compression - User-space interface for compression

Am Donnerstag, 13. April 2017, 20:34:54 CEST schrieb Abed Kamaluddin:

Hi Abed,

> crypto: algif_compression - User-space interface for compression
>
> This patch adds af_alg plugin for compression algorithms of type scomp/acomp
> registered to the kernel crypto layer.
>
> The user needs to set operation (compression/decompression) as a control
> message to sendmsg, identical to selecting the cipher operation type in case
> of ciphers. Once a sendmsg call occurs, no further writes can be made to
> the socket until all previous data has been processed and read. Therefore
> the interface only supports one request at a time.
>
> The interface is completely synchronous; all operations are carried out in
> recvmsg and will complete prior to the system call returning.
>
> The sendmsg and recvmsg interface supports directly reading/writing to
> user-space without additional copying, i.e., the kernel crypto interface
> will receive the user-space address as its input/output SG list. The scomp
> interface or crypto drivers may copy the data as required.
>
> Signed-off-by: Abed Kamaluddin <[email protected]>
> Signed-off-by: Mahipal Challa <[email protected]>
>
> ---
> crypto/Kconfig | 11 ++
> crypto/Makefile | 1 +
> crypto/algif_compression.c | 272
> ++++++++++++++++++++++++++++++++++++++++++++ include/uapi/linux/if_alg.h |
> 2 +
> 4 files changed, 286 insertions(+)
>
> diff --git a/crypto/Kconfig b/crypto/Kconfig
> index f37e9cc..13b03ba 100644
> --- a/crypto/Kconfig
> +++ b/crypto/Kconfig
> @@ -1741,6 +1741,17 @@ config CRYPTO_USER_API_AEAD
> This option enables the user-spaces interface for AEAD
> cipher algorithms.
>
> +config CRYPTO_USER_API_COMPRESSION
> + tristate "User-space interface for compression algorithms"
> + depends on NET
> + select CRYPTO_ACOMP
> + select CRYPTO_USER_API
> + help
> + This option enables the user-space interface for compression
> + algorithms. Enable this option for access to compression algorithms
> + of type scomp/acomp exported by the kernel crypto layer through
> + AF_ALG interface.
> +
> config CRYPTO_HASH_INFO
> bool
>
> diff --git a/crypto/Makefile b/crypto/Makefile
> index 8a44057..1469e06 100644
> --- a/crypto/Makefile
> +++ b/crypto/Makefile
> @@ -134,6 +134,7 @@ obj-$(CONFIG_CRYPTO_TEST) += tcrypt.o
> obj-$(CONFIG_CRYPTO_GHASH) += ghash-generic.o
> obj-$(CONFIG_CRYPTO_USER_API) += af_alg.o
> obj-$(CONFIG_CRYPTO_USER_API_HASH) += algif_hash.o
> +obj-$(CONFIG_CRYPTO_USER_API_COMPRESSION) += algif_compression.o
> obj-$(CONFIG_CRYPTO_USER_API_SKCIPHER) += algif_skcipher.o
> obj-$(CONFIG_CRYPTO_USER_API_RNG) += algif_rng.o
> obj-$(CONFIG_CRYPTO_USER_API_AEAD) += algif_aead.o
> diff --git a/crypto/algif_compression.c b/crypto/algif_compression.c
> new file mode 100644
> index 0000000..0ba6d1e
> --- /dev/null
> +++ b/crypto/algif_compression.c
> @@ -0,0 +1,272 @@
> +/*
> + * algif_compression: User-space interface for COMPRESSION algorithms
> + *
> + * This file provides user-space API support for compression algorithms
> + * registered through the kernel crypto layer.
> + *
> + * Copyright (C) 2017 Cavium, Inc.
> + *
> + * Original Authors: Abed Kamaluddin <[email protected]>
> + *
> + * This program is free software; you can redistribute it and/or modify it
> + * under the terms of the GNU General Public License as published by the
> Free + * Software Foundation; either version 2 of the License, or (at your
> option) + * any later version.
> + */
> +
> +#include <crypto/acompress.h>
> +#include <crypto/if_alg.h>
> +#include <linux/crypto.h>
> +#include <linux/init.h>
> +#include <linux/kernel.h>
> +#include <linux/mm.h>
> +#include <linux/module.h>
> +#include <linux/net.h>
> +#include <net/sock.h>
> +#include <linux/scatterlist.h>
> +
> +/* scomp scratch is currently 128KB */
> +#define COMP_BUFFER_SIZE 65535
> +
> +struct comp_ctx {
> + struct af_alg_sgl tsgl;
> + struct af_alg_sgl rsgl;
> + struct af_alg_completion completion;
> + unsigned int clen;
> + unsigned int slen;
> + unsigned int dlen;
> + bool comp;
> + bool used;
> + struct acomp_req *acomp_req;
> +};
> +
> +struct comp_tfm {
> + struct crypto_acomp *acomp;
> +};
> +
> +static int comp_sendmsg(struct socket *sock, struct msghdr *msg,
> + size_t ignored)
> +{
> + struct sock *sk = sock->sk;
> + struct alg_sock *ask = alg_sk(sk);
> + struct comp_ctx *ctx = ask->private;
> + struct af_alg_control con = {};
> + int limit = COMP_BUFFER_SIZE;
> + int len;
> + int err = -EINVAL;
> +
> + if (msg->msg_controllen) {
> + err = af_alg_cmsg_send(msg, &con);
> + if (err)
> + return err;
> +
> + switch (con.op) {
> + case ALG_OP_COMPRESS:
> + ctx->comp = 1;
> + break;
> +
> + case ALG_OP_DECOMPRESS:
> + ctx->comp = 0;

You set the ctx without locking. I guess you want to move the ctx->comp
setting below the lock.

> + break;
> +
> + default:
> + return -EINVAL;
> + }
> + }
> +
> + lock_sock(sk);
> +
> + /* One request at a time supported, data submitted for comp/decomp will
> + * be processed at subsequent recvmsg

I recommend to lift that limitation.

May I propose that you look into the patches for skcipher and aead regarding
memory handling updates that are currently discussed. There you will find the
sendmsg code with two parts:

1. checking of the input data of cmsg and setting the ctx respectively.

2. the big while loop for getting all user space data

I guess you have seen that I would like to consolidate the algif
implementations once the memory handling patch is in and agreed on. My plan
is: Bullet 1 will be private to the algif implementation, so leave your code.
Bullet 2 will be moved into a common service function. Thus, may I propose
that you simply copy the entire while loop with the same TX data structures
into your sendmsg code. This way you do not have the mentioned limit.

Also, simply copy the sendpage code from the patch set to support splice/
vmsplice.



> + */
> + if (ctx->used) {
> + err = -EAGAIN;
> + goto unlock;
> + }
> +
> + len = msg_data_left(msg);
> +
> + if (len > limit)
> + len = limit;
> +
> + len = af_alg_make_sg(&ctx->tsgl, &msg->msg_iter, len);
> +
> + if (len < 0) {
> + err = len;
> + goto unlock;
> + }
> +
> + ctx->slen = len;
> + ctx->used = 1;
> +
> +unlock:
> + release_sock(sk);
> +
> + return err ?: len;
> +}
> +
> +static int comp_recvmsg(struct socket *sock, struct msghdr *msg, size_t
> len, + int flags)
> +{
> + struct sock *sk = sock->sk;
> + struct alg_sock *ask = alg_sk(sk);
> + struct comp_ctx *ctx = ask->private;
> + int rlen = ctx->dlen;
> + int err;
> +
> + if (len > rlen)
> + len = rlen;
> +
> + lock_sock(sk);
> +
> + if (!ctx->used) {
> + err = -EAGAIN;
> + goto unlock;
> + }
> +
> + len = af_alg_make_sg(&ctx->rsgl, &msg->msg_iter, len);
> + if (len < 0) {
> + err = len;
> + goto unlock;
> + }

As mentioned above, I recommend to change this code here too. Please copy the
while loop from the skcipher_recvmsg and the associated data structures. Also,
copy the areq allocation and handling code to support synchronous and async
operations.

Note, the code below the while loop in the recvmsg is private to your
implementation.
> +
> + acomp_request_set_params(ctx->acomp_req, ctx->tsgl.sg, ctx->rsgl.sg,
> + ctx->slen, len);
> +
> + /* Synchronous completion of comp/decomp requests */
> + err = af_alg_wait_for_completion(
> + ctx->comp ?
> + crypto_acomp_compress(ctx->acomp_req) :
> + crypto_acomp_decompress(ctx->acomp_req),
> + &ctx->completion);
> +
> + /* Add acomp req wrapper for dlen */
> + len = (ctx->acomp_req)->dlen;
> +
> + af_alg_free_sg(&ctx->tsgl);
> + af_alg_free_sg(&ctx->rsgl);
> +
> +unlock:
> + ctx->used = 0;
> + release_sock(sk);
> +
> + return err ?: len;
> +}
> +
> +static struct proto_ops algif_comp_ops = {
> + .family = PF_ALG,
> +
> + .connect = sock_no_connect,
> + .socketpair = sock_no_socketpair,
> + .getname = sock_no_getname,
> + .ioctl = sock_no_ioctl,
> + .listen = sock_no_listen,
> + .shutdown = sock_no_shutdown,
> + .getsockopt = sock_no_getsockopt,
> + .mmap = sock_no_mmap,
> + .bind = sock_no_bind,
> + .setsockopt = sock_no_setsockopt,
> + .poll = sock_no_poll,
> +
> + .release = af_alg_release,
> + .sendmsg = comp_sendmsg,
> + .recvmsg = comp_recvmsg,
> + .sendpage = sock_no_sendpage,
> + .accept = sock_no_accept,
> +};
> +
> +static void *comp_bind(const char *name, u32 type, u32 mask)
> +{
> + struct comp_tfm *tfm;
> + struct crypto_acomp *acomp;
> +
> + tfm = kzalloc(sizeof(*tfm), GFP_KERNEL);
> + if (!tfm)
> + return ERR_PTR(-ENOMEM);
> +
> + acomp = crypto_alloc_acomp(name, type, mask);
> + if (IS_ERR_OR_NULL(acomp)) {
> + kfree(tfm);
> + return ERR_PTR(-ENOMEM);
> + }
> + tfm->acomp = acomp;
> +
> + return tfm;
> +}
> +
> +static void comp_release(void *private)
> +{
> + struct comp_tfm *tfm = private;
> +
> + crypto_free_acomp(tfm->acomp);
> + kfree(tfm);
> +}
> +
> +static void comp_sock_destruct(struct sock *sk)
> +{
> + struct alg_sock *ask = alg_sk(sk);
> + struct comp_ctx *ctx = ask->private;
> +
> + acomp_request_free(ctx->acomp_req);
> + sock_kfree_s(sk, ctx, ctx->clen);
> + af_alg_release_parent(sk);
> +}
> +
> +static int comp_accept_parent(void *private, struct sock *sk)
> +{
> + struct comp_ctx *ctx;
> + struct alg_sock *ask = alg_sk(sk);
> + struct comp_tfm *tfm = private;
> + struct crypto_acomp *acomp = tfm->acomp;
> + unsigned int len = sizeof(*ctx);
> +
> + ctx = sock_kmalloc(sk, len, GFP_KERNEL);
> + if (!ctx)
> + return -ENOMEM;
> +
> + ctx->used = 0;
> + ctx->clen = len;
> + ctx->dlen = COMP_BUFFER_SIZE;
> + ctx->slen = COMP_BUFFER_SIZE;
> +
> + af_alg_init_completion(&ctx->completion);
> +
> + ctx->acomp_req = acomp_request_alloc(acomp);
> + if (!ctx->acomp_req) {
> + sock_kfree_s(sk, ctx, ctx->clen);
> + return -ENOMEM;
> + }
> +
> + acomp_request_set_callback(ctx->acomp_req, CRYPTO_TFM_REQ_MAY_BACKLOG,
> + af_alg_complete, &ctx->completion);
> +
> + ask->private = ctx;
> + sk->sk_destruct = comp_sock_destruct;
> +
> + return 0;
> +}
> +
> +static const struct af_alg_type algif_type_comp = {
> + .bind = comp_bind,
> + .release = comp_release,
> + .accept = comp_accept_parent,
> + .ops = &algif_comp_ops,
> + .name = "compression",
> + .owner = THIS_MODULE
> +};
> +
> +static int __init algif_comp_init(void)
> +{
> + return af_alg_register_type(&algif_type_comp);
> +}
> +
> +static void __exit algif_comp_exit(void)
> +{
> + int err = af_alg_unregister_type(&algif_type_comp);
> +
> + BUG_ON(err);
> +}
> +
> +module_init(algif_comp_init);
> +module_exit(algif_comp_exit);
> +MODULE_LICENSE("GPL");
> diff --git a/include/uapi/linux/if_alg.h b/include/uapi/linux/if_alg.h
> index f2acd2f..5cca9eb 100644
> --- a/include/uapi/linux/if_alg.h
> +++ b/include/uapi/linux/if_alg.h
> @@ -38,5 +38,7 @@ struct af_alg_iv {
> /* Operations */
> #define ALG_OP_DECRYPT 0
> #define ALG_OP_ENCRYPT 1
> +#define ALG_OP_DECOMPRESS 0
> +#define ALG_OP_COMPRESS 1
>
> #endif /* _LINUX_IF_ALG_H */


Ciao
Stephan

2017-04-20 07:10:21

by abed mohammad kamaluddin

[permalink] [raw]
Subject: Re: [RFC PATCH v1 0/1] *** crypto: AF_ALG: add compression support ***

Hi Herbert,

> I think we should convert ipcomp over to the new interface first
> in order to make sure that we don't need to change the interface
> which would be hard to do once we export it to user-space.

Would it be acceptable if we export an algif interface using alg_type_compress,
which is being used by ipcomp currently? We would like to use our zip
device from
userspace through this interface.

Thanks
Abed (Cavium)


On Fri, Apr 14, 2017 at 2:02 PM, Herbert Xu <[email protected]> wrote:
> On Fri, Apr 14, 2017 at 12:04:53AM +0530, Abed Kamaluddin wrote:
>> Hi Herbert,
>>
>> This patch adds compression support to the AF_ALG interface exported by the
>> kernel crypto API. By extending AF_ALG, all compression algorithms of types
>> scomp and acomp, which the kernel crypto API allows access to, are now also
>> accessible from userspace.
>>
>> The new compression interface has been tested with both kernel software
>> deflate(scomp) and HW accelerated ThunderX deflate(scomp) using the zpipe
>> example application provided by zlib.
>
> I think we should convert ipcomp over to the new interface first
> in order to make sure that we don't need to change the interface
> which would be hard to do once we export it to user-space.
>
> Thanks,
> --
> Email: Herbert Xu <[email protected]>
> Home Page: http://gondor.apana.org.au/~herbert/
> PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt

2017-04-20 08:01:43

by Herbert Xu

[permalink] [raw]
Subject: Re: [RFC PATCH v1 0/1] *** crypto: AF_ALG: add compression support ***

On Thu, Apr 20, 2017 at 12:39:58PM +0530, abed mohammad kamaluddin wrote:
> Hi Herbert,
>
> > I think we should convert ipcomp over to the new interface first
> > in order to make sure that we don't need to change the interface
> > which would be hard to do once we export it to user-space.
>
> Would it be acceptable if we export an algif interface using alg_type_compress,
> which is being used by ipcomp currently? We would like to use our zip
> device from
> userspace through this interface.

No we're not going to export an obsolete interface.

Cheers,
--
Email: Herbert Xu <[email protected]>
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt

2017-04-20 14:40:14

by abed mohammad kamaluddin

[permalink] [raw]
Subject: Re: [RFC PATCH v1 0/1] *** crypto: AF_ALG: add compression support ***

Hi Herbert,

>> > I think we should convert ipcomp over to the new interface first
>> > in order to make sure that we don't need to change the interface
>> > which would be hard to do once we export it to user-space.
>>
>> Would it be acceptable if we export an algif interface using alg_type_compress,
>
> No we're not going to export an obsolete interface.
>

Are there any deficiencies expected in the acomp interface for use
with ipcomp? One issue mentioned earlier on the lists was that the
interface might
require tweaks for piecemeal decompression. Has this been taken up?

We identified few issues when using acomp with user-space zlib for file
compression. If the the interface is tweaked keeping those use-cases
in mind apart from the existing kernel apps (zswap/ipcomp/zram), the hardware
algorithms can be utilized using the algif framework.

Thanks
Abed



On Thu, Apr 20, 2017 at 1:30 PM, Herbert Xu <[email protected]> wrote:
> On Thu, Apr 20, 2017 at 12:39:58PM +0530, abed mohammad kamaluddin wrote:
>> Hi Herbert,
>>
>> > I think we should convert ipcomp over to the new interface first
>> > in order to make sure that we don't need to change the interface
>> > which would be hard to do once we export it to user-space.
>>
>> Would it be acceptable if we export an algif interface using alg_type_compress,
>> which is being used by ipcomp currently? We would like to use our zip
>> device from
>> userspace through this interface.
>
> No we're not going to export an obsolete interface.
>
> Cheers,
> --
> Email: Herbert Xu <[email protected]>
> Home Page: http://gondor.apana.org.au/~herbert/
> PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt

2017-04-21 17:06:50

by abed mohammad kamaluddin

[permalink] [raw]
Subject: Re: [RFC PATCH v1 1/1] crypto: algif_compression - User-space interface for compression

On Fri, Apr 21, 2017 at 9:20 PM, Stephan Müller <[email protected]> wrote:
> Am Freitag, 21. April 2017, 17:42:10 CEST schrieb abed mohammad kamaluddin:
>
> Just diff the just RFCed algif_kpp with the proposed patch set for
> algif_skcipher and algif_aead. There you will see that 80% of all code is
> identical (if you disregard the different namespace). And that is the code I
> am referring to.
>
> Ciao
> Stephan

Thanks, I will use the pointer. Considering all the identical code,
the proposal to consolidate would definitely help!

Thanks,
Abed

2017-04-21 19:28:23

by Stephan Müller

[permalink] [raw]
Subject: Re: [RFC PATCH v1 1/1] crypto: algif_compression - User-space interface for compression

Am Freitag, 21. April 2017, 17:42:10 CEST schrieb abed mohammad kamaluddin:

Hi abed,

> Hi Stephan,
>
> On Tue, Apr 18, 2017 at 3:42 PM, Stephan M?ller <[email protected]> wrote:
> > Am Donnerstag, 13. April 2017, 20:34:54 CEST schrieb Abed Kamaluddin:
> >
> > May I propose that you look into the patches for skcipher and aead
> > regarding memory handling updates that are currently discussed. There you
> > will find the sendmsg code with two parts:
> >
> > 1. checking of the input data of cmsg and setting the ctx respectively.
> >
> > 2. the big while loop for getting all user space data
> >
> > I guess you have seen that I would like to consolidate the algif
> > implementations once the memory handling patch is in and agreed on. My
> > plan
> > is: Bullet 1 will be private to the algif implementation, so leave your
> > code. Bullet 2 will be moved into a common service function. Thus, may I
> > propose that you simply copy the entire while loop with the same TX data
> > structures into your sendmsg code. This way you do not have the mentioned
> > limit.
> >
> > Also, simply copy the sendpage code from the patch set to support splice/
> > vmsplice.
>
> Thanks for the suggestions and helpful pointers, I will rework the
> patch and incorporate these, hoping that the compression interface
> will be exported. These changes would also remain unaffected by any
> changes to the acomp interface.

Just diff the just RFCed algif_kpp with the proposed patch set for
algif_skcipher and algif_aead. There you will see that 80% of all code is
identical (if you disregard the different namespace). And that is the code I
am referring to.
>
> Thanks
> Abed (Cavium)
> Regards,



Ciao
Stephan

2017-04-21 19:42:25

by abed mohammad kamaluddin

[permalink] [raw]
Subject: Re: [RFC PATCH v1 1/1] crypto: algif_compression - User-space interface for compression

Hi Stephan,

On Tue, Apr 18, 2017 at 3:42 PM, Stephan Müller <[email protected]> wrote:
> Am Donnerstag, 13. April 2017, 20:34:54 CEST schrieb Abed Kamaluddin:
>
> May I propose that you look into the patches for skcipher and aead regarding
> memory handling updates that are currently discussed. There you will find the
> sendmsg code with two parts:
>
> 1. checking of the input data of cmsg and setting the ctx respectively.
>
> 2. the big while loop for getting all user space data
>
> I guess you have seen that I would like to consolidate the algif
> implementations once the memory handling patch is in and agreed on. My plan
> is: Bullet 1 will be private to the algif implementation, so leave your code.
> Bullet 2 will be moved into a common service function. Thus, may I propose
> that you simply copy the entire while loop with the same TX data structures
> into your sendmsg code. This way you do not have the mentioned limit.
>
> Also, simply copy the sendpage code from the patch set to support splice/
> vmsplice.
>

Thanks for the suggestions and helpful pointers, I will rework the
patch and incorporate these, hoping that the compression interface
will be exported. These changes would also remain unaffected by any
changes to the acomp interface.

Thanks
Abed (Cavium)
Regards,