From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-pj1-f41.google.com (mail-pj1-f41.google.com [209.85.216.41]) (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 C68A720C00A for ; Mon, 17 Nov 2025 23:14:18 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.216.41 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1763421260; cv=none; b=G2VUFeL/Wx4r3pwaft787acTz3y6Do9+1Oaj+Qz2xsSmTb2svZN6NcF94a6G1V48rWpHGXnvc2WrGJLiUUv/+L3WGS8v273hyWi7LoKdocaR+N8HnPr+AVPtZN2BocXiZLaQCBpmSVEJp/7tlgnfRlQur5kV3J6HybfyXZ96CRk= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1763421260; c=relaxed/simple; bh=jLB6moYbYMb4oAt4L/H5f9WgTTkiluQ2AcY7gkr6Zto=; h=Message-ID:Date:MIME-Version:Subject:To:Cc:References:From: In-Reply-To:Content-Type; b=C3qiHyKr6OlTQCYL44RZn0jNCmjNrDt3IsFKxc9yvgomn7P92KwGEmLlBx6k90aPeGdaqSBdzJyJVEhRSlf+AmCb3rGoBBHGVKo/3RmfFlBOsMI8kSJIhEE4gpQvxpGf783hbxINUHWYB8xiO/8EqgcaL1Zb1Wq71ikVyBw2Ezw= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=Zf7ZWK29; arc=none smtp.client-ip=209.85.216.41 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="Zf7ZWK29" Received: by mail-pj1-f41.google.com with SMTP id 98e67ed59e1d1-3436d6aa66dso4446308a91.1 for ; Mon, 17 Nov 2025 15:14:18 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1763421258; x=1764026058; darn=vger.kernel.org; h=content-transfer-encoding:in-reply-to:from:content-language :references:cc:to:subject:user-agent:mime-version:date:message-id :from:to:cc:subject:date:message-id:reply-to; bh=gw3njvl4GlvyJ/wTccdCvKwGIk1Y/4IXwJ5Yzybhm6A=; b=Zf7ZWK29FvjMzqqgoqoV039edblR7BYIES72/9pWRuN4UwxmhZYZrrTJs2D3fFM+HF 6j4BUaNMF4dgHM9t1PlMSM1DYgZdYz5YMHUjAT4wA5D/XjeZ4V7VdO3jAWcoICW3dsaq fJALnhZopGDIcNgrXnnXOIGvNoYagsEO1yCSGLq1madw6SjUNJ5t7aPOkispbh8t2y+p L+328/dARx4hjokvM/rmXdqs6+iovVZJeBIQKm8qpeR/nH2pqljAkx5gp83XatD3eRNF OMGVw4KmuuANZqO6vJkMxSP6Fq8d3SMeRyq4LxptXZsf9+a+0FFTW5UlY5jFuj7MqmyZ AwOw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1763421258; x=1764026058; h=content-transfer-encoding:in-reply-to:from:content-language :references:cc:to:subject:user-agent:mime-version:date:message-id :x-gm-gg:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=gw3njvl4GlvyJ/wTccdCvKwGIk1Y/4IXwJ5Yzybhm6A=; b=EVxE2LZ7BzLqDIwuLvXn9aQ8jVStTuRBsmW4Tv1PokoNKnjvJnMP7M2M80dFtjjEb6 eg43qHY3ocSCvSyUqVBv3d6gZSFN8FunfbrFqBKpLjAC2Em1sg04vL72qdsevowx2D0Y vDL0p/qHbNYfU7auLLWfyIMtakjKb8y4mMt5O6465OPH4IRo1iwawyDhoIMzE6zYZDo8 mGYC7VoTGKMOUHwA8NWKcqDyL1r3B2ocy2Asemz+TWiiNkYthC28HopImng+cg+jBiXj UNKm1ZRCFNP4rYP0C2FHo1UBlv6TN5CLg5XDz5/JqjlC9d3sWcACWSZRJBeKIjAzBhob sCEg== X-Forwarded-Encrypted: i=1; AJvYcCVucTjfazf1ZWUwb1PPPhwefhFJG0Lf5q6QyBhhChq26LIkRMZ2rZyym5OdGEeM+w3zeyFeMiAkuT8FxwQ=@vger.kernel.org X-Gm-Message-State: AOJu0YwLkapY2HffnPXZW+tSjVtzTJHsw4vUoIjKHKd9mBJGGAzWUYoI WQspmm82I+1sCCFBB6QRFf4+9vqVlzOElsCkxGUjb2Ix2D2VKnStrNk6 X-Gm-Gg: ASbGncuvqNp02lMRFNXjVmkM1nf4fhvsTcHlDFOokP79SlEcAr7ufioQS2NHURdPJer IEwsnx0Q66wvVnBMQnyCQqxmDihBcJsIzjYsEIeFTIwAkSpAt/57BVU4TdeP0pemjiuXpq83Rjg HoMwQC1VMumTNxd7oinz005AB+CpMsvqNXK6WOHMGWKfiXZyRCgjPCHiH6gPPeC6x17PQ4ZvBTI TigFhLcjkyr8rdXBp1qXNqq0Ri9ppXx+7I6XSlBVjqQ7lteQG9TFMtIqCoKWUJ8jaN4XUTvW8LH j/m838Fmo5gnvSYXmASxIuIJoqeNS50vueLZqs7MiJ0V2QZnAllSZBIwB0QZqDCHlVjMypVT0Rv WmhMkiee7+E6yOaTy9JyfeXiQwv4oCz4M1C2KxBrJDgCrZWaJ0lc9uiIvp4d3Ck+huf/r4IN+2F LI/pNof72aRhCJARCUtrsQ8Vwaex4acc7piISwi62fAzxvitlNqmYiRKMlkssryn848g7M0TBBo SEqnPXkSKzB0ncQdELZC8A= X-Google-Smtp-Source: AGHT+IF1tvlGKX9DV9wAYY9ohHIZYvMdnoK1lO9GjrIKyerueMKm+3JylDBqlzjP5QGSHI71zrZ2rg== X-Received: by 2002:a17:90b:48ca:b0:340:9d78:59 with SMTP id 98e67ed59e1d1-345aebaa733mr961168a91.3.1763421258083; Mon, 17 Nov 2025 15:14:18 -0800 (PST) Received: from ?IPV6:2001:df0:0:200c:3c0b:485c:47:857e? ([2001:df0:0:200c:3c0b:485c:47:857e]) by smtp.gmail.com with ESMTPSA id 98e67ed59e1d1-345651183b2sm10773227a91.2.2025.11.17.15.14.15 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Mon, 17 Nov 2025 15:14:17 -0800 (PST) Message-ID: <292be779-a36b-49b5-a9b0-9a5aa222fd0c@gmail.com> Date: Tue, 18 Nov 2025 12:14:12 +1300 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] m68k: Implement kernel memory protection To: Daniel Palmer Cc: Greg Ungerer , geert@linux-m68k.org, linux-m68k@lists.linux-m68k.org, linux-kernel@vger.kernel.org References: <20251116220508.1513445-1-daniel@thingy.jp> <126822f3-6f11-d02d-43f8-1b5e6bcc910a@gmail.com> Content-Language: en-US From: Michael Schmitz In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit Daniel, it might be possible to fix up the last (partially used) descriptor from C code, if there's a limit field. I find the head.S assembly too much of a headache to change, but that would certainly be safer. Wasting up to 256 kB is a pain on 030. Maybe rather skip protecting the last section? (* ducks ... *) Cheers,     Michael On 18/11/25 11:01, Daniel Palmer wrote: > Hi Michael, > > On Tue, 18 Nov 2025 at 02:41, Michael Schmitz wrote: >> Daniel, >> >> take a look at arch/m68k/kernel/head.S - 030 MMU setup uses early >> termination descriptors for kernel memory, _not_ regular page tables. > Yeah, so when setting write protect on the last bit of either the text > or the rodata the end is getting rounded up to the next 256KB and > write protecting too much. > I worked that out and adding some alignment in the linker script so > that everything after the places getting write protected is pushed off > to the next 256KB does fix it but wastes some memory. > Looking at the manual for the 68030 it seems like early termination > descriptors can have a limit so I could set the alignment, fix up the > limit and then give the wasted memory back. But we are using the short > format that doesn't have the limit field. > > Cheers, > > Daniel