Received: by 2002:a05:6358:a55:b0:ec:fcf4:3ecf with SMTP id 21csp890836rwb; Thu, 12 Jan 2023 13:51:55 -0800 (PST) X-Google-Smtp-Source: AMrXdXsRaBnE5RrJh+CQdVddYIRjDGckFRymA+HP6DvJ5XIQYtzNLDjN1vpb8FJT8zHKqLwBJ/PO X-Received: by 2002:a17:907:cbc8:b0:7c1:ed:171c with SMTP id vk8-20020a170907cbc800b007c100ed171cmr75654193ejc.26.1673560314963; Thu, 12 Jan 2023 13:51:54 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1673560314; cv=none; d=google.com; s=arc-20160816; b=paqU+S9wB4XOxkq6ItoFZ4SowowHMM5qA474o1qAZuBS48hafhwPSbT16hXX1ymqAX l+7fqCaDO+nFC/rq5b2vdotaeq+gFzKnwhGYUhEkMklsVZl99Vda6zlh2wYSPkuwlKQP lmT4N78GEOHJqt5nNEbL0YqoUO+s8nV8iGOB9UtOBqTm4dN2nLT6GT38GLlvMTAPumGR f5kpiHnV5lbr1HF15Exc6As+hCAMfibIglKPdPqw3JKK3XxHWZerO9H/79SMxFZyqAXW 99gIRQPEZOU3fM7Fqu9VGVn8lL5v0bq95hDV/XqKcw+M3OFYQJxDMTKAZyATtoMLtJoy HPuA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:subject:message-id:date:from:in-reply-to :references:mime-version:dkim-signature; bh=2G1ZoEYxGQpgfk9wwUZHFbGRL7cXxq7vSTyyjT2OdrE=; b=anQyI53/jG2eo5vbEOzCcPD28FwZxAP0jLcaYtxLir6glr9wpVXjEg0Cr2DO4U9+k5 SCBcGlhp3H2DOOfoIDJsrufkBEBzVnLEGIeSvr4KkO3xZmuxyNUJ7zA4kgYqTG1pA1T0 hOl+dZzzPB+3rJhGMIKOig2hd2mqTV8PQI0EDkZ1fZa0iuTb7eSwKvtfY4VwkC6OIFlK 8D/0bXt1X2pVrOXN6GKnq74sPRqnYN+yxUmdM5UJRvGFOoVcOR5NO15DohYRT8Sy6rfD JxlK1gtdUxv6b4JFoMAoGTokEgDTjx6Aa5nurwFrQ5w8tDziS7b002XycfJKW33MPEnH rM1w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@paul-moore.com header.s=google header.b="RL/4iEJm"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=paul-moore.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id oq19-20020a170906cc9300b0082372aef3b7si14016890ejb.305.2023.01.12.13.51.42; Thu, 12 Jan 2023 13:51:54 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@paul-moore.com header.s=google header.b="RL/4iEJm"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=paul-moore.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S240858AbjALVrH (ORCPT + 50 others); Thu, 12 Jan 2023 16:47:07 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40722 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232633AbjALVqi (ORCPT ); Thu, 12 Jan 2023 16:46:38 -0500 Received: from mail-pg1-x52e.google.com (mail-pg1-x52e.google.com [IPv6:2607:f8b0:4864:20::52e]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E07556C7F1 for ; Thu, 12 Jan 2023 13:39:22 -0800 (PST) Received: by mail-pg1-x52e.google.com with SMTP id s67so13698440pgs.3 for ; Thu, 12 Jan 2023 13:39:22 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=paul-moore.com; s=google; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:from:to:cc:subject:date:message-id:reply-to; bh=2G1ZoEYxGQpgfk9wwUZHFbGRL7cXxq7vSTyyjT2OdrE=; b=RL/4iEJmfTC51uP/4p2GTfep3Y9t1w6elQSazYFdY6QRYSjvTppjQIpOtNDtKDpcU4 RUnDv+CeLUjRJGhYrULLlWDGf5ASBUqttj5zeSF8e0GYaUhurhvZvjzRMwanhoso4Zt5 xY9GvqZnkHeaPkspRHFqz/HyeFIEeGEK/5j2FjzK5+cDXS2ZVC9kwN8Fzq1mDhHn1VIc RIpbrvIno2AM2/KDwlxl33qz/rqJXf54CWA9Ev4bYIk8V20fX7Ecc7F6B6dkSgROnArh TU6zSQZXyKKu1ev3rpwvAwCwMnDwLIY0jVQBFpLHsw5zvVFLjR7AP86rlaTN0sddoeoo IPeA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=2G1ZoEYxGQpgfk9wwUZHFbGRL7cXxq7vSTyyjT2OdrE=; b=hslqvqmnXsSQ5SYikE7UQlXv4Y7uljm0dU0dT5UlV99vjX//JMOW74y6Eyq5WG5Qwp up/7aJCzgwGr+rS2BQ7CegkLUxpo/s6l775Y6AYEuiEnVlOzoP9hf3mJ/0xuNQoFKbpq ujY9A79lun9huKGsfjur3kjhxkeA9cQXAXoQIQuVgad1zIy06qJZKoHdDHsQePC41XpU LkKT9BfL+k7ERWuKd7Qsh7vqFAZe2Tw1FHxYS9ax/2LK/bskx95KL+7WiIeicKq9cG7O r4DC5ldhDfNpGw3vs+3/B6+wDZNB16e3oPITKNecYnSVEhSmWRPI8JjmelXQ7/2DA+Fg pkvw== X-Gm-Message-State: AFqh2kpotU0NtGW1elhD2VtM2dnVly/lp7IGDfNe0669SLOM5qw2Kvzv VuwQvnNPedm2HxL0Hqac9LmyvZUVbsz69HXMfJ05 X-Received: by 2002:a62:158f:0:b0:588:e66e:4f05 with SMTP id 137-20020a62158f000000b00588e66e4f05mr1366618pfv.23.1673559562029; Thu, 12 Jan 2023 13:39:22 -0800 (PST) MIME-Version: 1.0 References: <20230109180717.58855-1-casey@schaufler-ca.com> <20230109180717.58855-5-casey@schaufler-ca.com> In-Reply-To: From: Paul Moore Date: Thu, 12 Jan 2023 16:39:10 -0500 Message-ID: Subject: Re: [PATCH v5 4/8] LSM: lsm_get_self_attr syscall for LSM self attributes To: Arnd Bergmann Cc: Casey Schaufler , casey.schaufler@intel.com, linux-security-module@vger.kernel.org, jmorris@namei.org, Kees Cook , john.johansen@canonical.com, Tetsuo Handa , stephen.smalley.work@gmail.com, linux-kernel@vger.kernel.org, linux-api@vger.kernel.org, mic@digikod.net Content-Type: text/plain; charset="UTF-8" X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, Jan 12, 2023 at 9:40 AM Arnd Bergmann wrote: > On Mon, Jan 9, 2023, at 19:07, Casey Schaufler wrote: > > +/** > > + * struct lsm_ctx - LSM context > > + * @id: the LSM id number, see LSM_ID_XXX > > + * @flags: context specifier and LSM specific flags > > + * @ctx_len: the size of @ctx > > + * @ctx: the LSM context, a nul terminated string > > + * > > + * @ctx in a nul terminated string. > > + * (strlen(@ctx) < @ctx_len) is always true. > > + * (strlen(@ctx) == @ctx_len + 1) is not guaranteed. > > + */ > > +struct lsm_ctx { > > + __u32 id; > > + __u64 flags; > > + __kernel_size_t ctx_len; > > + __u8 ctx[]; > > +}; > > I think this should be changed to be the same layout on > all architectures regardless of __u64 alignment and > sizeof(__kernel_size_t) differences, to avoid the need > for compat syscalls and explicit clearing of the > internal padding. > > Maybe just use __u64 fields for all three integers? I have no problem with that ... the ctx[] field is variable length anyway so keeping it as a __u8 should be fine. -- paul-moore.com