Skip to contentSkip to conversation

crypto: relocate ALG_MAX_PAGES to uapi

PATCH In review Stephan Mueller 2 participants 2 messages Dec 25, 2015 – Jan 8, 2016

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 crypto: relocate ALG_MAX_PAGES to uapi

The define of ALG_MAX_PAGES is relevant for user space as this macro defines the maximum number of pages to be processed in one go by vmsplice/splice. If user space does not obey that limit, the calling thread will hang until a recvmsg is called (by another thread).

As user space should have the ability to prevent such blocks, it needs to know about the limit. Therefore, the define is moved to the uapi header file.

---
 include/crypto/if_alg.h     | 2 --
 include/uapi/linux/if_alg.h | 3 +++
 2 files changed, 3 insertions(+), 2 deletions(-)
include/crypto/if_alg.h +0 -2
index 018afb2..fb00376 100644
@@ -20,8 +20,6 @@
 #include <linux/types.h>
 #include <net/sock.h>
 
-#define ALG_MAX_PAGES			16
-
 struct crypto_async_request;
 
 struct alg_sock {
include/uapi/linux/if_alg.h +3 -0
index f2acd2f..96af72f 100644
@@ -39,4 +39,7 @@ struct af_alg_iv {
 #define ALG_OP_DECRYPT			0
 #define ALG_OP_ENCRYPT			1
 
+/* Maximum number of pages to be processed */
+#define ALG_MAX_PAGES			16
+
 #endif	/* _LINUX_IF_ALG_H */
Signature · 1 line
2.5.0
maintainer
#1 lore raw
Quoted 10 lines · Stephan Mueller

The define of ALG_MAX_PAGES is relevant for user space as this macro defines the maximum number of pages to be processed in one go by vmsplice/splice. If user space does not obey that limit, the calling thread will hang until a recvmsg is called (by another thread).

As user space should have the ability to prevent such blocks, it needs to know about the limit. Therefore, the define is moved to the uapi header file.

I don't like exporting details like this. User-space should not be relying on voodoo like this to avoid hanging.

Please show me the program that actually hangs so we can figure out what if anything needs to be done to address this.

Thanks,

Signature · 3 lines
Email: Herbert Xu <[email protected]>
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt