From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-5.2 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS, USER_AGENT_SANE_1 autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id E3316C433E0 for ; Wed, 23 Dec 2020 07:53:51 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 9FF6A20759 for ; Wed, 23 Dec 2020 07:53:51 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727744AbgLWHxv (ORCPT ); Wed, 23 Dec 2020 02:53:51 -0500 Received: from verein.lst.de ([213.95.11.211]:33666 "EHLO verein.lst.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727050AbgLWHxu (ORCPT ); Wed, 23 Dec 2020 02:53:50 -0500 Received: by verein.lst.de (Postfix, from userid 2407) id A473667373; Wed, 23 Dec 2020 08:53:07 +0100 (CET) Date: Wed, 23 Dec 2020 08:53:07 +0100 From: Christoph Hellwig To: Tetsuo Handa Cc: Al Viro , "Eric W. Biederman" , Jens Axboe , Christoph Hellwig , Kees Cook , LKML Subject: Re: Does uaccess_kernel() work for detecting kernel thread? Message-ID: <20201223075307.GA4185@lst.de> References: <0bcc0c63-31a3-26fd-bccb-b28af0375c34@i-love.sakura.ne.jp> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <0bcc0c63-31a3-26fd-bccb-b28af0375c34@i-love.sakura.ne.jp> User-Agent: Mutt/1.5.17 (2007-11-01) Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, Dec 22, 2020 at 11:39:08PM +0900, Tetsuo Handa wrote: > For example, if uaccess_kernel() is "false" due to CONFIG_SET_FS=n, > isn't sg_check_file_access() failing to detect kernel context? sg_check_file_access does exactly the right thing - fail for all kernel threads as those can't support the magic it does. > For another example, if uaccess_kernel() is "false" due to CONFIG_SET_FS=n, > isn't TOMOYO unexpectedly checking permissions for socket operations? Can someone explain WTF TOMOYO is even doing there? A security module has absolutely no business checking what context it is called from, but must check the process credentials instead.