Start moving common cifs/ksmbd definitions into a common directory
Subsystems (2)
cover Start moving common cifs/ksmbd definitions into a common directory
Steve, Namjae,
Here is a start of work to share common definitions between the cifs client and the server. The patches build ontop of Namjaes patch to rework the smb2_hdr structure that he recently sent to the list.
It creates a new shared smb2pdu.h file and starts moving definitions over. The two copies of smb2pdu.h, in cifs/ and ksmbd/ have diverged a bit so some things are being renamed in these patches. NegotiateProtocol is in two separate patches since for this funciton the changes are a little more than just renames, for example I change several arrays at the tail of structures from [number] to simply []
so that needs careful review.
Two patches are for cifs and cifs_common and two patches are for ksmbd. The ksmbd patches depend on the cifs patches so the cifs patches have to go in first.
PATCH 1/4 cifs: Create a new shared file holding smb2 pdu definitions
This file will contain all the definitions we need for SMB2 packets and will follow the naming convention of MS-SMB2.PDF as closely as possible to make it easier to cross-reference beween the definitions and the standard.
The content of this file will mostly consist of migration of existing definitions in the cifs/smb2.pdu.h and ksmbd/smb2pdu.h files with some additional tweaks as the the two files have diverged.
This patch introduces the new cifs_common/smb2pdu.h file
and migrates the SMB2 header as well as TREE_CONNECT and TREE_DISCONNECT to the shared file.
--- fs/cifs/cifsfs.c | 1 - fs/cifs/cifsglob.h | 3 +- fs/cifs/connect.c | 4 +- fs/cifs/misc.c | 2 +- fs/cifs/smb2maperror.c | 6 +- fs/cifs/smb2misc.c | 41 +++-- fs/cifs/smb2ops.c | 62 +++---- fs/cifs/smb2pdu.c | 101 ++++++----- fs/cifs/smb2pdu.h | 373 ++++----------------------------------- fs/cifs/smb2proto.h | 2 +- fs/cifs/smb2transport.c | 29 ++- fs/cifs_common/smb2pdu.h | 318 +++++++++++++++++++++++++++++++++ 12 files changed, 477 insertions(+), 465 deletions(-) create mode 100644 fs/cifs_common/smb2pdu.h
fs/cifs/cifsfs.c +0 -1
@@ -39,7 +39,6 @@#include <linux/key-type.h> #include "cifs_spnego.h" #include "fscache.h" -#include "smb2pdu.h" #ifdef CONFIG_CIFS_DFS_UPCALL #include "dfs_cache.h" #endif
fs/cifs/cifsglob.h +2 -1
@@ -21,6 +21,7 @@#include <crypto/internal/hash.h> #include <linux/scatterlist.h> #include <uapi/linux/cifs/cifs_mount.h> +#include "../cifs_common/smb2pdu.h" #include "smb2pdu.h" #define CIFS_MAGIC_NUMBER 0xFF534D42/* the first four bytes of SMB PDUs */
@@ -777,7 +778,7 @@ revert_current_mid(struct TCP_Server_Info *server, const unsigned int val)static inline void revert_current_mid_from_hdr (struct TCP_Server_Info *server, -const struct smb2_sync_hdr *shdr) +const struct smb2_hdr *shdr) {unsigned int num =le16_to_cpu (shdr->CreditCharge);
fs/cifs/connect.c +2 -2
@@ -678,7 +678,7 @@ dequeue_mid(struct mid_q_entry *mid, bool malformed)static unsigned int smb2_get_credits_from_hdr (char *buffer,struct TCP_Server_Info *server) { -struct smb2_sync_hdr *shdr = (struct smb2_sync_hdr *)buffer; +struct smb2_hdr *shdr = (struct smb2_hdr *)buffer;/* * SMB1 does not use credits.
@@ -879,7 +879,7 @@ cifs_handle_standard(struct TCP_Server_Info *server, struct mid_q_entry *mid)static void smb2_add_credits_from_hdr (char *buffer,struct TCP_Server_Info *server) { -struct smb2_sync_hdr *shdr = (struct smb2_sync_hdr *)buffer; +struct smb2_hdr *shdr = (struct smb2_hdr *)buffer;int scredits, in_flight;/*
fs/cifs/misc.c +1 -1
@@ -153,7 +153,7 @@ cifs_buf_get(void)* SMB2 header is bigger than CIFS one - no problems to clean some * more bytes for CIFS. */ -size_t buf_size =sizeof (struct smb2_sync_hdr ); +size_t buf_size =sizeof (struct smb2_hdr );/* * We could use negotiated size instead of max_msgsize -
fs/cifs/smb2maperror.c +3 -3
@@ -2439,13 +2439,13 @@ smb2_print_status(__le32 status)int map_smb2_to_linux_error (char *buf,bool log_err) { -struct smb2_sync_hdr *shdr = (struct smb2_sync_hdr *)buf; +struct smb2_hdr *shdr = (struct smb2_hdr *)buf;unsigned int i;int rc = -EIO ;__le32 smb2err = shdr->Status;if (smb2err ==0 ) { -trace_smb3_cmd_done (shdr->TreeId, shdr->SessionId, +trace_smb3_cmd_done (shdr->Id.SyncId.TreeId, shdr->SessionId,le16_to_cpu (shdr->Command),le64_to_cpu (shdr->MessageId));return 0 ; }
@@ -2470,7 +2470,7 @@ map_smb2_to_linux_error(char *buf, bool log_err)cifs_dbg (FYI ,"Mapping SMB2 status code 0x%08x to POSIX err %d\n" ,__le32_to_cpu (smb2err), rc); -trace_smb3_cmd_err (shdr->TreeId, shdr->SessionId, +trace_smb3_cmd_err (shdr->Id.SyncId.TreeId, shdr->SessionId,le16_to_cpu (shdr->Command),le64_to_cpu (shdr->MessageId),le32_to_cpu (smb2err), rc);return rc;
fs/cifs/smb2misc.c +20 -21
111 lines not on this page · raw message
fs/cifs/smb2ops.c +31 -31
232 lines not on this page · raw message
fs/cifs/smb2pdu.c +50 -51
375 lines not on this page · raw message
fs/cifs/smb2pdu.h +35 -338
589 lines not on this page · raw message
fs/cifs/smb2proto.h +1 -1
@@ -26,7 +26,7 @@ extern int smb2_check_message(char *buf, unsigned int length, struct TCP_Server_Info *server);extern unsigned int smb2_calc_size (void *buf,struct TCP_Server_Info *server);extern char *smb2_get_data_area_len (int *off,int *len, -struct smb2_sync_hdr *shdr); +struct smb2_hdr *shdr);extern __le16 *cifs_convert_path_to_utf16 (const char *from,struct cifs_sb_info *cifs_sb);
fs/cifs/smb2transport.c +14 -15
@@ -20,7 +20,6 @@#include <linux/mempool.h> #include <linux/highmem.h> #include <crypto/aead.h> -#include "smb2pdu.h" #include "cifsglob.h" #include "cifsproto.h" #include "smb2proto.h"
@@ -214,7 +213,7 @@ smb2_calc_signature(struct smb_rqst *rqst, struct TCP_Server_Info *server,unsigned char smb2_signature[SMB2_HMACSHA256_SIZE ];unsigned char *sigptr = smb2_signature;struct kvec *iov = rqst->rq_iov; -struct smb2_sync_hdr *shdr = (struct smb2_sync_hdr *)iov[0 ].iov_base; +struct smb2_hdr *shdr = (struct smb2_hdr *)iov[0 ].iov_base;struct cifs_ses *ses;struct shash_desc *shash;struct crypto_shash *hash;
@@ -535,7 +534,7 @@ smb3_calc_signature(struct smb_rqst *rqst, struct TCP_Server_Info *server,unsigned char smb3_signature[SMB2_CMACAES_SIZE ];unsigned char *sigptr = smb3_signature;struct kvec *iov = rqst->rq_iov; -struct smb2_sync_hdr *shdr = (struct smb2_sync_hdr *)iov[0 ].iov_base; +struct smb2_hdr *shdr = (struct smb2_hdr *)iov[0 ].iov_base;struct shash_desc *shash;struct crypto_shash *hash;struct sdesc *sdesc =NULL ;
@@ -612,12 +611,12 @@ static int smb2_sign_rqst(struct smb_rqst *rqst, struct TCP_Server_Info *server) { int rc = 0; -struct smb2_sync_hdr *shdr; +struct smb2_hdr *shdr;struct smb2_sess_setup_req *ssr;bool is_binding;bool is_signed; - shdr = (struct smb2_sync_hdr *)rqst->rq_iov[0 ].iov_base; + shdr = (struct smb2_hdr *)rqst->rq_iov[0 ].iov_base; ssr = (struct smb2_sess_setup_req *)shdr; is_binding = shdr->Command == SMB2_SESSION_SETUP &&
@@ -643,8 +642,8 @@ smb2_verify_signature(struct smb_rqst *rqst, struct TCP_Server_Info *server) {unsigned int rc;char server_response_sig[SMB2_SIGNATURE_SIZE ]; -struct smb2_sync_hdr *shdr = - (struct smb2_sync_hdr *)rqst->rq_iov[0 ].iov_base; +struct smb2_hdr *shdr = + (struct smb2_hdr *)rqst->rq_iov[0 ].iov_base; if ((shdr->Command == SMB2_NEGOTIATE) || (shdr->Command == SMB2_SESSION_SETUP) ||
@@ -690,7 +689,7 @@ smb2_verify_signature(struct smb_rqst *rqst, struct TCP_Server_Info *server)*/ static inline void smb2_seq_num_into_buf (struct TCP_Server_Info *server, -struct smb2_sync_hdr *shdr) +struct smb2_hdr *shdr) {unsigned int i, num =le16_to_cpu (shdr->CreditCharge);
@@ -701,7 +700,7 @@ smb2_seq_num_into_buf(struct TCP_Server_Info *server, }static struct mid_q_entry * -smb2_mid_entry_alloc (const struct smb2_sync_hdr *shdr, +smb2_mid_entry_alloc (const struct smb2_hdr *shdr,struct TCP_Server_Info *server) {struct mid_q_entry *temp;
@@ -733,14 +732,14 @@ smb2_mid_entry_alloc(const struct smb2_sync_hdr *shdr,atomic_inc (&midCount); temp->mid_state =MID_REQUEST_ALLOCATED ; -trace_smb3_cmd_enter (shdr->TreeId, shdr->SessionId, +trace_smb3_cmd_enter (shdr->Id.SyncId.TreeId, shdr->SessionId,le16_to_cpu (shdr->Command), temp->mid);return temp; }static int smb2_get_mid_entry (struct cifs_ses *ses,struct TCP_Server_Info *server, -struct smb2_sync_hdr *shdr,struct mid_q_entry **mid) +struct smb2_hdr *shdr,struct mid_q_entry **mid) {if (server->tcpStatus == CifsExiting)return -ENOENT ;
@@ -808,8 +807,8 @@ smb2_setup_request(struct cifs_ses *ses, struct TCP_Server_Info *server, struct smb_rqst *rqst) {int rc; -struct smb2_sync_hdr *shdr = - (struct smb2_sync_hdr *)rqst->rq_iov[0 ].iov_base; +struct smb2_hdr *shdr = + (struct smb2_hdr *)rqst->rq_iov[0 ].iov_base;struct mid_q_entry *mid;smb2_seq_num_into_buf (server, shdr);
@@ -834,8 +833,8 @@ struct mid_q_entry * smb2_setup_async_request(struct TCP_Server_Info *server, struct smb_rqst *rqst) { int rc; -struct smb2_sync_hdr *shdr = - (struct smb2_sync_hdr *)rqst->rq_iov[0 ].iov_base; +struct smb2_hdr *shdr = + (struct smb2_hdr *)rqst->rq_iov[0 ].iov_base;struct mid_q_entry *mid; if (server->tcpStatus == CifsNeedNegotiate &&
fs/cifs_common/smb2pdu.h new file +318 -0
318 lines not on this page · raw message
Signature · 1 line
2.30.2
PATCH 2/4 ksmbd: switch to use shared definitions where available
In reply to Ronnie Sahlberg--- fs/ksmbd/smb2misc.c | 1 - fs/ksmbd/smb2ops.c | 1 - fs/ksmbd/smb2pdu.c | 3 +- fs/ksmbd/smb2pdu.h | 176 ------------------------------------------ fs/ksmbd/smb_common.h | 1 + 5 files changed, 2 insertions(+), 180 deletions(-)
fs/ksmbd/smb2misc.c +0 -1
@@ -6,7 +6,6 @@#include "glob.h" #include "nterr.h" -#include "smb2pdu.h" #include "smb_common.h" #include "smbstatus.h" #include "mgmt/user_session.h"
fs/ksmbd/smb2ops.c +0 -1
@@ -6,7 +6,6 @@#include <linux/slab.h> #include "glob.h" -#include "smb2pdu.h" #include "auth.h" #include "connection.h"
fs/ksmbd/smb2pdu.c +1 -2
@@ -13,7 +13,6 @@#include <linux/falloc.h> #include "glob.h" -#include "smb2pdu.h" #include "smbfsctl.h" #include "oplock.h" #include "smbacl.h"
@@ -8249,7 +8248,7 @@ static void fill_transform_hdr(void *tr_buf, char *old_buf, __le16 cipher_type)memset (tr_buf,0 ,sizeof (struct smb2_transform_hdr ) +4 ); tr_hdr->ProtocolId =SMB2_TRANSFORM_PROTO_NUM ; tr_hdr->OriginalMessageSize =cpu_to_le32 (orig_len); - tr_hdr->Flags =cpu_to_le16 (0x01 ); + tr_hdr->Flags =cpu_to_le16 (TRANSFORM_FLAG_ENCRYPTED );if (cipher_type ==SMB2_ENCRYPTION_AES128_GCM || cipher_type ==SMB2_ENCRYPTION_AES256_GCM )get_random_bytes (&tr_hdr->Nonce,SMB3_AES_GCM_NONCE );
fs/ksmbd/smb2pdu.h +0 -176
198 lines not on this page · raw message
fs/ksmbd/smb_common.h +1 -0
@@ -10,6 +10,7 @@#include "glob.h" #include "nterr.h" +#include "../cifs_common/smb2pdu.h" #include "smb2pdu.h" /* ksmbd's Specific ERRNO */
Signature · 1 line
2.30.2
PATCH 3/4 cifs: move NEGOTIATE_PROTOCOL definitions out into the common area
In reply to Ronnie Sahlberg--- fs/cifs/smb2pdu.c | 4 +- fs/cifs/smb2pdu.h | 220 ------------------------------------- fs/cifs_common/smb2pdu.h | 229 +++++++++++++++++++++++++++++++++++++++ 3 files changed, 231 insertions(+), 222 deletions(-)
fs/cifs/smb2pdu.c +2 -2
@@ -414,8 +414,8 @@ build_preauth_ctxt(struct smb2_preauth_neg_context *pneg_ctxt) pneg_ctxt->ContextType =SMB2_PREAUTH_INTEGRITY_CAPABILITIES ; pneg_ctxt->DataLength =cpu_to_le16 (38 ); pneg_ctxt->HashAlgorithmCount =cpu_to_le16 (1 ); - pneg_ctxt->SaltLength =cpu_to_le16 (SMB311_LINUX_CLIENT_SALT_SIZE ); -get_random_bytes (pneg_ctxt->Salt,SMB311_LINUX_CLIENT_SALT_SIZE ); + pneg_ctxt->SaltLength =cpu_to_le16 (SMB311_SALT_SIZE ); +get_random_bytes (pneg_ctxt->Salt,SMB311_SALT_SIZE ); pneg_ctxt->HashAlgorithms =SMB2_PREAUTH_INTEGRITY_SHA512 ; }
fs/cifs/smb2pdu.h +0 -220
226 lines not on this page · raw message
fs/cifs_common/smb2pdu.h +229 -0
233 lines not on this page · raw message
Signature · 1 line
2.30.2
PATCH 4/4 ksmbd: use the common definitions for NEGOTIATE_PROTOCOL
In reply to Ronnie Sahlberg--- fs/ksmbd/smb2ops.c | 8 +-- fs/ksmbd/smb2pdu.c | 20 +++--- fs/ksmbd/smb2pdu.h | 143 +----------------------------------------- fs/ksmbd/smb_common.h | 11 ---- 4 files changed, 15 insertions(+), 167 deletions(-)
fs/ksmbd/smb2ops.c +4 -4
@@ -203,7 +203,7 @@ void init_smb2_1_server(struct ksmbd_conn *conn) conn->cmds = smb2_0_server_cmds; conn->max_cmds =ARRAY_SIZE (smb2_0_server_cmds); conn->max_credits =SMB2_MAX_CREDITS ; - conn->signing_algorithm =SIGNING_ALG_HMAC_SHA256 ; + conn->signing_algorithm =SIGNING_ALG_HMAC_SHA256_LE ;if (server_conf.flags &KSMBD_GLOBAL_FLAG_SMB2_LEASES ) conn->vals->capabilities |=SMB2_GLOBAL_CAP_LEASING ;
@@ -221,7 +221,7 @@ void init_smb3_0_server(struct ksmbd_conn *conn) conn->cmds = smb2_0_server_cmds; conn->max_cmds =ARRAY_SIZE (smb2_0_server_cmds); conn->max_credits =SMB2_MAX_CREDITS ; - conn->signing_algorithm =SIGNING_ALG_AES_CMAC ; + conn->signing_algorithm =SIGNING_ALG_AES_CMAC_LE ;if (server_conf.flags &KSMBD_GLOBAL_FLAG_SMB2_LEASES ) conn->vals->capabilities |=SMB2_GLOBAL_CAP_LEASING ;
@@ -246,7 +246,7 @@ void init_smb3_02_server(struct ksmbd_conn *conn) conn->cmds = smb2_0_server_cmds; conn->max_cmds =ARRAY_SIZE (smb2_0_server_cmds); conn->max_credits =SMB2_MAX_CREDITS ; - conn->signing_algorithm =SIGNING_ALG_AES_CMAC ; + conn->signing_algorithm =SIGNING_ALG_AES_CMAC_LE ;if (server_conf.flags &KSMBD_GLOBAL_FLAG_SMB2_LEASES ) conn->vals->capabilities |=SMB2_GLOBAL_CAP_LEASING ;
@@ -271,7 +271,7 @@ int init_smb3_11_server(struct ksmbd_conn *conn) conn->cmds = smb2_0_server_cmds; conn->max_cmds =ARRAY_SIZE (smb2_0_server_cmds); conn->max_credits =SMB2_MAX_CREDITS ; - conn->signing_algorithm =SIGNING_ALG_AES_CMAC ; + conn->signing_algorithm =SIGNING_ALG_AES_CMAC_LE ;if (server_conf.flags &KSMBD_GLOBAL_FLAG_SMB2_LEASES ) conn->vals->capabilities |=SMB2_GLOBAL_CAP_LEASING ;
fs/ksmbd/smb2pdu.c +10 -10
@@ -771,16 +771,16 @@ static void build_encrypt_ctxt(struct smb2_encryption_neg_context *pneg_ctxt, pneg_ctxt->Ciphers[0 ] = cipher_type; } -static void build_compression_ctxt (struct smb2_compression_ctx *pneg_ctxt, +static void build_compression_ctxt (struct smb2_compression_capabilities_context *pneg_ctxt,__le16 comp_algo) { pneg_ctxt->ContextType =SMB2_COMPRESSION_CAPABILITIES ; pneg_ctxt->DataLength = -cpu_to_le16 (sizeof (struct smb2_compression_ctx ) +cpu_to_le16 (sizeof (struct smb2_compression_capabilities_context ) -sizeof (struct smb2_neg_context )); pneg_ctxt->Reserved =cpu_to_le32 (0 ); pneg_ctxt->CompressionAlgorithmCount =cpu_to_le16 (1 ); - pneg_ctxt->Reserved1 =cpu_to_le32 (0 ); + pneg_ctxt->Flags =cpu_to_le32 (0 ); pneg_ctxt->CompressionAlgorithms[0 ] = comp_algo; }
@@ -857,12 +857,12 @@ static void assemble_neg_contexts(struct ksmbd_conn *conn,ksmbd_debug (SMB ,"assemble SMB2_COMPRESSION_CAPABILITIES context\n" );/* Temporarily set to SMB3_COMPRESS_NONE */ -build_compression_ctxt ((struct smb2_compression_ctx *)pneg_ctxt, +build_compression_ctxt ((struct smb2_compression_capabilities_context *)pneg_ctxt, conn->compress_algorithm); rsp->NegotiateContextCount =cpu_to_le16 (++neg_ctxt_cnt); - ctxt_size +=sizeof (struct smb2_compression_ctx ) +2 ; + ctxt_size +=sizeof (struct smb2_compression_capabilities_context ) +2 ;/* Round to 8 byte boundary */ - pneg_ctxt +=round_up (sizeof (struct smb2_compression_ctx ) +2 , + pneg_ctxt +=round_up (sizeof (struct smb2_compression_capabilities_context ) +2 ,8 ); }
@@ -936,7 +936,7 @@ static void decode_encrypt_ctxt(struct ksmbd_conn *conn, }static void decode_compress_ctxt (struct ksmbd_conn *conn, -struct smb2_compression_ctx *pneg_ctxt) +struct smb2_compression_capabilities_context *pneg_ctxt) { conn->compress_algorithm =SMB3_COMPRESS_NONE ; }
@@ -957,8 +957,8 @@ static void decode_sign_cap_ctxt(struct ksmbd_conn *conn, }for (i =0 ; i < sign_algo_cnt; i++) { -if (pneg_ctxt->SigningAlgorithms[i] ==SIGNING_ALG_HMAC_SHA256 || - pneg_ctxt->SigningAlgorithms[i] ==SIGNING_ALG_AES_CMAC ) { +if (pneg_ctxt->SigningAlgorithms[i] ==SIGNING_ALG_HMAC_SHA256_LE || + pneg_ctxt->SigningAlgorithms[i] ==SIGNING_ALG_AES_CMAC_LE ) {ksmbd_debug (SMB ,"Signing Algorithm ID = 0x%x\n" , pneg_ctxt->SigningAlgorithms[i]); conn->signing_negotiated = true;
@@ -1029,7 +1029,7 @@ static __le32 deassemble_neg_contexts(struct ksmbd_conn *conn,break ;decode_compress_ctxt (conn, - (struct smb2_compression_ctx *)pctx); + (struct smb2_compression_capabilities_context *)pctx); }else if (pctx->ContextType ==SMB2_NETNAME_NEGOTIATE_CONTEXT_ID ) {ksmbd_debug (SMB ,"deassemble SMB2_NETNAME_NEGOTIATE_CONTEXT_ID context\n" );
fs/ksmbd/smb2pdu.h +1 -142
165 lines not on this page · raw message
fs/ksmbd/smb_common.h +0 -11
@@ -33,17 +33,6 @@#define SMB302_VERSION_STRING "3.02"#define SMB311_VERSION_STRING "3.1.1" -/* Dialects */ -#define SMB10_PROT_ID 0x00 -#define SMB20_PROT_ID 0x0202 -#define SMB21_PROT_ID 0x0210 -/* multi-protocol negotiate request */ -#define SMB2X_PROT_ID 0x02FF -#define SMB30_PROT_ID 0x0300 -#define SMB302_PROT_ID 0x0302 -#define SMB311_PROT_ID 0x0311 -#define BAD_PROT_ID 0xFFFF -#define SMB_ECHO_INTERVAL (60 * HZ)#define CIFS_DEFAULT_IOSIZE (64 * 1024)
Signature · 1 line
2.30.2
Namjae Jeon
maintainerHi Ronnie,
2021-09-07 7:46 GMT+09:00, Ronnie Sahlberg <[email protected]>:
Quoted 15 lines
Steve, Namjae,
Here is a start of work to share common definitions between the cifs client and the server.
The patches build ontop of Namjaes patch to rework thesmb2_hdrstructure that he recently sent to the list.It creates a new shared
smb2pdu.hfile and starts moving definitions over. The two copies ofsmb2pdu.h, in cifs/ and ksmbd/ have diverged a bit so some things are being renamed in these patches. NegotiateProtocol is in two separate patches since for this funciton the changes are a little more than just renames, for example I change several arrays at the tail of structures from [number] to simply []
so that needs careful review.
Quoted 3 lines
Two patches are for cifs and
cifs_commonand two patches are for ksmbd. The ksmbd patches depend on the cifs patches so the cifs patches have to go in first.
When I try build test with sparse, I can see build warnings. I will test more.
$ make fs/ksmbd/ksmbd.ko C=1 CHECK=/home/linkinjeon/sparse-dev/sparse CF=-D__CHECK_ENDIAN__
...
CC [M] fs/ksmbd/unicode.o CHECK fs/ksmbd/unicode.c CC [M] fs/ksmbd/auth.o CHECK fs/ksmbd/auth.c fs/ksmbd/auth.c:1267:39: warning: cast to restricted __le64 CC [M] fs/ksmbd/vfs.o CHECK fs/ksmbd/vfs.c CC [M] fs/ksmbd/vfs_cache.o CHECK fs/ksmbd/vfs_cache.c CC [M] fs/ksmbd/server.o CHECK fs/ksmbd/server.c CC [M] fs/ksmbd/ndr.o CHECK fs/ksmbd/ndr.c CC [M] fs/ksmbd/misc.o CHECK fs/ksmbd/misc.c CC [M] fs/ksmbd/oplock.o CHECK fs/ksmbd/oplock.c CC [M] fs/ksmbd/connection.o CHECK fs/ksmbd/connection.c CC [M] fs/ksmbd/ksmbd_work.o CHECK fs/ksmbd/ksmbd_work.c CC [M] fs/ksmbd/crypto_ctx.o CHECK fs/ksmbd/crypto_ctx.c CC [M] fs/ksmbd/mgmt/ksmbd_ida.o CHECK fs/ksmbd/mgmt/ksmbd_ida.c CC [M] fs/ksmbd/mgmt/user_config.o CHECK fs/ksmbd/mgmt/user_config.c CC [M] fs/ksmbd/mgmt/share_config.o CHECK fs/ksmbd/mgmt/share_config.c CC [M] fs/ksmbd/mgmt/tree_connect.o CHECK fs/ksmbd/mgmt/tree_connect.c CC [M] fs/ksmbd/mgmt/user_session.o CHECK fs/ksmbd/mgmt/user_session.c CC [M] fs/ksmbd/smb_common.o CHECK fs/ksmbd/smb_common.c CC [M] fs/ksmbd/transport_tcp.o CHECK fs/ksmbd/transport_tcp.c CC [M] fs/ksmbd/transport_ipc.o CHECK fs/ksmbd/transport_ipc.c CC [M] fs/ksmbd/smbacl.o CHECK fs/ksmbd/smbacl.c CC [M] fs/ksmbd/smb2pdu.o CHECK fs/ksmbd/smb2pdu.c
fs/ksmbd/smb2pdu.c:781:29: warning: incorrect type in assignment (different base types)fs/ksmbd/smb2pdu.c:781:29: expected unsigned int [usertype] Reservedfs/ksmbd/smb2pdu.c:781:29: got restricted __le32 [usertype]fs/ksmbd/smb2pdu.c:783:26: warning: incorrect type in assignment (different base types)fs/ksmbd/smb2pdu.c:783:26: expected unsigned int [usertype] Flagsfs/ksmbd/smb2pdu.c:783:26: got restricted __le32 [usertype]fs/ksmbd/smb2pdu.c:794:29: warning: incorrect type in assignment (different base types)fs/ksmbd/smb2pdu.c:794:29: expected unsigned int [usertype] Reservedfs/ksmbd/smb2pdu.c:794:29: got restricted __le32 [usertype]fs/ksmbd/smb2pdu.c:8320:47: warning: cast to restricted __le64 fs/ksmbd/smb2pdu.c:8322:17: warning: cast to restricted __le64
CC [M] fs/ksmbd/smb2ops.o CHECK fs/ksmbd/smb2ops.c CC [M] fs/ksmbd/smb2misc.o CHECK fs/ksmbd/smb2misc.c ASN.1 fs/ksmbd/ksmbd_spnego_negtokeninit.asn1.[ch] CC [M] fs/ksmbd/ksmbd_spnego_negtokeninit.asn1.o CHECK fs/ksmbd/ksmbd_spnego_negtokeninit.asn1.c ASN.1 fs/ksmbd/ksmbd_spnego_negtokentarg.asn1.[ch] CC [M] fs/ksmbd/ksmbd_spnego_negtokentarg.asn1.o CHECK fs/ksmbd/ksmbd_spnego_negtokentarg.asn1.c CC [M] fs/ksmbd/asn1.o CHECK fs/ksmbd/asn1.c CC [M] fs/ksmbd/transport_rdma.o CHECK fs/ksmbd/transport_rdma.c LD [M] fs/ksmbd/ksmbd.o
Thanks!
Quoted 3 lines
ronnie sahlberg
reviewerQuoted 18 lines · Namjae Jeon
Hi Ronnie,
2021-09-07 7:46 GMT+09:00, Ronnie Sahlberg <[email protected]>:Quoted 15 lines
Steve, Namjae,
Here is a start of work to share common definitions between the cifs client and the server.
The patches build ontop of Namjaes patch to rework thesmb2_hdrstructure that he recently sent to the list.It creates a new shared
smb2pdu.hfile and starts moving definitions over. The two copies ofsmb2pdu.h, in cifs/ and ksmbd/ have diverged a bit so some things are being renamed in these patches. NegotiateProtocol is in two separate patches since for this funciton the changes are a little more than just renames, for example I change several arrays at the tail of structures from [number] to simply []
so that needs careful review.
Quoted 5 lines
Quoted 3 lines
Two patches are for cifs and
cifs_commonand two patches are for ksmbd. The ksmbd patches depend on the cifs patches so the cifs patches have to go in first.When I try build test with sparse, I can see build warnings. I will test more.
Thanks. I have fixed the sparse warning and resent.
Quoted 82 lines
$ make fs/ksmbd/ksmbd.ko C=1 CHECK=/home/linkinjeon/sparse-dev/sparse CF=-D__CHECK_ENDIAN__...
CC [M] fs/ksmbd/unicode.o CHECK fs/ksmbd/unicode.c CC [M] fs/ksmbd/auth.o CHECK fs/ksmbd/auth.c fs/ksmbd/auth.c:1267:39: warning: cast to restricted __le64 CC [M] fs/ksmbd/vfs.o CHECK fs/ksmbd/vfs.c CC [M] fs/ksmbd/vfs_cache.o CHECK fs/ksmbd/vfs_cache.c CC [M] fs/ksmbd/server.o CHECK fs/ksmbd/server.c CC [M] fs/ksmbd/ndr.o CHECK fs/ksmbd/ndr.c CC [M] fs/ksmbd/misc.o CHECK fs/ksmbd/misc.c CC [M] fs/ksmbd/oplock.o CHECK fs/ksmbd/oplock.c CC [M] fs/ksmbd/connection.o CHECK fs/ksmbd/connection.c CC [M] fs/ksmbd/ksmbd_work.o CHECK fs/ksmbd/ksmbd_work.c CC [M] fs/ksmbd/crypto_ctx.o CHECK fs/ksmbd/crypto_ctx.c CC [M] fs/ksmbd/mgmt/ksmbd_ida.o CHECK fs/ksmbd/mgmt/ksmbd_ida.c CC [M] fs/ksmbd/mgmt/user_config.o CHECK fs/ksmbd/mgmt/user_config.c CC [M] fs/ksmbd/mgmt/share_config.o CHECK fs/ksmbd/mgmt/share_config.c CC [M] fs/ksmbd/mgmt/tree_connect.o CHECK fs/ksmbd/mgmt/tree_connect.c CC [M] fs/ksmbd/mgmt/user_session.o CHECK fs/ksmbd/mgmt/user_session.c CC [M] fs/ksmbd/smb_common.o CHECK fs/ksmbd/smb_common.c CC [M] fs/ksmbd/transport_tcp.o CHECK fs/ksmbd/transport_tcp.c CC [M] fs/ksmbd/transport_ipc.o CHECK fs/ksmbd/transport_ipc.c CC [M] fs/ksmbd/smbacl.o CHECK fs/ksmbd/smbacl.c CC [M] fs/ksmbd/smb2pdu.o CHECK fs/ksmbd/smb2pdu.c
fs/ksmbd/smb2pdu.c:781:29: warning: incorrect type in assignment (different base types)fs/ksmbd/smb2pdu.c:781:29: expected unsigned int [usertype] Reservedfs/ksmbd/smb2pdu.c:781:29: got restricted__le32[usertype]fs/ksmbd/smb2pdu.c:783:26: warning: incorrect type in assignment (different base types)fs/ksmbd/smb2pdu.c:783:26: expected unsigned int [usertype] Flagsfs/ksmbd/smb2pdu.c:783:26: got restricted__le32[usertype]fs/ksmbd/smb2pdu.c:794:29: warning: incorrect type in assignment (different base types)fs/ksmbd/smb2pdu.c:794:29: expected unsigned int [usertype] Reservedfs/ksmbd/smb2pdu.c:794:29: got restricted__le32[usertype]fs/ksmbd/smb2pdu.c:8320:47: warning: cast to restricted__le64fs/ksmbd/smb2pdu.c:8322:17: warning: cast to restricted__le64CC [M] fs/ksmbd/smb2ops.o CHECK fs/ksmbd/smb2ops.c CC [M] fs/ksmbd/smb2misc.o CHECK fs/ksmbd/smb2misc.c ASN.1 fs/ksmbd/ksmbd_spnego_negtokeninit.asn1.[ch] CC [M] fs/ksmbd/ksmbd_spnego_negtokeninit.asn1.o CHECK fs/ksmbd/ksmbd_spnego_negtokeninit.asn1.c ASN.1 fs/ksmbd/ksmbd_spnego_negtokentarg.asn1.[ch] CC [M] fs/ksmbd/ksmbd_spnego_negtokentarg.asn1.o CHECK fs/ksmbd/ksmbd_spnego_negtokentarg.asn1.c CC [M] fs/ksmbd/asn1.o CHECK fs/ksmbd/asn1.c CC [M] fs/ksmbd/transport_rdma.o CHECK fs/ksmbd/transport_rdma.c LD [M] fs/ksmbd/ksmbd.oThanks!
Quoted 3 lines
Will review and merge tonight or tomorrow morning.
Quoted 110 lines · ronnie sahlberg
Quoted 18 lines · Namjae Jeon
Hi Ronnie,
2021-09-07 7:46 GMT+09:00, Ronnie Sahlberg <[email protected]>:Quoted 15 lines
Steve, Namjae,
Here is a start of work to share common definitions between the cifs client and the server.
The patches build ontop of Namjaes patch to rework thesmb2_hdrstructure that he recently sent to the list.It creates a new shared
smb2pdu.hfile and starts moving definitions over. The two copies ofsmb2pdu.h, in cifs/ and ksmbd/ have diverged a bit so some things are being renamed in these patches. NegotiateProtocol is in two separate patches since for this funciton the changes are a little more than just renames, for example I change several arrays at the tail of structures from [number] to simply []
so that needs careful review.Quoted 5 lines
Quoted 3 lines
Two patches are for cifs and
cifs_commonand two patches are for ksmbd. The ksmbd patches depend on the cifs patches so the cifs patches have to go in first.When I try build test with sparse, I can see build warnings. I will test more.
Thanks. I have fixed the sparse warning and resent.
Quoted 82 lines
$ make fs/ksmbd/ksmbd.ko C=1 CHECK=/home/linkinjeon/sparse-dev/sparse CF=-D__CHECK_ENDIAN__...
CC [M] fs/ksmbd/unicode.o CHECK fs/ksmbd/unicode.c CC [M] fs/ksmbd/auth.o CHECK fs/ksmbd/auth.c fs/ksmbd/auth.c:1267:39: warning: cast to restricted __le64 CC [M] fs/ksmbd/vfs.o CHECK fs/ksmbd/vfs.c CC [M] fs/ksmbd/vfs_cache.o CHECK fs/ksmbd/vfs_cache.c CC [M] fs/ksmbd/server.o CHECK fs/ksmbd/server.c CC [M] fs/ksmbd/ndr.o CHECK fs/ksmbd/ndr.c CC [M] fs/ksmbd/misc.o CHECK fs/ksmbd/misc.c CC [M] fs/ksmbd/oplock.o CHECK fs/ksmbd/oplock.c CC [M] fs/ksmbd/connection.o CHECK fs/ksmbd/connection.c CC [M] fs/ksmbd/ksmbd_work.o CHECK fs/ksmbd/ksmbd_work.c CC [M] fs/ksmbd/crypto_ctx.o CHECK fs/ksmbd/crypto_ctx.c CC [M] fs/ksmbd/mgmt/ksmbd_ida.o CHECK fs/ksmbd/mgmt/ksmbd_ida.c CC [M] fs/ksmbd/mgmt/user_config.o CHECK fs/ksmbd/mgmt/user_config.c CC [M] fs/ksmbd/mgmt/share_config.o CHECK fs/ksmbd/mgmt/share_config.c CC [M] fs/ksmbd/mgmt/tree_connect.o CHECK fs/ksmbd/mgmt/tree_connect.c CC [M] fs/ksmbd/mgmt/user_session.o CHECK fs/ksmbd/mgmt/user_session.c CC [M] fs/ksmbd/smb_common.o CHECK fs/ksmbd/smb_common.c CC [M] fs/ksmbd/transport_tcp.o CHECK fs/ksmbd/transport_tcp.c CC [M] fs/ksmbd/transport_ipc.o CHECK fs/ksmbd/transport_ipc.c CC [M] fs/ksmbd/smbacl.o CHECK fs/ksmbd/smbacl.c CC [M] fs/ksmbd/smb2pdu.o CHECK fs/ksmbd/smb2pdu.c
fs/ksmbd/smb2pdu.c:781:29: warning: incorrect type in assignment (different base types)fs/ksmbd/smb2pdu.c:781:29: expected unsigned int [usertype] Reservedfs/ksmbd/smb2pdu.c:781:29: got restricted__le32[usertype]fs/ksmbd/smb2pdu.c:783:26: warning: incorrect type in assignment (different base types)fs/ksmbd/smb2pdu.c:783:26: expected unsigned int [usertype] Flagsfs/ksmbd/smb2pdu.c:783:26: got restricted__le32[usertype]fs/ksmbd/smb2pdu.c:794:29: warning: incorrect type in assignment (different base types)fs/ksmbd/smb2pdu.c:794:29: expected unsigned int [usertype] Reservedfs/ksmbd/smb2pdu.c:794:29: got restricted__le32[usertype]fs/ksmbd/smb2pdu.c:8320:47: warning: cast to restricted__le64fs/ksmbd/smb2pdu.c:8322:17: warning: cast to restricted__le64CC [M] fs/ksmbd/smb2ops.o CHECK fs/ksmbd/smb2ops.c CC [M] fs/ksmbd/smb2misc.o CHECK fs/ksmbd/smb2misc.c ASN.1 fs/ksmbd/ksmbd_spnego_negtokeninit.asn1.[ch] CC [M] fs/ksmbd/ksmbd_spnego_negtokeninit.asn1.o CHECK fs/ksmbd/ksmbd_spnego_negtokeninit.asn1.c ASN.1 fs/ksmbd/ksmbd_spnego_negtokentarg.asn1.[ch] CC [M] fs/ksmbd/ksmbd_spnego_negtokentarg.asn1.o CHECK fs/ksmbd/ksmbd_spnego_negtokentarg.asn1.c CC [M] fs/ksmbd/asn1.o CHECK fs/ksmbd/asn1.c CC [M] fs/ksmbd/transport_rdma.o CHECK fs/ksmbd/transport_rdma.c LD [M] fs/ksmbd/ksmbd.oThanks!
Quoted 3 lines
Signature · 3 lines
Thanks, Steve
Namjae Jeon
maintainer2021-09-07 11:57 GMT+09:00, ronnie sahlberg <[email protected]>:
Quoted 24 lines · Namjae Jeon
Quoted 23 lines
Hi Ronnie,
2021-09-07 7:46 GMT+09:00, Ronnie Sahlberg <[email protected]>:Quoted 20 lines
Steve, Namjae,
Here is a start of work to share common definitions between the cifs client
and the server.
The patches build ontop of Namjaes patch to rework thesmb2_hdrstructure
that he recently sent to the list.It creates a new shared
smb2pdu.hfile and starts moving definitions over.
The two copies ofsmb2pdu.h, in cifs/ and ksmbd/ have diverged a bit so some things are being renamed in these patches. NegotiateProtocol is in two separate patches since for this funciton the
changes are a little more than just renames, for example I change several
arrays at the tail of structures from [number] to simply [] so that needs careful review.
Quoted 8 lines
Quoted 6 lines
Quoted 4 lines
Two patches are for cifs and
cifs_commonand two patches are for ksmbd. The ksmbd patches depend on the cifs patches so the cifs patches have to go
in first.When I try build test with sparse, I can see build warnings. I will test more.
Thanks. I have fixed the sparse warning and resent.
It work fine, and looks good to me.
I will apply ksmbd's patches to my queue. and send them to Steve after cifs's patches are applied first.
Thanks!
Quoted 84 lines
Quoted 83 lines
$ make fs/ksmbd/ksmbd.ko C=1 CHECK=/home/linkinjeon/sparse-dev/sparse CF=-D__CHECK_ENDIAN__...
CC [M] fs/ksmbd/unicode.o CHECK fs/ksmbd/unicode.c CC [M] fs/ksmbd/auth.o CHECK fs/ksmbd/auth.c fs/ksmbd/auth.c:1267:39: warning: cast to restricted __le64 CC [M] fs/ksmbd/vfs.o CHECK fs/ksmbd/vfs.c CC [M] fs/ksmbd/vfs_cache.o CHECK fs/ksmbd/vfs_cache.c CC [M] fs/ksmbd/server.o CHECK fs/ksmbd/server.c CC [M] fs/ksmbd/ndr.o CHECK fs/ksmbd/ndr.c CC [M] fs/ksmbd/misc.o CHECK fs/ksmbd/misc.c CC [M] fs/ksmbd/oplock.o CHECK fs/ksmbd/oplock.c CC [M] fs/ksmbd/connection.o CHECK fs/ksmbd/connection.c CC [M] fs/ksmbd/ksmbd_work.o CHECK fs/ksmbd/ksmbd_work.c CC [M] fs/ksmbd/crypto_ctx.o CHECK fs/ksmbd/crypto_ctx.c CC [M] fs/ksmbd/mgmt/ksmbd_ida.o CHECK fs/ksmbd/mgmt/ksmbd_ida.c CC [M] fs/ksmbd/mgmt/user_config.o CHECK fs/ksmbd/mgmt/user_config.c CC [M] fs/ksmbd/mgmt/share_config.o CHECK fs/ksmbd/mgmt/share_config.c CC [M] fs/ksmbd/mgmt/tree_connect.o CHECK fs/ksmbd/mgmt/tree_connect.c CC [M] fs/ksmbd/mgmt/user_session.o CHECK fs/ksmbd/mgmt/user_session.c CC [M] fs/ksmbd/smb_common.o CHECK fs/ksmbd/smb_common.c CC [M] fs/ksmbd/transport_tcp.o CHECK fs/ksmbd/transport_tcp.c CC [M] fs/ksmbd/transport_ipc.o CHECK fs/ksmbd/transport_ipc.c CC [M] fs/ksmbd/smbacl.o CHECK fs/ksmbd/smbacl.c CC [M] fs/ksmbd/smb2pdu.o CHECK fs/ksmbd/smb2pdu.c
fs/ksmbd/smb2pdu.c:781:29: warning: incorrect type in assignment (different base types)fs/ksmbd/smb2pdu.c:781:29: expected unsigned int [usertype] Reservedfs/ksmbd/smb2pdu.c:781:29: got restricted__le32[usertype]fs/ksmbd/smb2pdu.c:783:26: warning: incorrect type in assignment (different base types)fs/ksmbd/smb2pdu.c:783:26: expected unsigned int [usertype] Flagsfs/ksmbd/smb2pdu.c:783:26: got restricted__le32[usertype]fs/ksmbd/smb2pdu.c:794:29: warning: incorrect type in assignment (different base types)fs/ksmbd/smb2pdu.c:794:29: expected unsigned int [usertype] Reservedfs/ksmbd/smb2pdu.c:794:29: got restricted__le32[usertype]fs/ksmbd/smb2pdu.c:8320:47: warning: cast to restricted__le64fs/ksmbd/smb2pdu.c:8322:17: warning: cast to restricted__le64CC [M] fs/ksmbd/smb2ops.o CHECK fs/ksmbd/smb2ops.c CC [M] fs/ksmbd/smb2misc.o CHECK fs/ksmbd/smb2misc.c ASN.1 fs/ksmbd/ksmbd_spnego_negtokeninit.asn1.[ch] CC [M] fs/ksmbd/ksmbd_spnego_negtokeninit.asn1.o CHECK fs/ksmbd/ksmbd_spnego_negtokeninit.asn1.c ASN.1 fs/ksmbd/ksmbd_spnego_negtokentarg.asn1.[ch] CC [M] fs/ksmbd/ksmbd_spnego_negtokentarg.asn1.o CHECK fs/ksmbd/ksmbd_spnego_negtokentarg.asn1.c CC [M] fs/ksmbd/asn1.o CHECK fs/ksmbd/asn1.c CC [M] fs/ksmbd/transport_rdma.o CHECK fs/ksmbd/transport_rdma.c LD [M] fs/ksmbd/ksmbd.oThanks!
Quoted 3 lines