Received: by 2002:a05:7412:8d1c:b0:fa:4c10:6cad with SMTP id bj28csp117413rdb; Tue, 16 Jan 2024 17:32:51 -0800 (PST) X-Google-Smtp-Source: AGHT+IFJSzQ/b8NQVlA2o6SnN6xMyxdg09Yvsmq2BLi4MNEhpxGULmV/n2m+vGmwg6vIe2Naz9+N X-Received: by 2002:a05:600c:4e8d:b0:40d:88c6:b9b with SMTP id f13-20020a05600c4e8d00b0040d88c60b9bmr4251911wmq.123.1705455171075; Tue, 16 Jan 2024 17:32:51 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1705455171; cv=pass; d=google.com; s=arc-20160816; b=t0ob11R1PjULdswvW7XeZvfvRjT6IxI06JCUv2baSKzGznTS2uRuz5A9Z2/jWSi206 plVWgjsefWzUKN17ljgCTA91R9nq1izFvB/QxvA5m+L72LjhTsA4b8fKZpPAxwC5lwYE 9k8ADBpHLKqPDgamwPYmnf0jCuTtgPxAlcN4/yZni2MfGaV+sLvuS+0ewRk2LYQPCUQj KL2C+DbVbR5RSAiRVndTeD5nF3DiV46e81T/ibD5uTokeRsNSxSjHOucSbhsI/kEOo1R ZXL1p3+jNWtfHuvcUOP2KgD4bTmroEMdO+4eeEurqN/5lClI2XyyUEdr8dBwUmlKa1p8 NpvQ== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:list-unsubscribe:list-subscribe :list-id:precedence:dkim-signature; bh=BnoZ5a8zXBDgOUNHbL88UAW6DQjkNZfNNqp0jpmXUIM=; fh=ofMv7648eDAg50Gcz4oju0zXK1WTx9dRqZb9P7bUfjU=; b=eTOHWzNY/Ye/ZfGSW60SbiAFsDspJdKRfdCXo4O4iISuvwvdA+7+xxzspij9WWQa3y gBDEt8txgpx1HfvVnxl7qAoLHWrRrdSnydD2YJR6hBtKhJuhEvXXKTTWU3kCXqepMXyh RoyBsEi2HRphH3Im4Um2avRJwRzBylljWttXTtG3Zzl523unsA20JGhqb12oy0620QJ/ HgYtpboFoxrDBvfTtq6WUhQX0p7Q0x+K7R378yBvk9pF5xGjBEvtNotBDvE9L4otpQTM AeD1K7k+TZCXeATLXWeLHnsf1qLiFaZdwvND44iF6TCJK2BJL+Rt6idyFB0T55PIzgBt x0bg== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=TuewKqV4; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-28427-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-28427-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [147.75.80.249]) by mx.google.com with ESMTPS id bk3-20020a170906b0c300b00a2cfe9dbfadsi3986757ejb.31.2024.01.16.17.32.51 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 16 Jan 2024 17:32:51 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-28427-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) client-ip=147.75.80.249; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=TuewKqV4; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-28427-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-28427-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=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 am.mirrors.kernel.org (Postfix) with ESMTPS id C44301F25F38 for ; Wed, 17 Jan 2024 01:32:50 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 4A5F717E9; Wed, 17 Jan 2024 01:32:42 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="TuewKqV4" Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (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 68AFD10E9; Wed, 17 Jan 2024 01:32:41 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1705455161; cv=none; b=RE7RnPxq+p4Mo7PHOJMf7lV4GSQUDUNeuBqu1zqXdHKWUen13XVUCJm71lXZvLhndcsgDgYvJxecB40UkkJEP+NsjLcSeF2tGSYIr4g/pGYWOLcTM6MQaGT+zGHY/zk7pTRW/9jfF4Li1DJoi4XpBZgf1LF/S1akqBmFGPz5C2U= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1705455161; c=relaxed/simple; bh=KMX42xQoye46HN6psn1ykOIXRqnr81MlkGw6l8j7zxM=; h=Received:DKIM-Signature:Received:X-Gm-Message-State: X-Google-Smtp-Source:X-Received:MIME-Version:References: In-Reply-To:From:Date:X-Gmail-Original-Message-ID:Message-ID: Subject:To:Cc:Content-Type:Content-Transfer-Encoding; b=TOnpkVEjd9lf8k6JDbOstNXgWmpDeWM7kdPn2Qc66K7cv2M6CW0cev8+F+4bTEaL0HgW8no6oijVItz6b4P+j51edqMIGEp7dfWUCozCLWVSCEOEeVeJosCBX+pM1uRnHdo8wgRC1bc81nP+Rkh7QjmT0+d5Y8DQQ20+lVzPWaE= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=TuewKqV4; arc=none smtp.client-ip=10.30.226.201 Received: by smtp.kernel.org (Postfix) with ESMTPSA id DDEBBC43390; Wed, 17 Jan 2024 01:32:40 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1705455160; bh=KMX42xQoye46HN6psn1ykOIXRqnr81MlkGw6l8j7zxM=; h=References:In-Reply-To:From:Date:Subject:To:Cc:From; b=TuewKqV46VERoEtL7fYhO9Jij+yXWN+6IO0fKL6PilJK2R9jZDzdnyqmzwL/4SZOh kzJBQDxEYv0myNHGxtJasVdXJdOvhDWbZ53CjRIwTUrA4jSNNZt1RTfAn7JSE1Rm// 4S2fFSKukYwymSoBcy3USqitypB4U7I7bE0kMdTjD5Hvs3iS3dzo6Zw5oW863nwsIf xFrkknBv5uZhzJtBb+FMBPJ3/IW+cfFwGLSWX7CBzS3RdFkKNYyFNZtnu7WpOBEEDr 7o1iP98QdAwxlX6Uz9mPVDo5lM/p27S4kATXeI7dDmMhWkGEWxbR88+lF7BaqYsKtI GuYd9iQqFk37A== Received: by mail-oi1-f182.google.com with SMTP id 5614622812f47-3bd6d5f2076so1956469b6e.0; Tue, 16 Jan 2024 17:32:40 -0800 (PST) X-Gm-Message-State: AOJu0YzN9bJ8zyAhgWIbJV6CtqFfXUlCi2zuoOLCGnvsuI9IOC+GlOFi uK0E9Gy4IoNhZZmtr1Bprbous9BbSrxUYBBYf3s= X-Received: by 2002:a05:6871:e406:b0:206:79a3:ce0b with SMTP id py6-20020a056871e40600b0020679a3ce0bmr8631528oac.8.1705455160295; Tue, 16 Jan 2024 17:32:40 -0800 (PST) Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 References: <20240114080711.5109-1-jtornosm@redhat.com> In-Reply-To: <20240114080711.5109-1-jtornosm@redhat.com> From: Masahiro Yamada Date: Wed, 17 Jan 2024 10:32:04 +0900 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [PATCH V5 2/2] rpm-pkg: avoid install/remove the running kernel To: Jose Ignacio Tornos Martinez Cc: dcavalca@meta.com, linux-kbuild@vger.kernel.org, linux-kernel@vger.kernel.org, nathan@kernel.org, ndesaulniers@google.com, nicolas@fjasle.eu, stable@vger.kernel.org Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable On Sun, Jan 14, 2024 at 5:07=E2=80=AFPM Jose Ignacio Tornos Martinez wrote: > > Normally, upper tools and scripts are checking if we want to modify the > running kernel but not always. Check install and remove operation that > affect the running kernel to avoid possible issues. > > Tested with Fedora 38, Fedora 39, RHEL 9, Oracle Linux 9.3, > openSUSE Tumbleweed and openMandrive ROME, using dnf/zypper and rpm tools= . > > cc: stable@vger.kernel.org > Signed-off-by: Jose Ignacio Tornos Martinez > --- > scripts/package/kernel.spec | 10 ++++++++++ > 1 file changed, 10 insertions(+) > > diff --git a/scripts/package/kernel.spec b/scripts/package/kernel.spec > index 74542af8cbfe..216514cbf5f6 100644 > --- a/scripts/package/kernel.spec > +++ b/scripts/package/kernel.spec > @@ -69,6 +69,12 @@ ln -fns /usr/src/kernels/%{KERNELRELEASE} %{buildroot}= /lib/modules/%{KERNELRELEA > %clean > rm -rf %{buildroot} > > +%pre > +if [ $(uname -r) =3D=3D %{KERNELRELEASE} ];then > +echo "same kernel release is running" > /dev/stderr What is the problem with this? > +exit 1 > +fi > + > %post > if [ -x /usr/bin/kernel-install ]; then > /usr/bin/kernel-install add %{KERNELRELEASE} /lib/modules/%{KERNELRELEAS= E}/vmlinuz > @@ -85,6 +91,10 @@ fi > done > > %preun > +if [ $(uname -r) =3D=3D %{KERNELRELEASE} ];then > +echo "same kernel release is running" > /dev/stderr > +exit 1 > +fi > if [ -x /sbin/new-kernel-pkg ]; then > new-kernel-pkg --remove %{KERNELRELEASE} --rminitrd --initrdfile=3D/boot= /initramfs-%{KERNELRELEASE}.img > elif [ -x /usr/bin/kernel-install ]; then > -- > 2.43.0 > > --=20 Best Regards Masahiro Yamada