Received: by 2002:a05:6358:9144:b0:117:f937:c515 with SMTP id r4csp1875553rwr; Sat, 6 May 2023 00:10:13 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ584SgIvfJ5VBR6Mv26sGu6r2JKmldXF8q+CYnQiaZJ2Hm9E6RuBuAht2jmyBLao6VdLuuU X-Received: by 2002:a05:6a00:2443:b0:624:7c9a:c832 with SMTP id d3-20020a056a00244300b006247c9ac832mr5186094pfj.8.1683357012911; Sat, 06 May 2023 00:10:12 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1683357012; cv=none; d=google.com; s=arc-20160816; b=eaQMjsOe0HLuSZyokOOkxQSvpWtNtFNXiMI4mr4xVsx7PJG2BS+vtIyAXPnx9YuY+e leZWGWLVcZLk/T2l+tqmS6p0eYo5uGOTfz2evkxa7JkriODPYdrSJroGfZZsAaxkhN+2 JS88FleCMzunWvDYTONj+W/Cvpv9hrYio6qIobd4kRobCIig/PReMuYglQzAay6QefOm ELB6E4lsLPo4XRfQej1kh3uSzXN65B5wTdS6GvBtAm+MEdDyTNd3W40Hicejm5Z4Dy9O fjpJuKITJ+EgJRpTS49eoaGA2arNFG19N5S6oob578jq+ET6vYShS/vH5Ti4KbaPBd3c GDWg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:cc:to:subject :message-id:date:from:in-reply-to:references:mime-version; bh=EhbgMUmTJXxYe3/c6hGUtkt83U4lhPLFJ59opdCa2BE=; b=WzUyE62K/T5znZGEnb/ln7dSY4TaH3R5W5L4c+a1UMtdzAKApEoYZbnpLqMBZY5rmi HJGFnjs4b3Dvy0ucA2gzy8MUQdyAG1GC3od3GoLEkMj7cHGeWlIR4fydfJCnw76QYjZ4 V3IcfST5WYk2s1Y/QJluGRsPNIbb52gaje7XBCbRtUNWqfEy3YepvzlvL4QKRPqvhCh2 iDypVIbnIcokRf0IqVj3GB2EvNf0UDelLc66oqE+5gFaSggGrNXW//na8wM1q3SCxK8a odk2S80Ne/VsUq+oRr80WVCdyCURvwgjvjuqujLTSRlom83ZyVnwPCDk221hLh8TbHMf lTPQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id n7-20020a6543c7000000b00517d98ef258si3687072pgp.2.2023.05.06.00.09.59; Sat, 06 May 2023 00:10:12 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229947AbjEFHHT convert rfc822-to-8bit (ORCPT + 99 others); Sat, 6 May 2023 03:07:19 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57636 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229472AbjEFHHS (ORCPT ); Sat, 6 May 2023 03:07:18 -0400 X-Greylist: delayed 135 seconds by postgrey-1.37 at lindbergh.monkeyblade.net; Sat, 06 May 2023 00:07:16 PDT Received: from p3plsmtpa07-08.prod.phx3.secureserver.net (p3plsmtpa07-08.prod.phx3.secureserver.net [173.201.192.237]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 79A1A59FF for ; Sat, 6 May 2023 00:07:16 -0700 (PDT) Received: from mail-ej1-f54.google.com ([209.85.218.54]) by :SMTPAUTH: with ESMTPSA id vByVpxAjerKprvByWpoiPS; Sat, 06 May 2023 00:05:00 -0700 X-CMAE-Analysis: v=2.4 cv=U+5UT8nu c=1 sm=1 tr=0 ts=6455fc1c a=P7SCm5FBaGkOUgmNSK28lg==:117 a=IkcTkHD0fZMA:10 a=P0xRbXHiH_UA:10 a=xVhDTqbCAAAA:8 a=20KFwNOVAAAA:8 a=rDwt1Zk6MRkbpbuKzqYA:9 a=QEXdDO2ut3YA:10 a=GrmWmAYt4dzCMttCBZOh:22 X-SECURESERVER-ACCT: kaiwan@kaiwantech.com Received: by mail-ej1-f54.google.com with SMTP id a640c23a62f3a-965ab8ed1fcso461949766b.2; Sat, 06 May 2023 00:04:59 -0700 (PDT) X-Gm-Message-State: AC+VfDwcLV1Z38hwh05MO+Nm0W6u2B1VnIg3W2krWN3xEFmrLOfW+R11 H5I7dOG/DBve7QNgqDW7XfWntMfUQNWOD7YA06M= X-Received: by 2002:a17:907:70a:b0:953:9024:1b50 with SMTP id xb10-20020a170907070a00b0095390241b50mr2753174ejb.74.1683356699105; Sat, 06 May 2023 00:04:59 -0700 (PDT) MIME-Version: 1.0 References: <20230504213002.56803-1-michael.mccracken@gmail.com> <87pm7f9q3q.fsf@gentoo.org> In-Reply-To: From: Kaiwan N Billimoria Date: Sat, 6 May 2023 12:34:41 +0530 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [PATCH] sysctl: add config to make randomize_va_space RO To: Paul Moore Cc: David Hildenbrand , Sam James , Michael McCracken , linux-kernel@vger.kernel.org, serge@hallyn.com, tycho@tycho.pizza, Luis Chamberlain , Kees Cook , Iurii Zaikin , Andrew Morton , linux-fsdevel@vger.kernel.org, linux-mm@kvack.org, kernel-hardening@lists.openwall.com Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: 8BIT X-CMAE-Envelope: MS4xfOLF0OZGXs3zvdVu+45H+IY/2xijwTZGNs1nUXkYlr5TVDia0ayb8+MrvWSJDiz1EW9wFDwiThMzy3bcVc828R0VhIs10KxHnf5OCbhAVmORWYG/glGC e5JvmmbrELQ7y1G9q7SNzcUgJ8vxydd0GzcOIcSAtB3UFvkQK7RHMtX91ow3BCitIVVQiXF6jctF10v+tCrwkqm8UpdJI2Er8jdAzu6zM53FmqE50nJxDqfj 9C+dN12HSuMemXaDfYQV28HuYiyQPV7G0HtugajIllk= X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H3,RCVD_IN_MSPIKE_WL,SPF_HELO_NONE,SPF_PASS, T_SCC_BODY_TEXT_LINE,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, May 5, 2023 at 8:53 PM Paul Moore wrote: > > On Fri, May 5, 2023 at 11:15 AM David Hildenbrand wrote: > > On 05.05.23 09:46, Sam James wrote: > > > David Hildenbrand writes: > > >> On 04.05.23 23:30, Michael McCracken wrote: > > >>> Add config RO_RANDMAP_SYSCTL to set the mode of the randomize_va_space > > >>> sysctl to 0444 to disallow all runtime changes. This will prevent > > >>> accidental changing of this value by a root service. > > >>> The config is disabled by default to avoid surprises. > > ... > > > If we really care, not sure what's better: maybe we want to disallow > > disabling it only in a security lockdown kernel? > > If we're bringing up the idea of Lockdown, controlling access to > randomize_va_space is possible with the use of LSMs. One could easily > remove write access to randomize_va_space, even for tasks running as > root. IMO, don't _move_ the sysctl to LSM(s). There are legitimate scenarios (typically debugging) where root needs to disable/enable ASLR. I think the key thing is the file ownership; being root-writable takes care of security concerns... (as David says, if root screws around we can't do much).. If one argues for changing the mode from 0644 to 0444, what prevents all the other dozens of sysctls - owned by root mind you - from not wanting the same treatment? Where does one draw the line? - Kaiwan. > > (On my Rawhide system with SELinux enabled) > % ls -Z /proc/sys/kernel/randomize_va_space > system_u:object_r:proc_security_t:s0 /proc/sys/kernel/randomize_va_space > > -- > paul-moore.com