Re: [PATCH] 2.4.9-ac10 but not only, locks_alloc_lock()

Francis Galiegue (fg@mandrakesoft.com)
Sun, 9 Sep 2001 06:33:24 -0400 (EDT)


This message is in MIME format. The first part should be readable text,
while the remaining parts are likely unreadable without MIME-aware tools.
Send mail to mime@docserver.cac.washington.edu for more info.

---1463800575-56444416-1000031533=:4681
Content-Type: TEXT/PLAIN; CHARSET=iso-8859-1
Content-Transfer-Encoding: 8BIT
Content-ID: <Pine.LNX.4.30.0109090632431.4681@toy.mandrakesoft.com>

On Sun, 9 Sep 2001, Manfred Spraul wrote:

>
> > Not sure about one thing, though: what error code to return for
> > locks_mandatory_area() on failure. It's invoked from some of the
> > {do,sys}_*{read,write}*() routines and nowhere else AFAICT. I set it
> > to -ENOMEM, maybe this is not the right thing to do.
>
> I'd put the file_lock structure on the stack. It's ~ 90 bytes long, not
> too large.
> Returning -ENOMEM is imho not acceptable: -ENOMEM is not listed in
> SusV2, and locks_alloc_lock() internally checks for rlimits (setting
> RLIM_NLIMITS to 0 and execing another app might have dangerous
> sideeffects).
>

Not sure about what you mean wrt RLIM_NLIMITS, anyway a new patch is
attached with follows your suggestion. Does it look correct?

-- 
Francis Galiegue, fg@mandrakesoft.com - Normand et fier de l'Ítre
"Programming is a race between programmers, who try and make more and more
idiot-proof software, and universe, which produces more and more remarkable
idiots. Until now, universe leads the race"  -- R. Cook

---1463800575-56444416-1000031533=:4681 Content-Type: TEXT/PLAIN; CHARSET=US-ASCII; NAME="patch-2.4.9-ac10-locks_allock_check.2" Content-Transfer-Encoding: BASE64 Content-ID: <Pine.LNX.4.30.0109090632130.4681@toy.mandrakesoft.com> Content-Description: Content-Disposition: ATTACHMENT; FILENAME="patch-2.4.9-ac10-locks_allock_check.2"

ZGlmZiAtdXJOIGxpbnV4LW9sZC9mcy9sb2Nrcy5jIGxpbnV4L2ZzL2xvY2tz LmMNCi0tLSBsaW51eC1vbGQvZnMvbG9ja3MuYwlTdW4gU2VwICA5IDA5OjAw OjA2IDIwMDENC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iAJdW5sb2NrX2tlcm5lbCgpOw0KIAly ZXR1cm4gZXJyb3I7DQogfQ0KQEAgLTE0MTEsNiArMTQxMiw5IEBADQogCXN0 cnVjdCBpbm9kZSAqaW5vZGU7DQogCWludCBlcnJvcjsNCiANCisJaWYgKGZp bGVfbG9jayA9PSBOVUxMKQ0KKwkJcmV0dXJuIC1FTk9MQ0s7DQorDQogCS8q DQogCSAqIFRoaXMgbWlnaHQgYmxvY2ssIHNvIHdlIGRvIGl0IGJlZm9yZSBj aGVja2luZyB0aGUgaW5vZGUuDQogCSAqLw0KQEAgLTE1NjMsNiArMTU2Nyw5 IEBADQogCXN0cnVjdCBmbG9jazY0IGZsb2NrOw0KIAlzdHJ1Y3QgaW5vZGUg Kmlub2RlOw0KIAlpbnQgZXJyb3I7DQorDQorCWlmIChmaWxlX2xvY2sgPT0g TlVMTCkNCisJCXJldHVybiAtRU5PTENLOw0KIA0KIAkvKg0KIAkgKiBUaGlz IG1pZ2h0IGJsb2NrLCBzbyB3ZSBkbyBpdCBiZWZvcmUgY2hlY2tpbmcgdGhl IGlub2RlLg0K ---1463800575-56444416-1000031533=:4681-- - To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/