Re: [kernel-hardening] destroy unused shmem segments

Solar Designer
2011-06-15T14:42:45Z

Vasiliy,

On Tue, Jun 14, 2011 at 12:33:45PM +0400, Vasiliy Kulikov wrote:
> It is used in case shmem segment was created, but never used. In this
> case refcount is never incremented and never decremented, shm_clone()
> isn't called.
>
> If shmctl() sets IPC_RMID, it is deleted, but as you have implemented
> implicit semantics (like IPC_RMID is always set), actual check in
> shmget()+exit() is needed.
>
> Spotted by reading -ow README and testing :)

Oh, right. Having documentation is good.

> I think forcing IPC_RMID should be configurable via sysctl like other
> ipc variables. Something like /proc/sys/kernel/shm_orphans_denied.
> And I think changing it from 0 to 1 should destroy already orphaned
> segments without users.

OK.

Thanks,

Alexander