Message ID | 20230609111311.4110901-1-nik.borisov@suse.com |
---|---|
Headers |
Return-Path: <linux-kernel-owner@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:994d:0:b0:3d9:f83d:47d9 with SMTP id k13csp884643vqr; Fri, 9 Jun 2023 04:49:12 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ7R8EPRQnCWp1qpuxbe+2zaNPCrHhhJ4brQgyqEcXJtAmkN05HgyLYvYEutBCjDMwILjoie X-Received: by 2002:a17:903:32cd:b0:1af:e302:123 with SMTP id i13-20020a17090332cd00b001afe3020123mr2055025plr.3.1686311352148; Fri, 09 Jun 2023 04:49:12 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1686311352; cv=none; d=google.com; s=arc-20160816; b=ss99qDZiQXZlWs446jC75aYonid7omgkRlTRAKl4rLYTKKlUblzRR0j6lkg4/0lm+c 3V3pyJUNDJcvceQTBqb4jWAKCE9gcMH03Pj6UYBccdmm//js4kIECc222GHRiepA5edD RR03q/X3HTmJejLNe3TWHPrpmDIvg4m4impvne4BIuAORWUorQssJ6TKA+dyarJfRT/k vgpRf939oe0H+cUC5Dw59YVAHzR6kInNMCN6j5/8+IPbDvm1o7WQg3fNwqYqwjsU3/sc ckI3DA2hvgNe/Lr0sqr2iCDGQhcODIVYl4JQRo5dTUUKwmKVxRdgOOKnrj80rr5bD1Vg 3COg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from:dkim-signature; bh=sARbpKkak15x0b93ZKVWPSJ4prKaBLUd7mvhcGT/ls8=; b=UyYL2+k5DxvCOSPLX/7HTe7gBovuQ+5ATDSXSpgQW+uxY9QNX7uuXbEopIncTgWfXi Ex0mUklmuxaMtA4yQ2FzUD2TuhhWLLSbCwCvKeiCBpqWWwwtvExNgakMHvTfeW5I7J1i FZwupg5z2VNfk/yEor/XtC2B0fRfV72OdM82ym+ZzPN4/0KzjEdO5z5TDd2d2oF7kUi4 h61jI0KDxq+dhJJRtHwusabOikti95ljhr5rMtpDkKHE5FajvNHSLf6+CJwb/TsA78fM 9Qphe2lAkFUOCFE7vSdaB398G6yRiUd/KO2mCwNE6NNTnQwyvUqx+5ZvXGdTmudjTuBm K58w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@suse.com header.s=susede1 header.b="f4/AvFTM"; 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; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=suse.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id im16-20020a170902bb1000b001b1a2c14a48si2621755plb.141.2023.06.09.04.48.58; Fri, 09 Jun 2023 04:49: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; dkim=pass header.i=@suse.com header.s=susede1 header.b="f4/AvFTM"; 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; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=suse.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S239186AbjFILNT (ORCPT <rfc822;liningstudo@gmail.com> + 99 others); Fri, 9 Jun 2023 07:13:19 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57024 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231324AbjFILNR (ORCPT <rfc822;linux-kernel@vger.kernel.org>); Fri, 9 Jun 2023 07:13:17 -0400 Received: from smtp-out1.suse.de (smtp-out1.suse.de [195.135.220.28]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 250511FDC for <linux-kernel@vger.kernel.org>; Fri, 9 Jun 2023 04:13:16 -0700 (PDT) Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by smtp-out1.suse.de (Postfix) with ESMTPS id C95CB21A13; Fri, 9 Jun 2023 11:13:14 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.com; s=susede1; t=1686309194; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding; bh=sARbpKkak15x0b93ZKVWPSJ4prKaBLUd7mvhcGT/ls8=; b=f4/AvFTMHtSbNbHRPcs5Fc8PBbKoqiLDgOp/ehr4KIeKJmTnQJ3Jm15NsXJqYAHkG6yNre FAhPaSp5Skuq8zdY2+yoZ22Zd0GPpaD6PGxAcSw9wijr3ktfDpn7TtX7oLZ5JChHgY+2wB pFsq8D4MkVUb8fqyV7v1kZT0M3F2CXU= Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by imap2.suse-dmz.suse.de (Postfix) with ESMTPS id 711B0139C8; Fri, 9 Jun 2023 11:13:14 +0000 (UTC) Received: from dovecot-director2.suse.de ([192.168.254.65]) by imap2.suse-dmz.suse.de with ESMTPSA id CgHGGEoJg2ReIwAAMHmgww (envelope-from <nik.borisov@suse.com>); Fri, 09 Jun 2023 11:13:14 +0000 From: Nikolay Borisov <nik.borisov@suse.com> To: x86@kernel.org Cc: linux-kernel@vger.kernel.org, mhocko@suse.com, jslaby@suse.cz, Nikolay Borisov <nik.borisov@suse.com> Subject: [PATCH v2 0/4] Make IA32_EMULATION boot time overridable Date: Fri, 9 Jun 2023 14:13:07 +0300 Message-Id: <20230609111311.4110901-1-nik.borisov@suse.com> X-Mailer: git-send-email 2.34.1 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-4.4 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_MED,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: <linux-kernel.vger.kernel.org> X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1768225612156371778?= X-GMAIL-MSGID: =?utf-8?q?1768225612156371778?= |
Series |
Make IA32_EMULATION boot time overridable
|
|
Message
Nikolay Borisov
June 9, 2023, 11:13 a.m. UTC
Here's the 2nd version of the patch which aims to make IA32_EMULATION essentially a boot time option. The changes in this posting are: * Introduced a compile-time option CONFIG_IA32_EMULATION_DEFAULT_DISABLED which can be set during compile time and can be overriden at boot time via a new parameter 'ia32_mode'. * Documented the new parameter as per Thomas' suggestion * Added a new patch which renames ignore_sysret as per Andrew Cooper's suggestion * Fixed compat_elf_check_arch condition check to only affect compat process loading and leave x32 abi processes alone * Dropped GDT modification as this was deemed a separate change. Likely I'd need to follow up with a more complete solution. Nikolay Borisov (4): x86: Introduce CONFIG_IA32_EMULATION_DEFAULT_DISABLED Kconfig option x86/entry: Rename ignore_sysret and compile it unconditionally x86/entry: Disable IA32 syscall if ia32_disabled is true x86: Disable laoding 32bit processes if ia32_disabled is true .../admin-guide/kernel-parameters.txt | 4 ++ arch/x86/Kconfig | 5 +++ arch/x86/entry/common.c | 16 ++++++++ arch/x86/entry/entry_64.S | 6 +-- arch/x86/include/asm/desc.h | 1 + arch/x86/include/asm/elf.h | 9 ++++- arch/x86/include/asm/processor.h | 2 +- arch/x86/include/asm/traps.h | 4 ++ arch/x86/kernel/cpu/common.c | 37 ++++++++++--------- arch/x86/kernel/idt.c | 7 ++++ 10 files changed, 67 insertions(+), 24 deletions(-) -- 2.34.1
Comments
From: Nikolay Borisov > Sent: 09 June 2023 12:13 > > Here's the 2nd version of the patch which aims to make IA32_EMULATION essentially > a boot time option. The changes in this posting are: Does it make any sense to be able to enable/disable it at run-time (through a sysctl). Perhaps only if enabled at boot - where it can be a 'soft disable' even though the cpu is initialised to allow the 32bit system calls. Remember, if you are root (and the system isn't hard locked down) it is pretty easy to change a global boolean variable. So it doesn't really affect the attack surface. David - Registered Address Lakeside, Bramley Road, Mount Farm, Milton Keynes, MK1 1PT, UK Registration No: 1397386 (Wales)
On 11.06.23 г. 0:46 ч., David Laight wrote: > From: Nikolay Borisov >> Sent: 09 June 2023 12:13 >> >> Here's the 2nd version of the patch which aims to make IA32_EMULATION essentially >> a boot time option. The changes in this posting are: > > Does it make any sense to be able to enable/disable it at run-time > (through a sysctl). I'd say now, because then we are losing consistency, that is if the sysctl is off, then some 32bit process is being run, then you flip it back to on and suddenly this process dies (if it's using syscalls that is). With a boot time switch we'll ensure that no 32bit process can be loaded, which at least can give the sysadmin some assurance that the machine is 32bit clean. Am I missing something? > Perhaps only if enabled at boot - where it can be a 'soft disable' > even though the cpu is initialised to allow the 32bit system calls. > > Remember, if you are root (and the system isn't hard locked down) Well, if you are root then every bet's off? > it is pretty easy to change a global boolean variable. > So it doesn't really affect the attack surface. > > David > > - > Registered Address Lakeside, Bramley Road, Mount Farm, Milton Keynes, MK1 1PT, UK > Registration No: 1397386 (Wales) >