Received: by 2002:a05:6358:3188:b0:123:57c1:9b43 with SMTP id q8csp22731060rwd; Fri, 30 Jun 2023 11:47:10 -0700 (PDT) X-Google-Smtp-Source: APBJJlFQ0hWCMdu8KSEcK46awwN6RJ02OLTw2MyspxQPZ5UqY8lPVvqrh20y5DDwPA6pzB0nSFeF X-Received: by 2002:a05:6a00:1491:b0:668:69fa:f791 with SMTP id v17-20020a056a00149100b0066869faf791mr4149379pfu.3.1688150829846; Fri, 30 Jun 2023 11:47:09 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1688150829; cv=none; d=google.com; s=arc-20160816; b=k98sunJXdtcxs7x0s7sd1vEukdi2Hxlc4l6mLW+KBQJYxztBtapNW4qGU3Bf+8v8i2 +jbBfCBVST893PuQhTBDKGD+un6ue/zu5ZIWqSWNek1NXwUJldV2fn0o/ZdH1sS4zjIv ilTc2f7EA2aJkCw9Ty9BPO0GNsFxaqxJTbHsDqdsB2PvRe/9js5s/K6/Xu6zGvxEieEY 8d+iBP0+0Cu91oOJ6fu1Zv6dtXZ69HGwbjZQ07O0sXgv8isqM9A27+y+HEzW8ZGx6nHc VFidhZtSMMeYrhMHzSucgKy2yN+Onlx8I+bXjvQeuRdaWKDEf5zXJMT+B3qLfO+P9t1Y di9Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:cc:to:subject :message-id:date:from:in-reply-to:references:mime-version :dkim-signature; bh=KpanYO+njUHDnpXmj2VuqKr1DpWx0gxhRp5S2Jn8NmM=; fh=EvxfZTJQv75NFm7oOzdkf+/2YXeB3Sry3PLa06ZIxk8=; b=veC4m5SvL9rlE989aCEHCbHV3Utt1kdMUUeePr8AezKzbUvW46/Ukh5bYtkiz1SOCG LRKGCBhdQjYfP8Wrir2M0ovXjBrR0U14CJxmW2WJIotHrxruED+838BhhQdCAuaR8NQo yPIpyr/Hk6jVZgHJgqM4duaKYpaY0+hxKLsEYS8Wh3N2LBaWGXDM0yUNQqpZ5/UYLZoI UXjXl8rOjHCr4YtfYn0t+OIB2HjisrifcHsj1GK/yHi0gOOKvSG9lb9zG2nssXNKFAIv mg9YVXyeSyKvv6aqElWnrUW78dazKArQtWg1dlNh9cqocT+HemXdGiq6yraaIL3tpnZB Kd9w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@paul-moore.com header.s=google header.b=O+mM9iYT; 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 cw25-20020a056a00451900b0067170d3afa0si11180055pfb.339.2023.06.30.11.46.56; Fri, 30 Jun 2023 11:47:09 -0700 (PDT) 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=O+mM9iYT; 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 S233029AbjF3SX6 (ORCPT + 99 others); Fri, 30 Jun 2023 14:23:58 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36722 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233050AbjF3SX5 (ORCPT ); Fri, 30 Jun 2023 14:23:57 -0400 Received: from mail-yw1-x1134.google.com (mail-yw1-x1134.google.com [IPv6:2607:f8b0:4864:20::1134]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6B69B125 for ; Fri, 30 Jun 2023 11:23:55 -0700 (PDT) Received: by mail-yw1-x1134.google.com with SMTP id 00721157ae682-577497ec6c6so9771587b3.2 for ; Fri, 30 Jun 2023 11:23:55 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=paul-moore.com; s=google; t=1688149434; x=1690741434; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=KpanYO+njUHDnpXmj2VuqKr1DpWx0gxhRp5S2Jn8NmM=; b=O+mM9iYTY5FKs8ty8E+sASu8k6bFdDWGMJHfwiKHmu0XBGq1S+MkrDfB9Ogr2GrOqF E+ZECtHrX7btdzdRBWAoZ83uKFfUmCF5fE6nQF2PA0rsxHGtYF/OQThgFAumiRsoEwCr hAU0X2gyVrX28M0OtQDZuUC9P1BAz+aI4S4z/WzS7ac9R3XZQwUViOjsu7ezwK2IfEKU QFOYAiaDIUJ3Q7h2+ctCY9zA2hJFQ1NvvFIuuizCR3XnVALA88xtgPL/cFNunhUJDkuN Jp0ZT6EvPN+EmooNbZc3VXjRhqP3CWSh76vSXQrbHRC7CKJsOkURKI56iAGHEh6m73tp ddAw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1688149434; x=1690741434; h=content-transfer-encoding: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=KpanYO+njUHDnpXmj2VuqKr1DpWx0gxhRp5S2Jn8NmM=; b=amUna8SO4G4RLxcnChOZ9o+/w3OYPdgOEX67qO2YaZurtHcv7USgIYY6wtMbP1tUof hr3DhM0oBIv9MNuwvVem9tBMM2UreuoGfnEp8nTkml2QAU4skBU7GP0DqpfA0YwYR77+ TTW6U+BDehd4iR+Wxm8ppSGPWGsr/sXxUrcMe8TVbzmkx3nOItxEtRLLM9aWcv2GMuUd 76qgiIZ2z/WNKM8u0OQRQczPQFDwRmqZiKNTfKYuYOD4Wr/P2F48syjFLksfmnRSH+n4 hHb4DIFhmjnI6oxjhPan9V5cpesFY4s1u+39A/7nZ0Oa8Auj19tWX6RHw10QQEEgp3EV 16Sw== X-Gm-Message-State: ABy/qLbt0lvwvO+Y5I7n6pscI/+Q3dSet8QJ7WktGZYh40Dr0jPujQOz r6HiU0b6BULs5B5NQRGZ70RHFcr+o80MHc2dLz8Ozkp+1WyPNcc= X-Received: by 2002:a25:6906:0:b0:ba8:2009:ccbb with SMTP id e6-20020a256906000000b00ba82009ccbbmr3731761ybc.46.1688149434576; Fri, 30 Jun 2023 11:23:54 -0700 (PDT) MIME-Version: 1.0 References: <20230629195535.2590-8-casey@schaufler-ca.com> In-Reply-To: From: Paul Moore Date: Fri, 30 Jun 2023 14:23:43 -0400 Message-ID: Subject: Re: [PATCH v12 7/11] LSM: Helpers for attribute names and filling lsm_ctx To: Casey Schaufler Cc: linux-security-module@vger.kernel.org, jmorris@namei.org, serge@hallyn.com, keescook@chromium.org, john.johansen@canonical.com, penguin-kernel@i-love.sakura.ne.jp, 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" Content-Transfer-Encoding: quoted-printable 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,T_SCC_BODY_TEXT_LINE,URIBL_BLOCKED autolearn=unavailable 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 Fri, Jun 30, 2023 at 1:11=E2=80=AFPM Casey Schaufler wrote: > > On 6/29/2023 7:14 PM, Paul Moore wrote: > > On Jun 29, 2023 Casey Schaufler wrote: > >> Add lsm_name_to_attr(), which translates a text string to a > >> LSM_ATTR value if one is available. > >> > >> Add lsm_fill_user_ctx(), which fills a struct lsm_ctx, including > >> the trailing attribute value. > >> > >> All are used in module specific components of LSM system calls. > >> > >> Signed-off-by: Casey Schaufler > >> Reviewed-by: Serge Hallyn > >> --- > >> include/linux/security.h | 14 +++++++++++++ > >> security/lsm_syscalls.c | 24 ++++++++++++++++++++++ > >> security/security.c | 44 +++++++++++++++++++++++++++++++++++++++= + > >> 3 files changed, 82 insertions(+) > > .. > > > >> diff --git a/security/security.c b/security/security.c > >> index 199db23581f1..72ad7197b2c9 100644 > >> --- a/security/security.c > >> +++ b/security/security.c > >> @@ -770,6 +770,50 @@ static int lsm_superblock_alloc(struct super_bloc= k *sb) > >> return 0; > >> } > >> > >> +/** > >> + * lsm_fill_user_ctx - Fill a user space lsm_ctx structure > >> + * @ctx: an LSM context to be filled > >> + * @context: the new context value > >> + * @context_size: the size of the new context value > >> + * @id: LSM id > >> + * @flags: LSM defined flags > >> + * > >> + * Fill all of the fields in a user space lsm_ctx structure. > >> + * Caller is assumed to have verified that @ctx has enough space > >> + * for @context. > >> + * > >> + * The total length is padded to a multiple of 64 bits to > >> + * accomodate possible alignment issues. > > We should drop the sentence above now that alignment is the caller's > > responsibility, but since that was largely my fault I can fix this up > > during the merge assuming you're okay with that Casey. > > I have to fix the error in patch 8/11 anyway. I can fix this, too. Great, thanks. --=20 paul-moore.com