Received: by 2002:ab2:710b:0:b0:1ef:a325:1205 with SMTP id z11csp1308660lql; Tue, 12 Mar 2024 13:11:22 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCVgNSgMAv/ruWxODcmE+o5PwAYb31wbS5CjQSUF8Rp6Hnc/TK3x5p11x3xiG9yLtgqHoF4ltGdGMZG0qOzIyBlhQVsJskQ80dcmoqwSfg== X-Google-Smtp-Source: AGHT+IHJOxCwJy7RpowH7isATF2LYT2F1HQvImybUz0HQtPfeXgQVjGiIGKbE9ybnBc5/x45ogWl X-Received: by 2002:a0c:cdc2:0:b0:690:c7a5:1dc9 with SMTP id a2-20020a0ccdc2000000b00690c7a51dc9mr3350522qvn.42.1710274282690; Tue, 12 Mar 2024 13:11:22 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1710274282; cv=pass; d=google.com; s=arc-20160816; b=cmV/eyQfZzgbE3o0jN0/ThypFn/82QeqsKIFNN55ErpsAcmBm1eJYb5l4IaqzbEbss GYa2lYBHpCRfBLEcmesB5sJ6P5f2rhiM1QK9v4Ls/4qqnJp+N0izL0slu6Gtssi06RzO 6oohiXpqfTV+46MkNY8eivcZWjxeHQM2T9voLaYL6yXV+yS0Pq/LaxWOIBAkYjppqFSX 7ZS44Dr98nyPhVBztIAryK6bRHRHgshhRetPNH5rRtAh9uff8NVqAxdUXXd6yWRabr2r kig2kvGQziJHnDU2qpwhQJfVjvNac9wr4m09lK6ods9ratyVvEZxKTcDlpnVOxgZIfnn RUiA== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:in-reply-to:from:references:cc:to :content-language:subject:user-agent:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:date:message-id:dkim-signature; bh=5IOlws87NG5tmdrmnvfWLOgo38WKByqjjsAJfn5pzhc=; fh=DVtvw8plah5XwUJi6yZl9rnJdUuUglVwVxGl3zu0xMY=; b=gfORHFMupUb7/9tnsmUwbicdzUxytkHSv7pMC/Jt08cRt8bzE2j8xbZnaskDCkPUNV jxRGsXw/NdTv6D99D6rnq7zVg63qANFbJp7LtUDa7gniFrew2WdUNe+TiaEwtepW2d14 JgmpDCoxlQM/Yn3ervDFPzgLNVyprf6T8atI27bZcklTL/ZiRlmJiqE8xaUaVR3eVOmL SmzhFygxO6deZe3DAgtjMEv3Hpovs2r8e4gjwkmQtg4Fgav1Xg1Cqhj2xftnky8d1ODC TJkfFKcmvTbkS584ZwHNtDTRrMD53Vj+DhHOHGY62DSTwSv8TuX1dvFOI0oLi+nvY4Ny L0/A==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@yahoo.com header.s=s2048 header.b=GZt60d2e; arc=pass (i=1 dkim=pass dkdomain=yahoo.com); spf=pass (google.com: domain of linux-kernel+bounces-100618-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-100618-linux.lists.archive=gmail.com@vger.kernel.org" Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [147.75.199.223]) by mx.google.com with ESMTPS id 2-20020a0562140d4200b00690c73c1552si6990190qvr.562.2024.03.12.13.11.22 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 12 Mar 2024 13:11:22 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-100618-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) client-ip=147.75.199.223; Authentication-Results: mx.google.com; dkim=pass header.i=@yahoo.com header.s=s2048 header.b=GZt60d2e; arc=pass (i=1 dkim=pass dkdomain=yahoo.com); spf=pass (google.com: domain of linux-kernel+bounces-100618-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-100618-linux.lists.archive=gmail.com@vger.kernel.org" Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ny.mirrors.kernel.org (Postfix) with ESMTPS id DB70E1C215E5 for ; Tue, 12 Mar 2024 17:44:54 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 2ABD01386C1; Tue, 12 Mar 2024 17:44:49 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=yahoo.com header.i=@yahoo.com header.b="GZt60d2e" Received: from sonic306-27.consmr.mail.ne1.yahoo.com (sonic306-27.consmr.mail.ne1.yahoo.com [66.163.189.89]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 2B1401384B8 for ; Tue, 12 Mar 2024 17:44:44 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=66.163.189.89 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1710265488; cv=none; b=CX7p5AA5IxTBOREj7XOM3Wlwrnen+Fi6C0NXHJvdjreTzShsqJAlnioNGYO90pj7VijivV4e7Bf0mEIXRtUeYeaV8cSIUKRWqvPMvHb/A/0NSfDQpGObkq74q3MKjtLZMYeNf2ZDzuHNDyLuUT7vJixzqivXS8ufmSaKD5oE3bQ= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1710265488; c=relaxed/simple; bh=o9TiYG0Zc9byDG9zfXuLX03xTQqB+5mUXZC678l+X6c=; h=Message-ID:Date:MIME-Version:Subject:To:Cc:References:From: In-Reply-To:Content-Type; b=IEsO1N9fVBeN/Sxayg0+VtZ1mKGjeDNymX40QqNOWG3k31QECsqTpqeU7LdpiwrdXuqHIzSk7aJAeL0my9whgUmibFlTaOGygEZae27vEcUD5OUD4elhe8WH0kbNzp9bRcFVKb3aQwd2ZbYgWSko0Ut9aAve6endsL6dX2aGHs0= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=schaufler-ca.com; spf=none smtp.mailfrom=schaufler-ca.com; dkim=pass (2048-bit key) header.d=yahoo.com header.i=@yahoo.com header.b=GZt60d2e; arc=none smtp.client-ip=66.163.189.89 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=schaufler-ca.com Authentication-Results: smtp.subspace.kernel.org; spf=none smtp.mailfrom=schaufler-ca.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yahoo.com; s=s2048; t=1710265484; bh=5IOlws87NG5tmdrmnvfWLOgo38WKByqjjsAJfn5pzhc=; h=Date:Subject:To:Cc:References:From:In-Reply-To:From:Subject:Reply-To; b=GZt60d2eDMrQxQfY9Q8grtE/cs9DFN28tRLmKtfVgSJLQBkljFGLVGLzVGhblhoQ8VpvGKfSFWHg8JFA2o3FzFw/D2G8GdfX/0WpYC776xgRaBaRXEfF2Fuc0DVF9+aMZ8vR0+nsntGWDKYIbaLLQjY2gFbLIsOoGCkr3b1WjJPIJz+NUsGY2CBqQy6i8wmvINvAWH9mEkk94otchLr85h54Cvqk8KsMk4kvBp75nmXqB4+Xw8/lHVICZkgqQwem0K9g7rtz2hcKe8Kv9uBQddWnL+As6bwCDlASx8eYYUHJALCgYpV86HuDt/fAjOq1Ow6rAwH26aPikHYHNvPOhA== X-SONIC-DKIM-SIGN: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yahoo.com; s=s2048; t=1710265484; bh=kvZoNoQPqEzjnFJ/aEmJyxaS3QQI/lVoRfJy/T1H/9B=; h=X-Sonic-MF:Date:Subject:To:From:From:Subject; b=OQJAw8Hrk8POE+yMtExMByoDKN+zVqIaVPj0t8Ru9tkOdrhtTVK8BApwwqrzlOMoI1uTQCni/dNR71i6GAGWNnNWPZ2d/dhEYIDPSto1+yK0IdQc5RuG8XKFxRdHkhRgJ8XfLg5ukM7t/YwQGP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7fym5vaQ.8vfRgrYhVJo 5z1LtM3SNwcbCxIQaHDFxsHwvLBw8jfWLQiqak86QeJSC34OWYxxp9vT2idtXhgO_3RvlTy_yujM uY6UQm8G9MuGfmtDlxPZhVgknAqXsvGypGV04A9xjJd.BVLJfyuKknS3brVNNJY7myJZEfcLzYD7 gjMVCHudlaRz1YI9GnisO3BGpKZzrgEd4uQm3nL675vp17oi2x90Fk9XZuVTZAaxcrcViwRQ9LE4 O0oqfzKThAHy0Ok3Pse81DpG1kQ_ktJc2DaxfqWoQnoQ_q1vLs_wm.14Aqxc0CUg.uo0qHFMmtdA 6yBvmXM5VIwRONOMfNjqMu9vuTHScXh7ZFNQMYIDcrLPy1WB0hoKf8CKFWMe0U__ya1JWoNa5sUP fs6ACFN3r3D3YvA-- X-Sonic-MF: X-Sonic-ID: cc61f50f-88ad-4c85-965e-e8c63009379b Received: from sonic.gate.mail.ne1.yahoo.com by sonic306.consmr.mail.ne1.yahoo.com with HTTP; Tue, 12 Mar 2024 17:44:44 +0000 Received: by hermes--production-gq1-5c57879fdf-nxlqc (Yahoo Inc. Hermes SMTP Server) with ESMTPA ID 42b496c5feca52dd66810a39fac58910; Tue, 12 Mar 2024 17:44:40 +0000 (UTC) Message-ID: Date: Tue, 12 Mar 2024 10:44:38 -0700 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH v15 05/11] LSM: Create lsm_list_modules system call Content-Language: en-US To: Paul Moore Cc: "Dmitry V. Levin" , 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, Casey Schaufler References: <20230912205658.3432-1-casey@schaufler-ca.com> <20230912205658.3432-6-casey@schaufler-ca.com> <20240312101630.GA903@altlinux.org> From: Casey Schaufler In-Reply-To: Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Mailer: WebService/1.1.22129 mail.backend.jedi.jws.acl:role.jedi.acl.token.atz.jws.hermes.yahoo On 3/12/2024 10:06 AM, Paul Moore wrote: > On Tue, Mar 12, 2024 at 11:27 AM Casey Schaufler wrote: >> On 3/12/2024 6:25 AM, Paul Moore wrote: >>> On Tue, Mar 12, 2024 at 6:16 AM Dmitry V. Levin wrote: >>>> On Tue, Sep 12, 2023 at 01:56:50PM -0700, Casey Schaufler wrote: >>>> [...] >>>>> --- a/security/lsm_syscalls.c >>>>> +++ b/security/lsm_syscalls.c >>>>> @@ -55,3 +55,42 @@ SYSCALL_DEFINE4(lsm_get_self_attr, unsigned int, attr, struct lsm_ctx __user *, >>>>> { >>>>> return security_getselfattr(attr, ctx, size, flags); >>>>> } >>>>> + >>>>> +/** >>>>> + * sys_lsm_list_modules - Return a list of the active security modules >>>>> + * @ids: the LSM module ids >>>>> + * @size: pointer to size of @ids, updated on return >>>>> + * @flags: reserved for future use, must be zero >>>>> + * >>>>> + * Returns a list of the active LSM ids. On success this function >>>>> + * returns the number of @ids array elements. This value may be zero >>>>> + * if there are no LSMs active. If @size is insufficient to contain >>>>> + * the return data -E2BIG is returned and @size is set to the minimum >>>>> + * required size. In all other cases a negative value indicating the >>>>> + * error is returned. >>>>> + */ >>>>> +SYSCALL_DEFINE3(lsm_list_modules, u64 __user *, ids, size_t __user *, size, >>>>> + u32, flags) >>>> I'm sorry but the size of userspace size_t is different from the kernel one >>>> on 32-bit compat architectures. >>> D'oh, yes, thanks for pointing that out. It would have been nice to >>> have caught that before v6.8 was released, but I guess it's better >>> than later. >>> >>>> Looks like there has to be a COMPAT_SYSCALL_DEFINE3(lsm_list_modules, ..) >>>> now. Other two added lsm syscalls also have this issue. >>> Considering that Linux v6.8, and by extension these syscalls, are only >>> a few days old, I think I'd rather see us just modify the syscalls and >>> avoid the compat baggage. I'm going to be shocked if anyone has >>> shifted to using the new syscalls yet, and even if they have (!!), >>> moving from a "size_t" type to a "u64" should be mostly transparent >>> for the majority of native 64-bit systems. Those running the absolute >>> latest kernels on 32-bit systems with custom or bleeding edge >>> userspace *may* see a slight hiccup, but I think that user count is in >>> the single digits, if not zero. >>> >>> Let's fix this quickly with /size_t/u64/ in v6.8.1 and avoid the >>> compat shim if we can. >>> >>> Casey, do you have time to put together a patch for this (you should >>> fix the call chains below the syscalls too)? If not, please let me >>> know and I'll get a patch out ASAP. >> Grumble. Yes, I'll get right on it. > Great, thanks Casey. Look like lsm_get_self_attr() needs the same change. lsm_set_self_attr() doesn't, need it, but I'm tempted to change it as well for consistency. Thoughts? >