Received: by 2002:a05:7412:b995:b0:f9:9502:5bb8 with SMTP id it21csp1332511rdb; Sat, 23 Dec 2023 02:50:17 -0800 (PST) X-Google-Smtp-Source: AGHT+IElHze5mTP6EkzWH05qInYyJ109x4EaWqINFoMupf9PZqK+Ne51FpKXfGgeqODn0OH/MXnd X-Received: by 2002:a05:6e02:15cb:b0:35d:59a2:929f with SMTP id q11-20020a056e0215cb00b0035d59a2929fmr3794990ilu.51.1703328617647; Sat, 23 Dec 2023 02:50:17 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1703328617; cv=none; d=google.com; s=arc-20160816; b=GA7u8utmoS2KSyujmayVaS/WKme2GqvZVlEwQc2QEo55qUTcs1tyD3zI07rLXwROeW qX//xP4kZ+wfl68I8aW2e2EtbecFPlEF9GTCKYIzEYWVkjmAhc3XF/qithO3/C9Mmoik /MMq7WR+I3VyPFITcHxN/4VwkLg4aNb2AvCrMqyC+MkJDLNol2+y3h94WWt7R/I6Aywc JlVI4oA4BFrFvycxVeKjI/CmKWdFr3BQKlkRn2JV44SJLkLDfX+A4+86mnxjSoWJDh6f M3WJwgqKUoOjlpOpNvjt8cfFinsafZcrLJjbNVJUug2hj0HoZ0C3shu4RFKyvYT4wiWh I0UQ== ARC-Message-Signature: i=1; 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; bh=nO274NdYxTb3U2qVXrAc1vVEKZ9homW2ie2yZp0xhZA=; fh=StIzC5JH7qvu2v4P6Z0rmy/yTvdFBdC5lmsgUnz0Wd4=; b=GsYXvIGpZoZc/XuNMm/Jj5srX22pmYDK9Nz0fIxMNxW4ghnwEaaDPlYoyIqhTS1kyi l87ESo6P0lWTkm6yQWaHHr4xmJjsHSYckcxrdwEGZayXc9wQnLiBjj9MWgiJta3xQAWg v+ebR/gymk77dZVUJNnZpsNWNUYUhtPDD8AfUGeGRT9dEn36dr04w8e6zawPbN2iupeH P/V0AgQef//kP69RruNHUqBptsSsb2Y/TOq0fdvaWdFjacbnHpfNsamhrIVEtDKQ8Cb3 31D5iCCUQ1tsziMWC3ufT+yCBRVObsw5YzY+93G9as2yvZ1iejZYclJ+9w8qGILLf0U2 DxPQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel+bounces-10385-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-10385-linux.lists.archive=gmail.com@vger.kernel.org" Return-Path: Received: from sy.mirrors.kernel.org (sy.mirrors.kernel.org. [2604:1380:40f1:3f00::1]) by mx.google.com with ESMTPS id cm8-20020a056a020a0800b005cd9ebd3b36si4809375pgb.280.2023.12.23.02.50.17 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 23 Dec 2023 02:50:17 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-10385-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) client-ip=2604:1380:40f1:3f00::1; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel+bounces-10385-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-10385-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 sy.mirrors.kernel.org (Postfix) with ESMTPS id 5F1DBB22BEC for ; Sat, 23 Dec 2023 10:49:41 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id A05BACA63; Sat, 23 Dec 2023 10:49:28 +0000 (UTC) X-Original-To: linux-kernel@vger.kernel.org Received: from www262.sakura.ne.jp (www262.sakura.ne.jp [202.181.97.72]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 2B149C146; Sat, 23 Dec 2023 10:49:25 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=I-love.SAKURA.ne.jp Authentication-Results: smtp.subspace.kernel.org; spf=none smtp.mailfrom=I-love.SAKURA.ne.jp Received: from fsav118.sakura.ne.jp (fsav118.sakura.ne.jp [27.133.134.245]) by www262.sakura.ne.jp (8.15.2/8.15.2) with ESMTP id 3BNAn08D044013; Sat, 23 Dec 2023 19:49:00 +0900 (JST) (envelope-from penguin-kernel@I-love.SAKURA.ne.jp) Received: from www262.sakura.ne.jp (202.181.97.72) by fsav118.sakura.ne.jp (F-Secure/fsigk_smtp/550/fsav118.sakura.ne.jp); Sat, 23 Dec 2023 19:49:00 +0900 (JST) X-Virus-Status: clean(F-Secure/fsigk_smtp/550/fsav118.sakura.ne.jp) Received: from [192.168.1.6] (M106072142033.v4.enabler.ne.jp [106.72.142.33]) (authenticated bits=0) by www262.sakura.ne.jp (8.15.2/8.15.2) with ESMTPSA id 3BNAmxMY044008 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=NO); Sat, 23 Dec 2023 19:48:59 +0900 (JST) (envelope-from penguin-kernel@I-love.SAKURA.ne.jp) Message-ID: <57ce7089-37c7-44c5-a9da-5a6f02794c42@I-love.SAKURA.ne.jp> Date: Sat, 23 Dec 2023 19:48:58 +0900 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] security: new security_file_ioctl_compat() hook Content-Language: en-US To: Paul Moore , Alfred Piccioni Cc: Stephen Smalley , Eric Paris , linux-security-module@vger.kernel.org, linux-fsdevel@vger.kernel.org, stable@vger.kernel.org, selinux@vger.kernel.org, linux-kernel@vger.kernel.org, Casey Schaufler References: <20230906102557.3432236-1-alpic@google.com> <20231219090909.2827497-1-alpic@google.com> From: Tetsuo Handa In-Reply-To: Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit On 2023/12/23 10:23, Paul Moore wrote: >> - /* RED-PEN how should LSM module know it's handling 32bit? */ >> - error = security_file_ioctl(f.file, cmd, arg); >> + error = security_file_ioctl_compat(f.file, cmd, arg); >> if (error) >> goto out; > > This is interesting ... if you look at the normal ioctl() syscall > definition in the kernel you see 'ioctl(unsigned int fd, unsigned int > cmd, unsigned long arg)' and if you look at the compat definition you > see 'ioctl(unsigned int fd, unsigned int cmd, compat_ulong_t arg)'. I > was expecting the second parameter, @cmd, to be a long type in the > normal definition, but it is an int type in both cases. It looks like > it has been that way long enough that it is correct, but I'm a little > lost ... Since @arg might be a pointer to some struct, @arg needs to use a long type. But @cmd can remain 32bits for both 32bits/64bits kernels because @cmd is not a pointer, can't it? > I agree that it looks like Smack and TOMOYO should be fine, but I > would like to hear from Casey and Tetsuo to confirm. Fine for TOMOYO part, for TOMOYO treats @cmd as an integer.