Received: by 2002:ac0:a5b6:0:0:0:0:0 with SMTP id m51-v6csp779118imm; Sat, 26 May 2018 10:53:50 -0700 (PDT) X-Google-Smtp-Source: AB8JxZpfUESUxmBFCZz4RMEUeE+RnUbTjMJtQpSn8mGescdBcSv8I2eAHd3fwOwKJeHleLHsyAIC X-Received: by 2002:a65:4586:: with SMTP id o6-v6mr5558751pgq.197.1527357230376; Sat, 26 May 2018 10:53:50 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1527357230; cv=none; d=google.com; s=arc-20160816; b=ylrjiEKA7ZQkOmURI7trK2op1gcxGTBZuFIV9t1cShiQvuMH5oh3BCFiYeBiIhMycI ig3Vn6esOhq9nzOo3lPlK1AciGWJcreyzofCgzHAEcH2/f/X93c8oGmUaDTQsfDG5IkB Wyxrs2TLwWcYicUmzyXoFb/MhzhUaFHmPaaoCFovn6Arz54o1pFAeZgBHgSg8axHrRjB X1nTzsfnXANmGVZIVlWmchC0xYe3UnQRypy0cJp4mLmo9lxH2MLo/DEAsbt5eV1nCNuG bnqmOzitjmqauCrNLWcx2cooF5OKdRA71DdlXKfcyaf2GjWTQwGUV3OzNwnJ8+e6miea fKnw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-language :content-transfer-encoding:in-reply-to:mime-version:user-agent:date :message-id:from:references:cc:to:subject:dkim-signature :arc-authentication-results; bh=hRstvVisTEdeWV/bbiAKoc47ub2C3obg11Tbqt+P8Gw=; b=oNfQDN9t7PVxCFvDQZF1jiRGkcySmFoSbBUz2RQpk9GB+79NyODFd2zn2UaUax9AX/ cdlF0eWOy4cjY+BbqO9VWG0Rbhf9HaHw4mDYknt2VYHeiw7WPpyLCgquwILXEYiOPZgY GMbtOOf3TYScHltpX9/JfXFJ2Ti7Fephbcj3qsWfeHzEWm7KkInreYTPuINR/Xy9LPzl qclmgY2tLQhRHtImztEgN0vKYJ6xG7MmMOfJQ+Y4+C5a1bHboiKo6t5ShEgw+oWi+R6F H5S58ngRL2FkMOQPya0Owx6n8bPAFzNPtPqbysJW0OCIElP1hn88QiR4jez5iVK9HBXu J7eA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@yahoo.com header.s=s2048 header.b=uDFYTvi5; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id l3-v6si6381538pgr.561.2018.05.26.10.53.23; Sat, 26 May 2018 10:53:50 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@yahoo.com header.s=s2048 header.b=uDFYTvi5; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1032277AbeEZRxN (ORCPT + 99 others); Sat, 26 May 2018 13:53:13 -0400 Received: from sonic313-26.consmr.mail.gq1.yahoo.com ([98.137.65.89]:43549 "EHLO sonic313-26.consmr.mail.gq1.yahoo.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1032112AbeEZRxM (ORCPT ); Sat, 26 May 2018 13:53:12 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yahoo.com; s=s2048; t=1527357191; bh=hRstvVisTEdeWV/bbiAKoc47ub2C3obg11Tbqt+P8Gw=; h=Subject:To:Cc:References:From:Date:In-Reply-To:From:Subject; b=uDFYTvi57RVQGh0h+YBCkWfAwjezTliuAx+vtQY9wC5qANR7PM2earRIaRCOaoy90fhIGxyYH5S5hw6PZ9hkT+rYu4pWsMUMIGypwA2cAwVH0UKNfEwJDYQIiFezi+IfgFIz6tB9tZV3C0HPLM8Nm0rTtnshpiO/2otRypRv1IEr1baRnS8oL59kgWoYbwstao2Zwr6jGcorgmwkU60H+0AnL5y6dIRm0ufi2OGbbA9gFwx2I5C1JkbuyIXTPSkPwisV6iWRDDbsb+R8cMr8uTd+pdZABPPk7X5BygWxHg/+s/Fn16YeNiCCfG3NPBTwT83dmHJg3E93bjPpp4UN2A== X-YMail-OSG: m4YGGE0VM1kyTL9g.lgw83ZLkNDly6unPNA5wpQnigdWflt3E2INhsmzPozvpfU if4pZ2Z_Hw.509sEPUOAd6sJFWblTz9L4LOuBlJPbYsrYmrpb2Mus37EXIvK8KhqmPwonrnmP0Dn dEooyyVH1F64d2_R0W8dIiz.tSaXLnmiNf.p.GDECkEb2TTdGpsoKmgwBNLbkNCbaTT2HahdzA56 faC.ywP8EQzmHEwsRdmayyQP5v.3vxznb9YfKGpTHrp6Q4XKNMy55e9lEedQYetO9_XmRhpaXQlo 7M_zvKqz7pMlrGrEmf.5bgQtYUUlLPGdVYlRicDqvfu0quLc_3SqJZZKaSIFsJPzGF12K6xj0KLz Sde2EQKzO4bA48HSUMddkduoqmUVVsD76nFam1PXPx7fzvJHpxlEd7uVN1pwQvLI4rVmKl6d7adT YesOos8E6eT4yZKQoEuyU7J2piseNmKwYXK2j12Jd2DQWZToC24OFkTdgtDZbHTB8cNpD5RExQUL Sh_Ra1Py.49lIflFARtkKx553wSsvn6PmpgvzZGX.PUN0YKtI9UP7sBZgzdT7BY1cF9x_9xUbVL6 kERr45UNAo5G65uvzsLdiOw7E.lQ9sT.JNvbuq17pWKN78ang1XLYBQb6aSPdwufKIFnP46cyFFs hbTBB.lkyDRvZ95s.6cpKu74KufaCxe2MfVo390t2UcF_lQM2SUckuFrxoX2e5U_MhZNLSByjcCO VfAxvw0O4LRpBNwpypwLnJAMrTSGPzg-- Received: from sonic.gate.mail.ne1.yahoo.com by sonic313.consmr.mail.gq1.yahoo.com with HTTP; Sat, 26 May 2018 17:53:11 +0000 Received: from c-67-169-65-224.hsd1.ca.comcast.net (EHLO [192.168.0.105]) ([67.169.65.224]) by smtp432.mail.gq1.yahoo.com (Oath Hermes SMTP Server) with ESMTPA ID ce1e5a53bcab6eb4bb3b3bd85fb78e14; Sat, 26 May 2018 17:53:06 +0000 (UTC) Subject: Re: [PATCH] proc: prevent a task from writing on its own /proc/*/mem To: Salvatore Mesoraca , Alexey Dobriyan Cc: Kernel Hardening , linux-security-module@vger.kernel.org, linux-kernel@vger.kernel.org, linux-mm@kvack.org, Andrew Morton , Akinobu Mita , Dmitry Vyukov , Arnd Bergmann , Davidlohr Bueso , Kees Cook References: <1527346246-1334-1-git-send-email-s.mesoraca16@gmail.com> <20180526154819.GA14016@avx2> From: Casey Schaufler Message-ID: Date: Sat, 26 May 2018 10:53:04 -0700 User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:52.0) Gecko/20100101 Thunderbird/52.8.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit Content-Language: en-US Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 5/26/2018 10:30 AM, Salvatore Mesoraca wrote: > 2018-05-26 17:48 GMT+02:00 Alexey Dobriyan : >> On Sat, May 26, 2018 at 04:50:46PM +0200, Salvatore Mesoraca wrote: >>> Prevent a task from opening, in "write" mode, any /proc/*/mem >>> file that operates on the task's mm. >>> /proc/*/mem is mainly a debugging means and, as such, it shouldn't >>> be used by the inspected process itself. >>> Current implementation always allow a task to access its own >>> /proc/*/mem file. >>> A process can use it to overwrite read-only memory, making >>> pointless the use of security_file_mprotect() or other ways to >>> enforce RO memory. >> You can do it in security_ptrace_access_check() > No, because that hook is skipped when mm == current->mm: > https://elixir.bootlin.com/linux/v4.17-rc6/source/kernel/fork.c#L1111 > >> or security_file_open() > This is true, but it looks a bit overkill to me, especially since many of > the macros/functions used to handle proc's files won't be in scope > for an external LSM. > Is there any particular reason why you prefer it done via LSM? If you did a Yama style LSM it would be easy to configure. Even though it might make no sense to allow this behavior, someone, somewhere is counting on it. > > Thank you, > > Salvatore > -- > To unsubscribe from this list: send the line "unsubscribe linux-security-module" in > the body of a message to majordomo@vger.kernel.org > More majordomo info at http://vger.kernel.org/majordomo-info.html >