lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <4C6F7D2D.6060101@s5r6.in-berlin.de>
Date:	Sat, 21 Aug 2010 09:15:57 +0200
From:	Stefan Richter <stefanr@...6.in-berlin.de>
To:	Miloslav Trmac <mitr@...hat.com>
CC:	Herbert Xu <herbert@...dor.hengli.com.au>,
	linux-crypto@...r.kernel.org,
	Nikos Mavrogiannopoulos <n.mavrogiannopoulos@...il.com>,
	Neil Horman <nhorman@...hat.com>, linux-kernel@...r.kernel.org
Subject: Re: [PATCH 06/19] Add ioctl() argument and attribute handling utils

Miloslav Trmac wrote:
> ----- "Stefan Richter" <stefanr@...6.in-berlin.de> wrote:
>> Miloslav Trmač wrote:
>>> --- /dev/null
>>> +++ b/crypto/userspace/utils.c
>> [...]
>>> +#ifdef CONFIG_COMPAT
>>> +/* max() is too clever for compile-time constants */
>>> +#define CONST_MAX(A, B) ((A) > (B) ? (A) : (B))
>>> +
>>> +#define MAX_SESSION_INPUT_DATA_SIZE					\
>>> +	(CONST_MAX(sizeof(struct ncr_session_input_data),		\
>>> +		   sizeof(struct compat_ncr_session_input_data)))
>>> +#define MAX_SESSION_OUTPUT_BUFFER_SIZE					\
>>> +	(CONST_MAX(sizeof(struct ncr_session_output_buffer),		\
>>> +		   sizeof(struct compat_ncr_session_output_buffer)))
>>> +
>>> +#else /* !CONFIG_COMPAT */
>>> +
>>> +#define MAX_SESSION_INPUT_DATA_SIZE (sizeof(struct ncr_session_input_data))
>>> +#define MAX_SESSION_OUTPUT_BUFFER_SIZE			\
>>> +	(sizeof(struct ncr_session_output_buffer))
>>> +
>>> +#endif /* !CONFIG_COMPAT */
>> 
>> struct compat_xyz cannot be bigger than struct xyz, can it?
>
> Perhaps not, but the code has been written and it's easier to keep it than to
> speculate :)

What's there to speculate? :-)  COMPAT = 32bit user on 64bit kernel.  The
latter has larger long and pointers and possibly different alignment of 64bit
data.

> It also helps document the fact that the data format depends on properties of
> the userspace.

Since it is a new ABI, it can be written to not need COMPAT ifdef'ery nor
compat handlers.
-- 
Stefan Richter
-=====-==-=- =--- =-=-=
http://arcgraph.de/sr/
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ