From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on inbox.vuxu.org X-Spam-Level: X-Spam-Status: No, score=-3.1 required=5.0 tests=DKIM_INVALID,DKIM_SIGNED, MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED,RCVD_IN_MSPIKE_H3, RCVD_IN_MSPIKE_WL autolearn=ham autolearn_force=no version=3.4.4 Received: (qmail 27173 invoked from network); 3 Sep 2021 10:14:09 -0000 Received: from mother.openwall.net (195.42.179.200) by inbox.vuxu.org with ESMTPUTF8; 3 Sep 2021 10:14:09 -0000 Received: (qmail 25854 invoked by uid 550); 3 Sep 2021 10:14:06 -0000 Mailing-List: contact musl-help@lists.openwall.com; run by ezmlm Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-ID: Reply-To: musl@lists.openwall.com Received: (qmail 25821 invoked from network); 3 Sep 2021 10:14:06 -0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=hanne.name; s=kas202103291426; t=1630664032; bh=Nfh12pmFEdz5fin/XGmT1Q6nmhdyrm1Dl8bgAbwLHBs=; h=Subject:To:From:Date:From; b=LyEVvcx8bbo5qEgVs+MvieNud1Dy05G1lhEZstnXfCq4BfBKkrtFpMa06xUmvXa5Q 4njLwbtyIyxlX39v9vXAT0WEttisiBQ/+veHB+iCTns0FQnBwSgEouZFhDvFGA+dEb HXkcC68jQM8nSLq/BZY5HclQmOKLC1caPCvL/SZDXEH+QieQwoQw+SQ33CELOl0m/R C7kWDByJNP6pMOZOlFHDSTMUX2oVst6Fl1XemDvUszImN+w2dfjLg4MAGARlpTaYT4 9AgrNarjwTJ5YRPlKcttgt6rqELyMYqK1O3UDMwWq8f16xevrGJyT0xDxShMGRY12A +K+akfZkjNBbg== To: musl@lists.openwall.com From: "J. Hanne" User-Agent: ALL-INKL Webmail 2.11 mobile X-SenderIP: 80.187.97.111 MIME-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 8bit Message-Id: <20210903101352.379FC2FC06B2@dd11108.kasserver.com> Date: Fri, 3 Sep 2021 12:13:52 +0200 (CEST) Subject: [musl] CMSG_LEN macro Hi, can somebody enlighten me on the purpose of "CMSG_ALIGN (sizeof (struct cmsghdr))" in #define CMSG_LEN(len) (CMSG_ALIGN (sizeof (struct cmsghdr)) + (len)) of https://git.musl-libc.org/cgit/musl/tree/include/sys/socket.h? CMSG_ALIGN seems to round up to a multiple of sizeof(size_t) - e.g. to a multiple of 4 on x86/arm and to a multiple of 8 on x86_64/aarch64? Given struct cmsghdr, which has a size of 16 bytes on all 4 mentioned archs, I already wonder if this has an effect on any real-world architecture. But more importantly, I wonder *what* exactly is supposed to being aligned here: - Shall it put some padding *before* struct cmsghdr? That doesn't seem to make sense as the result of CMSG_LEN() goes into the cmsg_len member of struct cmsg, so it would seem strange to me to include bytes preceding the struct in its length field. - Shall it put some padding *after* struct cmsghdr? In this case, CMSG_DATA would be wrong as it puts the data directly behind struct cmsghdr without any padding between. Regards, Johann