From mboxrd@z Thu Jan 1 00:00:00 1970 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 2B0F81272A4 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=1710265487; cv=none; b=H6XbmN05hpZWb3JXwJoMYy+ZK7lsyJvngoZcwdwqMFNDJ34vzSEze6ReTV8mKCQzjmrIWQD3AU7zA2yXgQspbCAWCx+tHTBSzCkFWFMrdu8PF2OX9jNGRdtoK2GE0HGmt6ntIwZvb833MLWD3LzQN/I306zFFrGb+X5123ysshk= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1710265487; c=relaxed/simple; bh=o9TiYG0Zc9byDG9zfXuLX03xTQqB+5mUXZC678l+X6c=; h=Message-ID:Date:MIME-Version:Subject:To:Cc:References:From: In-Reply-To:Content-Type; b=TczGtfVCXp+3joPLjtiO+KX3qq2uj9BuH6NYomZ0EbaIQnQIzXdexaeVzrko1TDCP2lAKIXzQEWF0nPs9GnSZAgWHGw5OVFk+Qeg52cVJhPQz1f+17ofYbd3kOK1AsKsIzCOP7xD4PXeG/PIUnnQGH2gBaLxLhwhPq4hSTG576k= 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 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=yahoo.com header.i=@yahoo.com header.b="GZt60d2e" 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/YwQGPu7EdoCy5zzdwXYZ7nKND1nIFD1tgOqgKeIHLvsJPegVbN36iyGZrHExa0pwxH+5GSzO6PyUBRHHahdYLWs+v8szbr00bbe2yKCYHkfmVy+H/fNA0bZAbh1wvC/1QmdtqJMKVXvZX7w1C+APzrCWkoyr9XX4VwFdqQrxEW/u0pDz3fj3xPe4KqGx16nV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nisO3BGpKZzrgEd4uQm3nL675vp17oi2x90Fk9XZuVTZAaxcrcViwRQ9LE4 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-security-module@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? >