Received: by 2002:ab2:715a:0:b0:1fd:c064:50c with SMTP id l26csp93597lqm; Mon, 10 Jun 2024 13:54:42 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCUuo7hzfg6lUavla24o7EsmkbajN/IR3Ifp4qTNtF2N0tODfRHqKp0+66a8HANKxgEiENixC7Lq6m88NJDPo0Dc8S6E/WTcL0/4O1eZhw== X-Google-Smtp-Source: AGHT+IEsJG8yyiWEjrJZvymwhu4eHF1MGyIozP9KacdxC731oQtWUHlfNt2d1Sn6LduXyPTlh8n/ X-Received: by 2002:ac8:5d03:0:b0:440:5f59:7c58 with SMTP id d75a77b69052e-4405f597cfdmr66897131cf.47.1718052881759; Mon, 10 Jun 2024 13:54:41 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1718052881; cv=pass; d=google.com; s=arc-20160816; b=EjPIlLJun2/qV/KZEcvjVoDeceKFKuH8vm1E+6WBnuGTsXGbFePecCUG9aR4mpuRr1 GgbBkt2pNVBxUdzPsAlIa92vRxNVA68QHRQopBLrPrNePck0ZME3oI2S9OJDurkD4d2W vV6A2CifEJ4hTfME7Pa1JX6uX8dQZeUBETLKHnbf4EfgZkRak0JAw9xZ62Gcl5ZLpdSo YvlH4Yt0uE6b8V5qaP9oEcQMi5WH0dZC1qGcos+YUa49SByUXSR3AuuLLSidMt+XP9+d 8gR4pz3EXMjVXQF7xnjtr5dJftEGbSLcGO4hirX14Rq7JI7lrRkQtaXbM8m+e6R76JRI 7zuQ== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:in-reply-to:autocrypt:from:references:cc :to:content-language:subject:user-agent:mime-version :list-unsubscribe:list-subscribe:list-id:precedence:date:message-id :dkim-signature:dkim-signature:dkim-signature:dkim-signature; bh=D8EvIpkskRr1vhGK9ri1iDKoIXzTaRUj7OtCPaP0rAI=; fh=LFqrDTCouqznYvDykukPUcmT7Pk//jiS5vCNqOd6nWU=; b=AYFn/I6n8ttXmexBNzVgNbclvM0veTVRP+p+K/w79gFDO1yyXWn6nU6HoqzQ586rWg dUSNPPP+cElsQ7AxtdZXCqCoBZzXaiDXm/uVNyttNLkrTbAjGT9mh0qxn34urzD1IV9l vC4b6apCPcwGGL6LEztGC7EsahH6ZKP/mX72hKnKk/fq2lDh2kk6HruhJwE2RD3FvTq5 hx9Tl0NoK3rpGLy1j73prvltgFNPCyd2bFPPy9gYgl48rD6bVutYYsEpc38J98KM31lD pmCtrgmm7QNYaYZjnduiy5+ld1tFj/Gh0l0ODD/CF9Twa88vvtb5OktYbFT6boFn8DUg UbHQ==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@suse.cz header.s=susede2_rsa header.b=1eYfRFM8; dkim=neutral (no key) header.i=@suse.cz header.s=susede2_ed25519; dkim=pass header.i=@suse.cz header.s=susede2_rsa header.b=1eYfRFM8; dkim=neutral (no key) header.i=@suse.cz header.s=susede2_ed25519; arc=pass (i=1 spf=pass spfdomain=suse.cz dkim=pass dkdomain=suse.cz dkim=pass dkdomain=suse.cz); spf=pass (google.com: domain of linux-kernel+bounces-208893-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-208893-linux.lists.archive=gmail.com@vger.kernel.org" Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [2604:1380:45d1:ec00::1]) by mx.google.com with ESMTPS id d75a77b69052e-44038a8638dsi118055661cf.182.2024.06.10.13.54.41 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 10 Jun 2024 13:54:41 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-208893-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) client-ip=2604:1380:45d1:ec00::1; Authentication-Results: mx.google.com; dkim=pass header.i=@suse.cz header.s=susede2_rsa header.b=1eYfRFM8; dkim=neutral (no key) header.i=@suse.cz header.s=susede2_ed25519; dkim=pass header.i=@suse.cz header.s=susede2_rsa header.b=1eYfRFM8; dkim=neutral (no key) header.i=@suse.cz header.s=susede2_ed25519; arc=pass (i=1 spf=pass spfdomain=suse.cz dkim=pass dkdomain=suse.cz dkim=pass dkdomain=suse.cz); spf=pass (google.com: domain of linux-kernel+bounces-208893-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-208893-linux.lists.archive=gmail.com@vger.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 ny.mirrors.kernel.org (Postfix) with ESMTPS id B620E1C2165E for ; Mon, 10 Jun 2024 20:54:40 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id D1C2D54673; Mon, 10 Jun 2024 20:54:31 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=suse.cz header.i=@suse.cz header.b="1eYfRFM8"; dkim=permerror (0-bit key) header.d=suse.cz header.i=@suse.cz header.b="G2vfdYUX"; dkim=pass (1024-bit key) header.d=suse.cz header.i=@suse.cz header.b="1eYfRFM8"; dkim=permerror (0-bit key) header.d=suse.cz header.i=@suse.cz header.b="G2vfdYUX" Received: from smtp-out1.suse.de (smtp-out1.suse.de [195.135.223.130]) (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 EE3DC6F2FD for ; Mon, 10 Jun 2024 20:54:28 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=195.135.223.130 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1718052870; cv=none; b=QJpnu71iR6ab/DfKR2Aa1j1/b0Bpt/QyFhpDFIbOQBxiP8Ch/cXnGt5mZqWfD+i+qVOA732hAmeWzxCXUeq32m9ApguUA7blHGrsWQsJmvLAtr82PwvXjJfozFCe6aKEK3IEbi2wUW9mNkMC14cD1BEmxwo2VvrTaB31ywoCpHg= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1718052870; c=relaxed/simple; bh=UV93V0MtfJyC3kFzzVhZfURa1qRcTVKvomW70MH3jpU=; h=Message-ID:Date:MIME-Version:Subject:To:Cc:References:From: In-Reply-To:Content-Type; b=PI9YosaSzd96QVtlw7hsIRrjxuERCi25KuphKfeiKsiYg20A8U7FufqvIdMimFVoVahSZZnDMaQgedXi7PxsN3APqNAjqeoNat2EIfIOkw1XUoYXon/WaCFAMyrsR2JprzOwJRmBwG6wLy/HxjggI7CnwLAqVSc/H9ce5ZkVUiQ= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=suse.cz; spf=pass smtp.mailfrom=suse.cz; dkim=pass (1024-bit key) header.d=suse.cz header.i=@suse.cz header.b=1eYfRFM8; dkim=permerror (0-bit key) header.d=suse.cz header.i=@suse.cz header.b=G2vfdYUX; dkim=pass (1024-bit key) header.d=suse.cz header.i=@suse.cz header.b=1eYfRFM8; dkim=permerror (0-bit key) header.d=suse.cz header.i=@suse.cz header.b=G2vfdYUX; arc=none smtp.client-ip=195.135.223.130 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=suse.cz Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=suse.cz Received: from imap1.dmz-prg2.suse.org (unknown [10.150.64.97]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by smtp-out1.suse.de (Postfix) with ESMTPS id DFF47223A3; Mon, 10 Jun 2024 20:54:26 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.cz; s=susede2_rsa; t=1718052866; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:autocrypt:autocrypt; bh=D8EvIpkskRr1vhGK9ri1iDKoIXzTaRUj7OtCPaP0rAI=; b=1eYfRFM8h57O8vZYzfJIqGK1Za2rO4EhW+u4u5kh6HPkEaaAO0qx9Q6hnth9dVSWxqHL0r cjhJj/cBvUBnmgCod+vnj0Yl3cAJK4MW43rw+lkvbmehTpoJQoUhF4w8yJ9vzVxARYpnpL OlUAQHzyTCOEMLw2KfHpShxYYvqt0EM= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.cz; s=susede2_ed25519; t=1718052866; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:autocrypt:autocrypt; bh=D8EvIpkskRr1vhGK9ri1iDKoIXzTaRUj7OtCPaP0rAI=; b=G2vfdYUX6E+/CiL22NT2ajbePzW/0qow2pRw0/daEuOXy0dIQI3cHbIiLOqVYWHflF7Q5U XQS2NCrUpPIZCFCA== Authentication-Results: smtp-out1.suse.de; none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.cz; s=susede2_rsa; t=1718052866; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:autocrypt:autocrypt; bh=D8EvIpkskRr1vhGK9ri1iDKoIXzTaRUj7OtCPaP0rAI=; b=1eYfRFM8h57O8vZYzfJIqGK1Za2rO4EhW+u4u5kh6HPkEaaAO0qx9Q6hnth9dVSWxqHL0r cjhJj/cBvUBnmgCod+vnj0Yl3cAJK4MW43rw+lkvbmehTpoJQoUhF4w8yJ9vzVxARYpnpL OlUAQHzyTCOEMLw2KfHpShxYYvqt0EM= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.cz; s=susede2_ed25519; t=1718052866; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:autocrypt:autocrypt; bh=D8EvIpkskRr1vhGK9ri1iDKoIXzTaRUj7OtCPaP0rAI=; b=G2vfdYUX6E+/CiL22NT2ajbePzW/0qow2pRw0/daEuOXy0dIQI3cHbIiLOqVYWHflF7Q5U XQS2NCrUpPIZCFCA== Received: from imap1.dmz-prg2.suse.org (localhost [127.0.0.1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by imap1.dmz-prg2.suse.org (Postfix) with ESMTPS id BFBDE13A51; Mon, 10 Jun 2024 20:54:26 +0000 (UTC) Received: from dovecot-director2.suse.de ([2a07:de40:b281:106:10:150:64:167]) by imap1.dmz-prg2.suse.org with ESMTPSA id I8UqLgJoZ2YOLQAAD6G6ig (envelope-from ); Mon, 10 Jun 2024 20:54:26 +0000 Message-ID: <8b844d71-01f1-472b-a63a-4c9cdb26e9ef@suse.cz> Date: Mon, 10 Jun 2024 22:54:26 +0200 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 v3 1/3] slab: make check_object() more consistent Content-Language: en-US To: "Christoph Lameter (Ampere)" , Chengming Zhou Cc: Pekka Enberg , David Rientjes , Joonsoo Kim , Andrew Morton , Roman Gushchin , Hyeonggon Yoo <42.hyeyoo@gmail.com>, Feng Tang , linux-mm@kvack.org, linux-kernel@vger.kernel.org, zhouchengming@bytedance.com, Kees Cook References: <20240607-b4-slab-debug-v3-0-bb2a326c4ceb@linux.dev> <20240607-b4-slab-debug-v3-1-bb2a326c4ceb@linux.dev> <63da08b7-7aa3-3fad-55e6-9fc3928a49de@gentwo.org> From: Vlastimil Babka Autocrypt: addr=vbabka@suse.cz; keydata= xsFNBFZdmxYBEADsw/SiUSjB0dM+vSh95UkgcHjzEVBlby/Fg+g42O7LAEkCYXi/vvq31JTB KxRWDHX0R2tgpFDXHnzZcQywawu8eSq0LxzxFNYMvtB7sV1pxYwej2qx9B75qW2plBs+7+YB 87tMFA+u+L4Z5xAzIimfLD5EKC56kJ1CsXlM8S/LHcmdD9Ctkn3trYDNnat0eoAcfPIP2OZ+ 9oe9IF/R28zmh0ifLXyJQQz5ofdj4bPf8ecEW0rhcqHfTD8k4yK0xxt3xW+6Exqp9n9bydiy tcSAw/TahjW6yrA+6JhSBv1v2tIm+itQc073zjSX8OFL51qQVzRFr7H2UQG33lw2QrvHRXqD Ot7ViKam7v0Ho9wEWiQOOZlHItOOXFphWb2yq3nzrKe45oWoSgkxKb97MVsQ+q2SYjJRBBH4 8qKhphADYxkIP6yut/eaj9ImvRUZZRi0DTc8xfnvHGTjKbJzC2xpFcY0DQbZzuwsIZ8OPJCc LM4S7mT25NE5kUTG/TKQCk922vRdGVMoLA7dIQrgXnRXtyT61sg8PG4wcfOnuWf8577aXP1x 6mzw3/jh3F+oSBHb/GcLC7mvWreJifUL2gEdssGfXhGWBo6zLS3qhgtwjay0Jl+kza1lo+Cv BB2T79D4WGdDuVa4eOrQ02TxqGN7G0Biz5ZLRSFzQSQwLn8fbwARAQABzSBWbGFzdGltaWwg QmFia2EgPHZiYWJrYUBzdXNlLmN6PsLBlAQTAQoAPgIbAwULCQgHAwUVCgkICwUWAgMBAAIe AQIXgBYhBKlA1DSZLC6OmRA9UCJPp+fMgqZkBQJkBREIBQkRadznAAoJECJPp+fMgqZkNxIQ ALZRqwdUGzqL2aeSavbum/VF/+td+nZfuH0xeWiO2w8mG0+nPd5j9ujYeHcUP1edE7uQrjOC Gs9sm8+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 8R8mUyJHqbvaz+yTLnvRwfe/VwafFfDMx5GYVYzMY9TWpA8psFTKTUIIQmx2scYsRBUwm5VI EurRWKqENcDRjyo+ol59j0FViYysjQQeobXBDDE31t5SBg++veI6tXfpco/UiKEsDswL1WAr tEAZaruo7254TyH+gydURl2wJuzo/aZ7Y7PpqaODbYv727Dvm5eX64HCyyAH0s6sOCyGF5/p eIhrOn24oBf67KtdAN3H9JoFNUVTYJc1VJU3R1JtVdgwEdr+NEciEfYl0O19VpLE/PZxP4wX PWnhf5WjdoNI1Xec+RcJ5p/pSel0jnvBX8L2cmniYnmI883NhtGZsEWj++wyKiS4NranDFlA HdDM3b4lUth1pTtABKQ1YuTvehj7EfoWD3bv9kuGZGPrAeFNiHPdOT7DaXKeHpW9homgtBxj 8aX/UkSvEGJKUEbFL9cVa5tzyialGkSiZJNkWgeHe+jEcfRT6pJZOJidSCdzvJpbdJmm+eED w9XOLH1IIWh7RURU7G1iOfEfmImFeC3cbbS73LQEFGe1urxvIH5K/7vX+FkNcr9ujwWuPE9b 1C2o4i/yZPLXIVy387EjA6GZMqvQUFuSTs/GeBcv0NjIQi8867H3uLjz+mQy63fAitsDwLmR EP+ylKVEKb0Q2A== In-Reply-To: <63da08b7-7aa3-3fad-55e6-9fc3928a49de@gentwo.org> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-Spam-Level: X-Spamd-Result: default: False [-2.79 / 50.00]; BAYES_HAM(-3.00)[100.00%]; SUSPICIOUS_RECIPS(1.50)[]; NEURAL_HAM_LONG(-1.00)[-1.000]; NEURAL_HAM_SHORT(-0.20)[-1.000]; MIME_GOOD(-0.10)[text/plain]; XM_UA_NO_VERSION(0.01)[]; TAGGED_RCPT(0.00)[]; RCVD_VIA_SMTP_AUTH(0.00)[]; ARC_NA(0.00)[]; MIME_TRACE(0.00)[0:+]; RCVD_TLS_ALL(0.00)[]; RCPT_COUNT_TWELVE(0.00)[13]; MID_RHS_MATCH_FROM(0.00)[]; FREEMAIL_ENVRCPT(0.00)[gmail.com]; DKIM_SIGNED(0.00)[suse.cz:s=susede2_rsa,suse.cz:s=susede2_ed25519]; FROM_HAS_DN(0.00)[]; FREEMAIL_CC(0.00)[kernel.org,google.com,lge.com,linux-foundation.org,linux.dev,gmail.com,intel.com,kvack.org,vger.kernel.org,bytedance.com,chromium.org]; TO_DN_SOME(0.00)[]; FROM_EQ_ENVFROM(0.00)[]; RCVD_COUNT_TWO(0.00)[2]; TO_MATCH_ENVRCPT_ALL(0.00)[]; FUZZY_BLOCKED(0.00)[rspamd.com]; DBL_BLOCKED_OPENRESOLVER(0.00)[imap1.dmz-prg2.suse.org:helo] X-Spam-Score: -2.79 X-Spam-Flag: NO On 6/10/24 7:07 PM, Christoph Lameter (Ampere) wrote: > On Fri, 7 Jun 2024, Chengming Zhou wrote: > >> There are two inconsistencies in check_object(), which are alignment >> padding checking and object padding checking. We only print the error >> messages but don't return 0 to tell callers that something is wrong >> and needs to be handled. Please see alloc_debug_processing() and >> free_debug_processing() for details. > > If the error is in the padding and the redzones are ok then its likely > that the objects are ok. So we can actually continue with this slab page > instead of isolating it. > > We isolate it in the case that the redzones have been violated because > that suggests someone overwrote the end of the object f.e. In that case > objects may be corrupted. Its best to isolate the slab and hope for the > best. > > If it was just the padding then the assumption is that this may be a > scribble. So clean it up and continue. Hm is it really worth such nuance? We enabled debugging and actually hit a bug. I think it's best to keep things as much as they were and not try to allow further changes. This e.g. allows more detailed analysis if somebody later notices the bug report and decides to get a kdump crash dump (or use drgn on live system). Maybe we should even stop doing the restore_bytes() stuff, and prevent any further frees in the slab page to happen if possible without affecting fast paths (now we mark everything as used but don't prevent further frees of objects that were actually allocated before). Even if some security people enable parts of slub debugging for security people it is my impression they would rather panic/reboot or have memory leaked than trying to salvage the slab page? (CC Kees)