On 9/28/22 10:25, Kevin Brodsky wrote:
On 27/09/2022 12:54, Teo Couprie Diaz wrote:
Update copy_compat_shmid_to_user to support compat_shmid64_ds that doesn't split 64-bit values.
Don't limit shmmax to INT_MAX when in compat64.
Signed-off-by: Teo Couprie Diaz teo.coupriediaz@arm.com
ipc/shm.c | 8 ++++++++ 1 file changed, 8 insertions(+)
diff --git a/ipc/shm.c b/ipc/shm.c index 6d929205bc41..679d898373bf 100644 --- a/ipc/shm.c +++ b/ipc/shm.c @@ -1336,8 +1336,10 @@ struct compat_shm_info { static int copy_compat_shminfo_to_user(void __user *buf, struct shminfo64 *in, int version) { +#ifdef CONFIG_COMPAT32 if (in->shmmax > INT_MAX) in->shmmax = INT_MAX; +#endif if (version == IPC_64) { struct compat_shminfo64 info; memset(&info, 0, sizeof(info)); @@ -1381,12 +1383,18 @@ static int copy_compat_shmid_to_user(void __user *buf, struct shmid64_ds *in, struct compat_shmid64_ds v; memset(&v, 0, sizeof(v)); to_compat_ipc64_perm(&v.shm_perm, &in->shm_perm); +#ifdef CONFIG_COMPAT64 + v.shm_atime = in->shm_atime; + v.shm_dtime = in->shm_dtime; + v.shm_ctime = in->shm_ctime; +#else v.shm_atime = lower_32_bits(in->shm_atime); v.shm_atime_high = upper_32_bits(in->shm_atime); v.shm_dtime = lower_32_bits(in->shm_dtime); v.shm_dtime_high = upper_32_bits(in->shm_dtime); v.shm_ctime = lower_32_bits(in->shm_ctime); v.shm_ctime_high = upper_32_bits(in->shm_ctime); +#endif v.shm_segsz = in->shm_segsz; v.shm_nattch = in->shm_nattch; v.shm_cpid = in->shm_cpid;
Apart from a couple of nits in patch 3 the series looks good! When you send v3 please include a cover letter (the "patch 0" generated by git format-patch), it doesn't need to say much but ideally would refer to a personal branch with the patches (makes it easier for me to review and apply the patches).
I am learning how the mailing workflow works so I appreciate the pointers ! I just sent the v3 with a cover letter, hopefully it's alright.
Kevin
Thanks for the review, Téo