[Devel] [RFC PATCH 2/2] autofs: sent 32-bit sized packet for 32-bit process
Stanislav Kinsburskiy
skinsbursky at virtuozzo.com
Thu Aug 31 16:57:11 MSK 2017
The structure autofs_v5_packet (except name) is not aligned by 8 bytes, which
lead to different sizes in 32 and 64-bit architectures.
Let's form 32-bit compatible packet when daemon has 32-bit addressation.
Signed-off-by: Stanislav Kinsburskiy <skinsbursky at virtuozzo.com>
---
fs/autofs4/waitq.c | 11 +++++++++--
1 file changed, 9 insertions(+), 2 deletions(-)
diff --git a/fs/autofs4/waitq.c b/fs/autofs4/waitq.c
index 309ca6b..484cf2e 100644
--- a/fs/autofs4/waitq.c
+++ b/fs/autofs4/waitq.c
@@ -153,12 +153,19 @@ static void autofs4_notify_daemon(struct autofs_sb_info *sbi,
{
struct autofs_v5_packet *packet = &pkt.v5_pkt.v5_packet;
struct user_namespace *user_ns = sbi->pipe->f_cred->user_ns;
+ size_t name_offset;
- pktsz = sizeof(*packet);
+ if (sbi->is32bit)
+ name_offset = offsetof(struct autofs_v5_packet, len) +
+ sizeof(packet->len);
+ else
+ name_offset = offsetof(struct autofs_v5_packet, name);
+
+ pktsz = name_offset + sizeof(packet->name);
packet->wait_queue_token = wq->wait_queue_token;
packet->len = wq->name.len;
- memcpy(packet->name, wq->name.name, wq->name.len);
+ memcpy(packet + name_offset, wq->name.name, wq->name.len);
packet->name[wq->name.len] = '\0';
packet->dev = wq->dev;
packet->ino = wq->ino;
More information about the Devel
mailing list